![]() |
#1 |
Member
![]() Posts: 12
Karma: 10
Join Date: May 2010
Device: iPad
|
Need an import expression to use sub-foldername as series
I'm trying, as patiently as I can, to use Calibre to move my ebooks into it's library without having to spend huge effort reorganizing all of my books. Currently I have my books organized into a very logical structure (I would think most would agree) which is Author\Series\filename.xxx. For the most part the files are author - series (maybe) - title.xxx
It's possible the filename won't contain the series name and yes, the series may be in a sub-folder with the series name as well. In short: 1. Some files will have series as the second part of the filename, some wont (just author - title.xxx) 2. Some may be in a proper series sub-folder (under the author folder). I expect to import folders by Author). 3. Some may not contain the author (maybe just series - title or just title.xx) but will be in the author folder (as all will). Is it possible to write an expression that will: 1. Use the first subfolder found as the series. 2. Use the second phrase (found after the first - and before the second -) as the series. 3. Use the second phrase (found after the first - with NO OTHER dashes in the filename) as the title (instead of series as number 2) 4. Use the main source folder as the author 5. Use the first phrase (before the first -) as the author (if no dashes then it will be title) 6 Use the filename itself as the title if it contains no dashes. Pretty complex, I know, but I'm hopeful. Unfortunately I don't know python and it's regular expression syntax and it looks pretty much like a pita to learn any time soon). Thanks. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Member
![]() Posts: 13
Karma: 10
Join Date: Jun 2007
Location: Golden Valley AZ US
Device: Dell_Axim/Astak_PP
|
If/then statments
Quote:
What about the rest of the problems? This looks a lot like what I am looking to do. This is my first exposure to either Python or regular expressions. I have been trying to find examples of different formats that work to build up a collections that will handle most of the filename forms I run into. It seems that an IF/THEN/ELSE would do the trick for most of them. tazem |
|
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
You can't do conditionals and you can't use folders in the regex for book importing. You can use any part of the filename, and if a part isn't in the filename, like a series, that's OK, it will just be blank. If you need help writing a regex, post some example filenames with your request.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regular Expression Help | smartmart | Calibre | 5 | 10-17-2010 05:19 AM |
Different export filenames for series / non-series books? | HarryT | Calibre | 3 | 08-18-2010 12:30 PM |
Pet peeve: series authors who introduce things in non-series books! | ficbot | Reading Recommendations | 12 | 02-06-2010 02:14 AM |
Help: Is there a search expression for "books without Series"? | LARdT | Calibre | 3 | 01-20-2010 09:34 PM |
What is the default regular expression for filename import? | palex481 | Calibre | 2 | 03-22-2009 06:11 PM |