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-29-2015, 12:27 AM   #1
garberw
Junior Member
garberw began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2015
Device: none
calibre regexp for adding books

adding books to calibre, trying to get regexp for recognizing metadata
for books in this format:

\[(?P<title>[^\]]+)\](?P<author>[^(]+)\(ZAP\.org\)\.pdf

[Betty Crocker]Cooking is Fun(ZAP.org).pdf

that regexp doesn't work.
I think it's something about the first [^\]]
If there is a bug, how do we contact the calibre author?
garberw is offline   Reply With Quote
Old 08-29-2015, 12:56 AM   #2
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,367
Karma: 78877538
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Try
Code:
\[(?P<title>.+)\](?P<author>.+)\(
or even

Code:
\[(?P<title>.+)\](?P<author>.+)\((?P<publisher>.*)\)
PeterT is offline   Reply With Quote
Advert
Old 08-29-2015, 01:01 AM   #3
garberw
Junior Member
garberw began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2015
Device: none
That doesn't work because the first part of the regexp matches the whole string.
garberw is offline   Reply With Quote
Old 08-29-2015, 09:31 AM   #4
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,367
Karma: 78877538
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
I hate to say but I tested those out in the test interface and they worked like a charm.
PeterT is offline   Reply With Quote
Old 08-29-2015, 01:19 PM   #5
garberw
Junior Member
garberw began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2015
Device: none
don't understand

\[(?P<author>.+)\](?P<title>.+)\(ZAP\.org\)\.pdf
does not work but
\[(?P<author>.+)\](?P<title>.+)\(
does work.
I do not understand.
Both should match
[cooking]mytitle(ZAP.org).pdf
The second one does work I just tested it.
Also, why doesn't the first ".+" just match the whole expression following it
until the end of the line?
garberw is offline   Reply With Quote
Advert
Old 08-29-2015, 01:47 PM   #6
garberw
Junior Member
garberw began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2015
Device: none
fails on the second period

\[(?P<author>.+)\](?P<title>.+)\(ZAP\.org\)\.
fails

\[(?P<author>.+)\](?P<title>.+)\(ZAP\.org\)
passes

with filename
[cooking]mytitle(ZAP.org).pdf

it fails on the second period for some reason.
garberw is offline   Reply With Quote
Old 08-29-2015, 02:50 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
the \.PDF is wrong
you do not include the extension part of a file name

OTOH Name\(pdf\) would be included If you wanted that as part of the Title
theducks is offline   Reply With Quote
Old 08-29-2015, 02:50 PM   #8
garberw
Junior Member
garberw began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2015
Device: none
fails on the second period

still, this does the job, and it has the added bonus
that it can match either .pdf .djvu or .epub formats
garberw is offline   Reply With Quote
Old 08-29-2015, 02:54 PM   #9
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by garberw View Post
still, this does the job, and it has the added bonus
that it can match either .pdf .djvu or .epub formats
Calibre (default setting) will only add known book (related) types
by default
.MP3 would not be added
.(blank) ignored
theducks is offline   Reply With Quote
Old 08-29-2015, 07:36 PM   #10
garberw
Junior Member
garberw began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2015
Device: none
what I was looking for

\[(?P<author>.*?)\](?P<title>.*?)\(ZAP\.org\)

This works and is what I was originally looking for.
You guys explained it.
All the other solutions worked fine when you remove
the ".pdf" from the end of the regexp, since it is matched
automatically.
Also, I did not understand that regexp match the longest
string possible (by greedy default) but
*cat
still matches
acat
the * does not match the whole string, it backtracks.
Could I please request that they put something more in
the documentation about the automatic matching of extensions
such as .pdf (or is this my fault for not RTFM?)
garberw is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regexp for adding books failing nvcleemp Library Management 10 08-29-2015 02:23 AM
Regexp help for saving books Phssthpok Library Management 3 06-24-2015 11:31 AM
Calibre & Covers: Adding books through Calibre vs dragging and dropping? VirgoGirl Calibre 12 06-08-2014 05:34 AM
Adding books to Calibre... jrickert Library Management 1 02-15-2013 02:41 AM
Adding Books to Calibre Canadian reader Calibre 0 11-20-2010 06:31 PM


All times are GMT -4. The time now is 07:00 AM.


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