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 08-13-2017, 03:05 AM   #1
flink
Banned
flink began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2010
Device: Android/Linux/Windows
Question 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!
flink is offline   Reply With Quote
Old 08-13-2017, 05:06 AM   #2
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
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
Divingduck is offline   Reply With Quote
Old 08-15-2017, 09:57 AM   #3
flink
Banned
flink began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2010
Device: Android/Linux/Windows
Unhappy

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:
Originally Posted by Divingduck View Post
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
flink is offline   Reply With Quote
Old 08-15-2017, 12:01 PM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
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>.*)
You end up with series as ---, series_index as the book number, etc.

Next:
  1. Select all books with series ---.
  2. Use bulk metadata edit / search/replace to copy series_index into your custom column.
  3. Press OK to run the S/R. Bulk edit will close, leaving the books selected.
  4. Open bulk edit again.
  5. On the Basic metadata panel, check the "Clear series" box.
  6. Press OK
Don't do both operations with the same "OK" because (I think) the series will be cleared first making the series_index disappear before it is copied.

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.
chaley is offline   Reply With Quote
Old 08-15-2017, 08:02 PM   #5
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
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.
Divingduck is offline   Reply With Quote
Old 08-16-2017, 07:28 AM   #6
flink
Banned
flink began at the beginning.
 
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:
Originally Posted by Divingduck View Post
@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.
flink is offline   Reply With Quote
Old 08-16-2017, 08:30 AM   #7
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by flink View Post
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
It works fine for me.

Here is my Add Books preferences setup,
Click image for larger version

Name:	Clipboard01.jpg
Views:	348
Size:	180.3 KB
ID:	158488

Here is the file I am adding:
Click image for larger version

Name:	Clipboard02.jpg
Views:	199
Size:	17.4 KB
ID:	158489

After dragging that file onto calibre, the book list shows:
Click image for larger version

Name:	Clipboard03.jpg
Views:	223
Size:	13.1 KB
ID:	158490

And Edit Metadata shows that the comment is correctly filled in.
Click image for larger version

Name:	Clipboard04.jpg
Views:	280
Size:	92.6 KB
ID:	158491
chaley is offline   Reply With Quote
Old 08-17-2017, 10:13 AM   #8
flink
Banned
flink began at the beginning.
 
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....
flink is offline   Reply With Quote
Old 08-18-2017, 05:17 AM   #9
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
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.
Divingduck is offline   Reply With Quote
Old 08-18-2017, 08:08 AM   #10
flink
Banned
flink began at the beginning.
 
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.
flink is offline   Reply With Quote
Old 08-19-2017, 04:18 PM   #11
jktrigg
Junior Member
jktrigg began at the beginning.
 
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?
jktrigg is offline   Reply With Quote
Old 08-19-2017, 04:30 PM   #12
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by jktrigg View Post
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?
See the GetFileName plugin. It stores the file name into a custom column. You import the books using internal metadata. Later you slice and dice that filename in the custom column however you want, either by hand or using bulk metadata search/replace.
chaley is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 04:55 PM.


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