12-03-2023, 02:43 AM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2023
Device: Kindl
|
copy filename to epub metadata in batch mode
Hi all,
i am new here, and i have a serious problem, for what i did not find any solution with the common tools that are available for free. I am also willing to write skripts to do what i want. here is my problem: I have lots of ebooks (epub) that are all ordered in folders alphabetically. The filename contains the author and the title in the following way: lastname, surname - title.epub If i read this files into my Tolino the books are not sorted like this. That is because the metadata do not match to the correct authors as they are stored in the filenames. So i want to correct the metadata automatically. With calibre i have the problem, that it always generates duplicates of the file and the new filenames begin with the title not the author. Also it generates opf files, that i do not want. There must be a way to store the metadata inside the epub files without using opf files. Because otherwise i cannot explain how Tolino or Calibre know the already existing metadata without the opf, which i currently do not have. With "epub metadata editor" i am not able to edit all the tags. Because if i read the modified files into Calibre, some tags are still missing or are still wrong. Most are working proberly. Epub metadata editor obviously modifies the metadata inside the epub files. I am looking for a tool like I use for mp3 tag editing: Mp3tag There i can easyly copy the filename into the several tags inside the mp3 file. And all can be done automatically in batch mode. Does anyone have help. cheers and thanks a lot. |
12-03-2023, 07:38 AM | #2 |
A Hairy Wizard
Posts: 3,097
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
You can use Calibre to read the metadata from the file name. Then you can use a specific template and "Save to disk". It will then use the format you gave it to save the epub to a folder.
I use the format: author’s last, first - series name series# - title.ePub There are specific codes that I’ll need to copy from my computer when I get there, but it looks something like this: “Herbert, Frank - Dune 04 - God Emperor of Dune.epub” As for Calibre making duplicates, just create a different library for purposes of this metadata exercise. Edit: if you don’t mind writing a program, and are familiar with python, one of the MR members is developing a module so you can programmatically acces the epubs. That may be more fun than learning the functions already in Calibre. Last edited by Turtle91; 12-06-2023 at 12:08 PM. |
12-06-2023, 12:08 PM | #3 |
A Hairy Wizard
Posts: 3,097
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
I am so sorry for the delayed update...had a run to the emergency room and been dealing with that and this post completely slipped my mind.
The filename template code can be entered into Calibre's preferences by going to Preferences/Saving books to disk/Save template and adding the codes to your preference. I used the following for the Herbert example I gave above: {author_sort} - {series} {series_index:0>2s|| - } {title} ---- To read the metadata from the filename (I actually think it might be the default??) go into Prefences/Adding books and clear the checkbox Read metadata from file contents rather than filename then you can put a template on how your filenames are layed out. This will properly read the Herbert filename example I gave above: (?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ? There is a nice little test function in there to help you build the regex and check matches against your particular filename method. |
Tags |
metadata filename |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Best way to copy existing data/metadata to a new copy of a book | hollowpoint | Library Management | 3 | 07-05-2021 10:21 PM |
Change ebook metadata using filename in command-line mode | hfpop | Calibre | 4 | 02-18-2016 05:35 PM |
Save the Metadata to the Libary files/change filename to the Metadata | RyuujiTakasu | Calibre | 10 | 03-19-2014 02:01 PM |
How to copy only first N character from filename ? | Giuseppe Chillem | Calibre | 6 | 03-17-2013 11:25 PM |
Batch getting tags from filename program? | Pauly454 | Sony Reader | 1 | 12-25-2008 11:26 PM |