View Single Post
Old 10-27-2023, 01:22 PM   #1
mike.katina
Enthusiast
mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.mike.katina ought to be getting tired of karma fortunes by now.
 
Posts: 35
Karma: 2135976
Join Date: Sep 2011
Location: Eastern Canada
Device: Samsung Galaxy Tab S2
Thumbs down Automated Regex file sorting using file name

Hello everyone, yes I don't post much as most questions are readily answered using simple searches. But I have been working on this for over a week with minimal success. I barely understand Regex as I'm old and such (yeah sad excuse).
What I need to do is to find a string that will properly enter the data in the proper columns from file name.

my Fav. file naming theme layout is:

my name [series 001] title.pdf
my name [series 002] title.pdf
my name [series 003] title.pdf
my name [series 001] title.pdf

I was looking at something like this but am unable to make it work under "saving books to disk":
Code:
{authors} {series} {series_index>[0-9.]++} {title}
same as sending books to device:
Code:
{authors} {series} {series_index>[0-9.]++} {title}
There is also the holy grail that I found as well for Setting a Custom Regular Expression for Adding Books to Calibre:
within there is this monster regex string...
Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?(\[?(?P<series>[^0-9\-]+) (- )?(?P<series_index>[0-9.]+)\]?\s*-\s*)?(?P<title>.+)
I don't understand it but it does seem to work most of the time. Would it be possible to edit it so it also works for my situation

also would be really nice when I save to disk (S), calibre already saves to the last location which is the desired effect but would be even smoother for me if calibre would embed metadata for the selected files at the same time, save only the main format without the cover page and .opf file, all into a single folder with the files named as per above preference:
{authors} [{[series]} {series_index>[0-9.]++} {title}.pdf

oh yes, on another note, for the numerical pad, I like to have 3 digits...
example:

Dr Doolittle [Pegasus 001] feeding time.pdf
Dr Doolittle [Pegasus 002] feeding time.pdf
Dr Doolittle [Pegasus 003] feeding time.pdf
Dr Doolittle [Dallas 001] feeding time.pdf
Dr Doolittle [Dallas 001] feeding time.pdf
Dr Doolittle [Princess Leah 001] feeding time.pdf
mike.katina is offline   Reply With Quote