Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 02-13-2014, 07:38 PM   #1
myusernameis
Junior Member
myusernameis began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2014
Device: iPad
Need help with regex for adding ebooks

Hello I am trying to add metadata based on a pdfs title but I can't figure it out. My pdf titles are in the following format:

<title> (<author>, <publisher>, <published>).ext

I have tried using a few regex I have found on here but they don't work for me. When I click Test usually I just get a title. Most of the posts I looked at had the data in a different format and simply swapping sections of the regex didn''t work (I assumed it wouldn't but tried anyway). I didm't have much luck following the tutorial on the Calibre website.

Does anyone have a regex for the format I have? Thanks in advance, any help is appreciated.
myusernameis is offline   Reply With Quote
Old 02-13-2014, 11:35 PM   #2
myusernameis
Junior Member
myusernameis began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2014
Device: iPad
OK, I have figured out a regex that does what I need except that it doesn't do the date right. I have the dates as just the 4 digit year in the file names but they get extracted as YEAR-02-15. So the 4 digit year is correct but it makes every document have a month/day of 02/15. How can I stop the day month from being added?

regex I am using:

^(?P<title>([^_\(]+)(\w+)) \((?P<author>[^\,]+)\, (?P<publisher>[^\,]+)\, (?P<published>[^\)]+)
myusernameis is offline   Reply With Quote
Advert
Old 02-14-2014, 07:01 AM   #3
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: 31,003
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 myusernameis View Post
OK, I have figured out a regex that does what I need except that it doesn't do the date right. I have the dates as just the 4 digit year in the file names but they get extracted as YEAR-02-15. So the 4 digit year is correct but it makes every document have a month/day of 02/15. How can I stop the day month from being added?

regex I am using:

^(?P<title>([^_\(]+)(\w+)) \((?P<author>[^\,]+)\, (?P<publisher>[^\,]+)\, (?P<published>[^\)]+)
A 'date' has YEAR AND MONTH AND DAY (at least internally).
It has to or 'date' arithmetic would not be possible.
Calibre assumes the missing data from the current date.
(when I encounter Published with a missing Month detail, I use '1'
I also us '1' for day because my preferred, faked in flag, last day, is not a fixed value

There is a: Preferences: Tweaks: to control the 'Display' of dates (by field) in the GUI. Note:the full date will still show in exported metadata
theducks is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding books - regex help tonyx3 Library Management 1 03-13-2013 08:21 AM
Adding non-Amazon purchased ebooks Staked Amazon Kindle 4 12-07-2011 02:59 AM
Adding audio to ebooks? What? JohnMorris News 15 09-10-2011 07:07 AM
Problem with adding eBooks since 0.7.35 Frenchwolfie Calibre 6 01-16-2011 12:05 PM
A little help adding books and using regex. Dragonator Calibre 7 12-17-2010 06:57 PM


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


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