02-02-2015, 12:59 PM | #1 |
Member
Posts: 10
Karma: 10
Join Date: Dec 2014
Device: Kindle Fire HDX 7, Ipad
|
Regex in importing help.
Hello.
I have a bunch of files on my desktop that I'd like to import without a ton of manual metadata editing. I noticed the Regular Expression import from filename. I'm gonna get around to regex one of these days but in the meantime I'd be grateful if someone helped me. My files on hard disk are arranged as such. [Novel] The Top (Nein) 01 -e- I need to import them in the following format. Title=The Top 01 Series=The Top [01] Alternate Title(Self Made Field)=Nein Status(Self Made Field)=-e- Thanks for the help. |
02-02-2015, 09:12 PM | #2 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
You can't put part of the filename into two different fields.
Also, you cannot use custom columns in the adding regex. |
Advert | |
|
02-02-2015, 09:33 PM | #3 |
Well trained by Cats
Posts: 29,817
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
02-02-2015, 09:54 PM | #4 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Excellent point... so you could import using
Code:
(?P<comments>.*) Search mode: Regular Expression Search field: comments Search for: Code:
\[Novel\] ([^)(]+)\((.+)\) (\d+) (.*) for: title: \1 -- #alt_title: \2 -- series: \1 -- series_index: \3 #status: \4 Replace with: \1 Destination field: title --------------------------- Replace with: \2 Destination field: #alt_title --------------------------- Replace with: \1 Destination field: series --------------------------- Replace with: \3 Destination field: series_index --------------------------- Replace with: \4 Destination field: #status Wheeeee! But ugly as heck and takes quite a few steps. Definitely faster than hand-editing. @xd1986k, you got that? |
02-02-2015, 10:06 PM | #5 | |
Wizard
Posts: 2,082
Karma: 8796704
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
|
Calibre-Preferences- adding books-configure metadata from file name
Code:
(?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ? Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?(\[?(?P<series>[^0-9\-]+) (- )?(?P<series_index>[0-9.]+)\]?\s*-\s*)?(?P<title>[a-zA-Z1-9 ]+).+ Quote:
bernie |
|
Advert | |
|
02-02-2015, 10:13 PM | #6 | |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
|
|
02-02-2015, 10:26 PM | #7 | |
Wizard
Posts: 2,082
Karma: 8796704
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
|
He is importing ebooks, he can play with the regex to get it to his needs.
That will fill the metadata fields from the file name. Quote:
|
|
02-02-2015, 10:33 PM | #8 | |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Alternatively, say:
Quote:
|
|
02-03-2015, 05:37 AM | #9 | |
Member
Posts: 10
Karma: 10
Join Date: Dec 2014
Device: Kindle Fire HDX 7, Ipad
|
Quote:
|
|
02-03-2015, 10:42 AM | #10 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
|
Tags |
importing books, regular expressions |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regex: File Renaming Pre-Import & Importing | penguinaka | Library Management | 20 | 08-14-2012 06:11 PM |
Need a regex for importing books | flinkdeldinky | Calibre | 31 | 10-29-2011 08:31 AM |
Regex assistance request - importing books. | Belfaborac | Library Management | 2 | 10-24-2011 08:03 AM |
Importing RegEx Line | TheEldest | Calibre | 1 | 07-05-2011 10:18 PM |
regex Issue when Importing | river | Calibre | 3 | 06-16-2009 11:03 AM |