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 02-08-2021, 03:04 PM   #1
Widukind
Junior Member
Widukind began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jun 2011
Device: none
regex for importing books with comment

In Calibre I have a custom column 'comment'.
When I import a book like 'Lewis Carroll - Alice 01 - Wonderland # illustrated' the text after # should go to this column.

Until a year ago I used for this purpose the regex:
(?P<author>(??!\s-\s).)*)\s*-?\s*[0-9]*\s*(?P<series>(??![0-9]?[0-9-]\.?[0-9]*\s-\s).)*)?\s?(?P<series_index>[0-9]+.?[0-9]*)?\s?-?[0-9]*\s*-\s(?P<title>[^#]+)\s?(?P<comment>[#\s].*)?

But this doesn't work anymore: the text 'illustrated' is not added to the comment column but to the comments section in the Metadata screen.

How can I resolve this?
Widukind is offline   Reply With Quote
Old 02-08-2021, 09:21 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,349
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You cant add metadata to custom columns from filenames. Only builtin fields.
kovidgoyal is offline   Reply With Quote
Advert
Old 02-08-2021, 09:42 PM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Widukind View Post
In Calibre I have a custom column 'comment'.
When I import a book like 'Lewis Carroll - Alice 01 - Wonderland # illustrated' the text after # should go to this column.

Until a year ago I used for this purpose the regex:
(?P<author>(??!\s-\s).)*)\s*-?\s*[0-9]*\s*(?P<series>(??![0-9]?[0-9-]\.?[0-9]*\s-\s).)*)?\s?(?P<series_index>[0-9]+.?[0-9]*)?\s?-?[0-9]*\s*-\s(?P<title>[^#]+)\s?(?P<comment>[#\s].*)?

But this doesn't work anymore: the text 'illustrated' is not added to the comment column but to the comments section in the Metadata screen.

How can I resolve this?
As Kovid said, you cannot update custom columns. In your regex, the "?P<comment>" is the name of the built in comments column (). If this was going to work, you would probably need to use "#comment" to refer to your column.

You should be able to achieve what you want with the GetFileName plugin. It will add the file name to a separate custom column. You can then parse that to your custom columns.
davidfor is offline   Reply With Quote
Old 02-09-2021, 04:55 AM   #4
Widukind
Junior Member
Widukind began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jun 2011
Device: none
It worked allright until about a year ago but since then several updates have come around.
Thanks for your answers.
Widukind is offline   Reply With Quote
Old 02-09-2021, 06:35 PM   #5
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Also, for future reference: Wrapping your regex in [code] tags will make it not convert into smileys:

Code:
(?P<author>(?:(?!\s-\s).)*)\s*-?\s*[0-9]*\s*(?P<series>(?:(?![0-9]?[0-9-]\.?[0-9]*\s-\s).)*)?\s?(?P<series_index>[0-9]+.?[0-9]*)?\s?-?[0-9]*\s*-\s(?P<title>[^#]+)\s?(?P<comment>[#\s].*)?
ownedbycats is online now   Reply With Quote
Advert
Old 02-12-2021, 05:13 AM   #6
Widukind
Junior Member
Widukind began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jun 2011
Device: none
Smile

Thanks, Ownedbycats, I was wondering how that came about.
Widukind is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex not working for importing books kokkie20 Library Management 3 11-24-2020 06:14 AM
Regex in importing help. xd1986k Library Management 9 02-03-2015 10:42 AM
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
regex Issue when Importing river Calibre 3 06-16-2009 11:03 AM


All times are GMT -4. The time now is 01:34 PM.


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