Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-13-2010, 01:42 AM   #1
nitrogun
Junior Member
nitrogun began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
Question Filenames to metadata, preserving filenames.

Kindle 3 arriving soon. Home runs on Mac. Calibre, Stanza, Kindle for Mac installed.
A friend passed on to me a disk full of non-DRM e-books he had downloaded over the years from various sites. They are in assorted (non-drm) pdf, rtf, doc, lit formats, and I need to convert to Mobi for the kindle. None of the files appear to have metadata other than the filenames.

Stanza can convert one at a time with same file name in Kindle format, but Calibre is preferred as I can batch convert a lot to Mobi at once. But I would like to get the metadata from filenames in the new files, and filenames the same as originals, to ease the task of checking that each title has been successfully converted before deleting the old versions.

In the Calibre preferences page, under add/save, there is a field for "Regular Expression" (default appears to be " (?P<author>[^_]+) - (?P<title>.+)") followed by a test panel with field for pasting in filename so that metadata can be read from the filename and inserted into the new converted file. When I just convert it, the title and author is "Unknown" and the filename is different.
I tried looking at the "reference" link that allegedly explained it all, and was totally overwhelmed and confused as a result. Nor am I familiar with the Terminal window, and only use it with detailed printed instructions in front of me.

I pasted (into the filename test field) filenames in the 3 formats as below and pressed the "TEST" button, but no results appeared in the fields below. These formats represent the various types of filenames in the disk I was given.
Examples:
Ford, Harry - Lost 6 - Of Starting and Ending
The Sittaford Mystery - Christie_ Agatha
Anders, Ken J - Scotfree

Problem-how to batch convert files with names like the above, resulting in Author/series/title metadata from the filename being inserted into the new file,and also resulting in same filenames so that I can alphabetically sort the old and new together to check that all conversions done before deleting the originals. I will simply be loading batches into Calibre for conversion, copying the results back into original folders, checking that all are done, then deleting all original filetypes once checked, then deleting Calibre Library.

Your advice on achieving this would be appreciated, and especially if you could type out the "regular expressions" (so that I could Copy/Paste them into the field) for the three filename formats as above so they will be recognized as metadata.
nitrogun is offline   Reply With Quote
Old 09-13-2010, 01:55 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,775
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
you need to add extensions to the filenames in the test field
kovidgoyal is online now   Reply With Quote
Advert
Old 09-13-2010, 02:23 AM   #3
nitrogun
Junior Member
nitrogun began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
OK, that allows the test to be read, but the result of pasting in
Anders, Ken J - Lethal Exposure.pdf

resulted in Title Lethal Exposure (correct)
and Author Ken J (incorrect)

If I used a filename with a series name as well,it read it as being part of Author name, following the Ken J.
The resulting filename was Lethal Exposure - Ken J
nitrogun is offline   Reply With Quote
Old 09-13-2010, 02:29 AM   #4
nitrogun
Junior Member
nitrogun began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
Perhaps part of my problem is the way the files are named, with Surname, Firstname - series name - Title.extension
Unfortunately there are hundreds of books in the file, so it would be a monumental task o change all filenames first.

Looking for a way to make the filename the same as the original, and at same time to insert correct metadata from my flawed filenames. Is this possible.

Last edited by nitrogun; 09-13-2010 at 02:37 AM. Reason: left bit out.
nitrogun is offline   Reply With Quote
Old 09-13-2010, 04:24 AM   #5
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by nitrogun View Post
OK, that allows the test to be read, but the result of pasting in
Anders, Ken J - Lethal Exposure.pdf
I don't know how to write these expressions, but I have one that someone else wrote that handles the above fine.

Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)\s*-\s*)?(?P<title>[^\-_0-9]+)
See attached for the tests with a series included.

Again, I didn't write this, but someone on this board did.
Attached Thumbnails
Click image for larger version

Name:	regex_test-1.jpg
Views:	623
Size:	42.7 KB
ID:	58127   Click image for larger version

Name:	regex_test-2.jpg
Views:	564
Size:	42.2 KB
ID:	58128  
DoctorOhh is offline   Reply With Quote
Advert
Old 09-13-2010, 10:50 PM   #6
nitrogun
Junior Member
nitrogun began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
@dwanthny your grammatical example solved the main problem for me. Just had to edit/remove last section and it does most of what I wanted. Thank you.
nitrogun is offline   Reply With Quote
Reply

Tags
calibre, convert, filenames, metadata

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF Filenames vs Metadata Title clintbradford Calibre 0 07-12-2010 11:50 PM
batch metadata editing possible from filenames? caponesan Reading and Management 3 09-03-2009 12:50 PM
Converting filenames gafitz Calibre 0 05-06-2009 03:20 PM
editing filenames that have been emailed to you knives of ice Amazon Kindle 1 10-08-2008 10:33 AM
libprs500 metadata from filenames Dan23 Calibre 2 06-29-2008 06:04 PM


All times are GMT -4. The time now is 11:04 AM.


MobileRead.com is a privately owned, operated and funded community.