View Single Post
Old 12-25-2015, 09:09 AM   #1
yonkyunior
Cultivator
yonkyunior doesn't litteryonkyunior doesn't litteryonkyunior doesn't litter
 
yonkyunior's Avatar
 
Posts: 94
Karma: 216
Join Date: Feb 2015
Device: PRST2
Thumbs down Pre-Import ebook with Filenames to custom column?

I use using filename import without read the metadata with calibre to speed up the process of adding new ebook.

I have very little knowledge about REGEX,
and i have to learn it a bit to use calibre, just the basic one, like
for example
i understand title that have () or [] will be stripped with this regex:
Code:
(?P<title>[^\]{[()]+\w)
or using ? for optional regex
but for using to build my own patttern in calibre i dont get it right,
so i just grab other people regex pre-importing pattern and modified that.

for example:
before i use the regex
it doesnt work fine when i tested with, with little modification it works.
Code:
(?P<title>[a-zA-Z1-9 ]+)(\(.*\))?$
i dont know why, i dont understand much more

The Regex i used i got from this site,
i have to test it before i used it, so this one i used.


FOR:
Catherine Asaro - Primary Inversion (v5.0) (epub).epub
Catherine Asaro - [Skolian Empire 01] - Primary Inversion (v5.0) (epub).epub
Catherine Asaro - Skolian Empire 01 - Primary Inversion (v5.0) (epub).epub

REGEX :
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>[^\]{[()]+\w)
The Problem is if there is striplines in series in will broke,
like this..

Catherine Asaro - [Skolian Empire 10 - Triad 01] - Schism (v5.0) (epub).epub

so i make one again with quick preference plugins, that points out the series to grab anything.

Before (?P<series>[^0-9\-]+)
After (?P<series>.+)

Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?(\[?(?P<series>.+) (- )?(?P<series_index>[0-9.]+)\]?\s*-\s*)?(?P<title>[^\]{[()]+\w)
It just works, but sometimes when i got 10 or more it will fail for some but others just success,
the most intriguing is when i added back the the failure, it just works, but it doesnt work together, i dont understand this..



For the main question..

but i think i want the Skolian Empire 10 will grabbed as series
and Triad 01 to #superseries (series-custom-column)

or anything like author - title
but i want it to import or add it to custom column?
how to do that?
yonkyunior is offline   Reply With Quote