08-13-2017, 03:05 AM | #1 |
Banned
Posts: 22
Karma: 10
Join Date: Jun 2010
Device: Android/Linux/Windows
|
Adding metadata via filename
Hi,
I have three-part filenames: Booknumber---title---author. Using the Test feature on the Adding Books window, I can successfully parse the filenames into Series (or Comments), Title, and Author using this: (?P<series>.+)---(?P<title>.+)---(?P<author>[^_]+) However, when actually importing, only the Title and Author are added to the record. The import refuses to add the booknumber in the series or comment columns. I actually wanted to get the booknumber into a custom columm, but tried existing columns to see if I was even doing it right. I'd sure appreciate a little advice. Thanks in advance! |
08-13-2017, 05:06 AM | #2 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
A series include a series name (series) and a series number (series_index). There are two possible solutions:
1. Add a series name and series index (?P<series>[^_0-9-]*)(?P<series_index>[0-9]*) or 2. Instead of using series create a custom field for a book number |
08-15-2017, 09:57 AM | #3 | |
Banned
Posts: 22
Karma: 10
Join Date: Jun 2010
Device: Android/Linux/Windows
|
While that works, it wasn't my goal. My books have numbers, but no specific format. I was using Adding window as a test bed to figure out how the regex works.
I did add a custom column, but I can't get data into it from the import process. If I haven't mis-read some other posts, I can take data from one column and stuff it into my custom column, which was why I was trying to get the data into series to comments. Quote:
|
|
08-15-2017, 12:01 PM | #4 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Use the template
Code:
(?P<series_index>.+)(?P<series>---)(?P<title>.+)---(?P<author>.*) Next:
EDIT: Oh, and make sure that "Read metadata from file contents rather than file name" in the "Adding books" preference screen is not checked. Otherwise your template will be ignored. Last edited by chaley; 08-15-2017 at 12:05 PM. |
08-15-2017, 08:02 PM | #5 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
@flink, you do not mis-read. I made a mistake because I thought that custom columns are allowed and this limitation was gone some when in the past.
Please follow chaley's workflow. This is the way for solving your problem. I like to add one point. Save the two S&R so that you can use this if you need to this more than one time. @Chales, thanks for helping. |
08-16-2017, 07:28 AM | #6 | |
Banned
Posts: 22
Karma: 10
Join Date: Jun 2010
Device: Android/Linux/Windows
|
Hi,
I didn't have any success getting series to accept the book numbers. They are not in a distinct format. They are a mixed bag: numeric, all alpha, are alpha-num, num-alpha, and some are a mixed alphanumeric. I couldn't get comments to accept them, either. I figured that would be a good choice, as it's free-form. If I can get series to take the numbers and shift them where I need them I'm all set. But I can't figure it out since the test on "Adding Books" lies Quote:
|
|
08-16-2017, 08:30 AM | #7 | |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Here is my Add Books preferences setup, Here is the file I am adding: After dragging that file onto calibre, the book list shows: And Edit Metadata shows that the comment is correctly filled in. |
|
08-17-2017, 10:13 AM | #8 |
Banned
Posts: 22
Karma: 10
Join Date: Jun 2010
Device: Android/Linux/Windows
|
Hi Charlie,
I had Adding Books accepting the number in either field, but couldn't get the import to accept it as metadata. I'm on 3.6. I think I'll uninstall 3.6 and re-install it. I've just been installing on top of past versions. Thanks for showing me it really is working the way I thought it would. I wish I knew where I was going wrong. It all seems so simple.... |
08-18-2017, 05:17 AM | #9 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
Helping is difficult without seeing real data. Make some screenshots from your template, filenames and post it here.
Only guessing. A typo? Maybe there is something different to what you or the template expect to find. Or special characters in some filenames where the import template maybe have a problem with. Check your filenames. You can import the combination book number and title as title first and split out the book number afterwards in a additional s&r step. There are several way's to deal with and find out what is going on. |
08-18-2017, 08:08 AM | #10 |
Banned
Posts: 22
Karma: 10
Join Date: Jun 2010
Device: Android/Linux/Windows
|
Hi DivingDuck,
I'd considered a typo. I tested several titles using the Adding Book window and all are parsed as expected. I just haven't been able to get it to work during an actual import. I'm going to make sure I'm following Charlie's process after I re-install. If that doesn't work, I'll try one where I use the whole filename for the title and then do the parsing using S&R. Thanks. |
08-19-2017, 04:18 PM | #11 |
Junior Member
Posts: 8
Karma: 10
Join Date: May 2010
Location: Northern Virginia
Device: Android (FBReader Premium), Ubuntu/Windows laptops (Calibre)
|
I have a similar but more complicated problem. There is useful but not essential metadata in the filename, and essential metadata in the epub itself. I would prefer to get both, but if I can't I'd like to strip the filename down to just the title anyway. The title is "pubdate title (rated: ?).epub", and the epub actually contains the author name. Any suggestions?
|
08-19-2017, 04:30 PM | #12 | |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help needed- RegExp for filename to metadata when adding books | jecilop | Library Management | 4 | 06-07-2016 06:46 PM |
Adding tags from filename | mrbongal007 | Library Management | 1 | 03-02-2015 12:54 AM |
Save the Metadata to the Libary files/change filename to the Metadata | RyuujiTakasu | Calibre | 10 | 03-19-2014 02:01 PM |
Regular Expression - Adding metadata from filename | LMF | Calibre | 1 | 03-20-2012 06:46 PM |
Adding books with series in the filename | genright | Library Management | 5 | 06-13-2011 03:20 PM |