01-14-2024, 06:28 AM | #1 |
Junior Member
Posts: 2
Karma: 10
Join Date: Jan 2024
Device: none
|
Add books <pubdate> help
Hello all you book nerds ! Please forgive me for not being super verbose on my examples or citing exactly everything I've tried, it's 3 a.m. here and I'm burned out. I promise I've read all the Calibre tutorials and scoured the internet first !
Desired result: Trying to populate Published (<pubdate>) with the year based on parsed title data, possibly also the month as well. I like to get it working 1st then get more complicated. Issue: I have a few magazine collections in standard .pdf format (flat not multi level pdf). The filename convention is as follows: Month Year.ext, as an actual example "January 1946.pdf" These magazines dont have any published date metadata so in preferences I've set calibre to read metadata from the filename. This gives me a title of January 1946. I've tried to parse the filenames with regex to parse/capture the year in yyyy format. I've tried all the permutations of \d, [0-9] I can think of. Even gone to some regex test site to try to test different expressions. I have at least 2 issues. 1. When using an expression and putting the destination feild <pubdate> in any expressions, NOTHING populates. From what I gather pubdate can act kind of unpredictably and so it's kind of a direct access denied for bulk adding situation. IS this the case ? If so is there any work around(s) (converting formats then using Search and Replace seems like a poor solution because converting the pdfs leaves visual artifacts and corrupted pages..I'd like to leave them in .pdf format). 2. Any attempt i've made to capture just the numerical portion of the title cuts off the 1st digit. I end up with 946 instead of 1946. Ive tried conventions like \d, [0-9]{n}, etc. For example: \d(?P<pubdate>.+), nothing populate and if it try <any other lookup besides numerical> it seems to truncate the 1st digit. I am surmising that in a non numerical column the "date" is being processed as a regular string and not as an integer, am I correct and is this part of the problem if so ? I realize my expression might be off, I'm still figuring out the syntax, but i've tried other examples you all have graciouly posted, from simple to crazy long nested expressions and I'm stumped. While I could do this by hand, i've so many mags to import that I'd rather not. This seems to be a rather common naming convention as far as periodicals go, so I home calibre 8 or a plugin can handle this. I've even peeked at templates, but templates aren't making sense yet. Thanks and sorry for the long read. |
01-14-2024, 07:31 AM | #2 |
Wizard
Posts: 1,091
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
First off, I like your user name. Guaranteed to get you some help around here.
What you want to do can be done using a combination of template language and search & replace. (see attached image) |
Advert | |
|
01-14-2024, 05:32 PM | #3 |
Junior Member
Posts: 2
Karma: 10
Join Date: Jan 2024
Device: none
|
Thanks for the help. Do I just copy the pic to get started ? I'll put this in and report back.
I picked my handle because Kovid seems like a database genius, this seems like crazy robot syntax to me ! |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ERROR: Cannot add books: Failed to add any books | MishoCana | Library Management | 3 | 02-16-2023 07:11 AM |
Troubleshooting Kindle 4 can't factory restore, can't remove books, can't add new books | my_kindleproblem | Amazon Kindle | 3 | 01-24-2022 09:33 AM |
Manually add previously read books to My Books? | mdx | Kobo Reader | 14 | 06-15-2020 01:42 PM |
Vanishing auto add books during import, books left behind in auto add folder | jataadroid | Library Management | 9 | 01-14-2018 11:43 PM |
Trying to add large library of books - add books seems to have hung | nicknefarious | Library Management | 1 | 06-18-2012 09:32 AM |