Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 11-05-2012, 06:19 AM   #1
Sinnott
Junior Member
Sinnott began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2011
Device: Archos Android Tablet
Adding books with different filename structures

I'm pretty new to Calibre so please excuse me if this has been answered before. I looked but couldn't find an answer.

I want to import a library that uses this naming convention:

<Author> - <Series> <series number> - <title>

for books that are not part of a series, the files look like this:

<Author> - <title>

Examples:

Stieg Larsson - Millenium 03 - Girl Who Kicked the Hornets' Nest, The.epub
Stephen King - The Dead Zone.epub

Is there a regular expression that will import both types and put the fields where they should be?

After a lot of reading and trying things, I discovered that this expression:

(?P<author>[^_]+) - (?P<series>.+)(?P<series_index> [0-9]+) - (?P<title>.+)

Will work for the first case, but not the second. Any suggestions? There are a lot of books and I'd rather not manually separate them.
Sinnott is offline   Reply With Quote
Old 11-08-2012, 03:55 PM   #2
mdb5972
Member
mdb5972 began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jan 2011
Device: Sony PRS350
I added the Quick Preferences Plug-in to allow me to switch quickly between various 'expressions'

And have also been looking (playing) with this expression added in one of the other discussions


(?P<author>[^-~]+)(( *- * | *-- * | *~ *)[[(]?(?P<series>[^-~]+)[[( ]+(?P<series_index>[0-9.]+)?[])]?)?( *, * | *- * | *-- * | *~ *)(?P<title>.+)


/* break down */
(?P<author>[^-~]+)
(
( - | *-- * | *~ *)
[[(]?
(?P<series>[^-~]+)
[[( ]+
(?P<series_index>[0-9.]+)?
[])]?
)?
( *, * | - | *-- * | *~ *)
(?P<title>.+)


So it matches:
Sir Arthur Conan Doyle - Sherlock Holmes 1 - Study in red.doc
Sir Arthur Conan Doyle - Study in red.doc
Sir Arthur Conan Doyle -- Sherlock Holmes 1 - Study in red.doc
Sir Arthur Conan Doyle -- Study in red.doc
Sir Arthur Conan Doyle--Sherlock Holmes 1.0--Study in red.doc
Sir Arthur Conan Doyle--Study in red.doc
Sir Arthur Conan Doyle - (Sherlock Holmes 1) - Study in red.doc
Sir Arthur Conan Doyle - [Sherlock Holmes 1] - Study in red.doc
Sir Arthur Conan Doyle - Sherlock Holmes [1] - Study in red.doc
Sir Arthur Conan Doyle - Sherlock Holmes (1) - Study in red.doc

Last edited by mdb5972; 11-08-2012 at 03:58 PM. Reason: spaces not showing up
mdb5972 is offline   Reply With Quote
Advert
Old 11-09-2012, 08:12 AM   #3
Sinnott
Junior Member
Sinnott began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2011
Device: Archos Android Tablet
Amazing mdb! I entered just a few test titles and it worked like a charm. I never would have come up with that. Much appreciated.
Sinnott is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression - Adding metadata from filename LMF Calibre 1 03-20-2012 06:46 PM
[Old Thread] Adding new column to sort by filename ShinRa Actual Library Management 20 02-12-2012 10:22 AM
Adding books with series in the filename genright Library Management 5 06-13-2011 03:20 PM
Is it possible to sent books to device with filename in non-ascii characters? flyisland Calibre 8 10-16-2010 05:35 AM
Help with adding books please stustaff Calibre 12 10-27-2009 02:30 PM


All times are GMT -4. The time now is 03:57 AM.


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