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 12-28-2010, 03:47 PM   #1
ejjenkins
Junior Member
ejjenkins began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2010
Device: Kindle 3G-Wifi
RegEx - filename metadata help

I have read through most of the threads for Calibre and regular expressions, I am at a loss.

I have a lot of books that are all saved in the exact same format and I want to be able to extract the metadata from the filenames. Here are a couple of examples:

Adams, Robert,Castaways In Time,01,Castaways in Time.txt
Anderson, Kevin J.,Game Earth,01,Game Earth.txt

All of them are: Author Last Name, First Name, Series Name, Series Index, and Title

If there is no series or series index, the comma will still be there, for example:

Aldiss, Brian W.,,,The Dark Light Years.txt
Anderson, Poul,,,Brainwave.txt

I know this is probably pretty easy and straightforward, but I can't seem to get my brain around this.

And as long as I am asking for the world, is there some way when Calibre sends the file to my kindle it will add the series name and index to the title so that is shows, for example:

Castaways in Time - 01 - Castaways in Time
Castaways in Time - 02 - The Seven Magical Jewels of Ireland

Any help would be appreciated.

Thank you.

Last edited by ejjenkins; 12-28-2010 at 04:00 PM.
ejjenkins is offline   Reply With Quote
Old 12-28-2010, 05:15 PM   #2
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80446
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
For importing metadata from filenames, you need regular expressions, for setting the path Calibre uses, you need the template language. There are tutorials available for both in the user manual.
Manichean is offline   Reply With Quote
 
Enthusiast
Old 12-28-2010, 05:21 PM   #3
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,224
Karma: 1334002
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
Quote:
Originally Posted by ejjenkins View Post
I have read through most of the threads for Calibre and regular expressions, I am at a loss.

I have a lot of books that are all saved in the exact same format and I want to be able to extract the metadata from the filenames. Here are a couple of examples:

Adams, Robert,Castaways In Time,01,Castaways in Time.txt
Anderson, Kevin J.,Game Earth,01,Game Earth.txt

All of them are: Author Last Name, First Name, Series Name, Series Index, and Title

If there is no series or series index, the comma will still be there, for example:

Aldiss, Brian W.,,,The Dark Light Years.txt
Anderson, Poul,,,Brainwave.txt

I know this is probably pretty easy and straightforward, but I can't seem to get my brain around this.
Try this regex:
^(?P<author>([^,]+,[^,]+)),(?P<series>[^,]*),(?P<series_index>[^,]*),(?P<title>[^,]*)
kiwidude is offline   Reply With Quote
Old 12-28-2010, 05:33 PM   #4
ejjenkins
Junior Member
ejjenkins began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2010
Device: Kindle 3G-Wifi
kiwidude - Thank you for such a quick response, I truly appreciate it. I tried it out on several with and without series information and it worked flawlessly.

Thank you very much.
ejjenkins is offline   Reply With Quote
Old 12-28-2010, 05:47 PM   #5
ejjenkins
Junior Member
ejjenkins began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2010
Device: Kindle 3G-Wifi
Manichean - Thank you for pointing me in the direction of the template language, that was pretty straightforward for what I wanted, now Calibre puts the books onto my Kindle with the naming convention I wanted. I just had no idea where to look for that feature.

Thank you very much!
ejjenkins is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex and Metadata from filename. asrrin29 Calibre 2 09-20-2010 05:13 PM
Metadata in Title/filename mezme Calibre 0 08-18-2010 03:08 AM
Need help with metadata by filename artbatista Calibre 17 12-19-2009 07:51 AM
Little Help with Metadata from Filename needed plunderydoo Calibre 4 09-06-2009 08:34 AM
Metadata from filename problem kad032000 Calibre 0 05-24-2009 02:26 AM


All times are GMT -4. The time now is 08:37 PM.


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