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 05-29-2014, 01:58 PM   #1
myki
Zealot
myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.
 
Posts: 126
Karma: 20236
Join Date: May 2014
Device: Kinde PW v1, Kobo H2O, Onyx Boox T68
Fill fields with filenames

Greetings...

I am trying to fill <series> and <series_index> automatically from filenames.
So i am trying to build a regular expression.

Files are allways named like that :
NAME First-Name - Title-of the book.mobi
or
[Name-of the serie-1.5]Title-of the book.mobi

Sometimes i can find a space after the "]".
Sometimes, 1.5 is written 1,5 and it would be perfect if the code can deal with that

For now, my code looks like that :
Code:
\[(?P<series>.+)\-(?P<series_index>[0-9]+((\.|,|)[0-9]?))?\](?P<title>.+)
It works perfectly for the case [serie-1]title.mobi, but not for author - tile.mobi case.
and if the number is "1,5", it is just ignored.

Can you help me, please ??

Thank you in advance
myki is offline   Reply With Quote
Old 05-30-2014, 05:33 AM   #2
myki
Zealot
myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.
 
Posts: 126
Karma: 20236
Join Date: May 2014
Device: Kinde PW v1, Kobo H2O, Onyx Boox T68
I found it myself.

Code:
(\[(?P<series>.*)\-(?P<series_index>.*)\]\s*)?((?P<author>.*) -)?\s*(?P<title>.*) ?
It works for :
author - title.mobi
[Serie-1.5]title.mobi
[Serie-1.5]author - title.mobi

But the title is allways replaced by the one found in the metadata Grrrr.
If i don't use metada, i lose all the other tags.

For now, i want to use a custom column : custom_title

But if i use it in my regular expression (?P<custom_title>) nothing happens !

Any idea, please ??
myki is offline   Reply With Quote
Advert
Old 05-30-2014, 06:05 AM   #3
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,722
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@myki - Try #custom_title

Custom column names are normally (always ???) prefixed with a '#'

BR
BetterRed is offline   Reply With Quote
Old 05-30-2014, 09:49 AM   #4
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,048
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 BetterRed View Post
@myki - Try #custom_title

Custom column names are normally (always ???) prefixed with a '#'

BR
ALWAYS
theducks is offline   Reply With Quote
Old 05-30-2014, 02:37 PM   #5
myki
Zealot
myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.
 
Posts: 126
Karma: 20236
Join Date: May 2014
Device: Kinde PW v1, Kobo H2O, Onyx Boox T68
Thank you BetterRed and Theducks for your help.
i tried (?P<#custom_title>) and #custom_title, but as soon as i add a #, Calibre is not agree
I read old threads saying that it is impossible to fill custom fields from filename, is it still the case ??
myki is offline   Reply With Quote
Advert
Old 05-30-2014, 05:47 PM   #6
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,722
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by myki View Post
I read old threads saying that it is impossible to fill custom fields from filename, is it still the case ??
@myki - if it doesn't work then I suggest that the threads you read that said it was impossible are as true today as they were when they were posted.

BR
BetterRed is offline   Reply With Quote
Old 06-01-2014, 04:08 AM   #7
myki
Zealot
myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.myki can self-interpret dreams as they happen.
 
Posts: 126
Karma: 20236
Join Date: May 2014
Device: Kinde PW v1, Kobo H2O, Onyx Boox T68
You are right BetterRed, i gave up by this way.
I have automated it by using ebook-meta.exe in a "Direcory Opus" button, and then work on my titles usign regex in Calibre.

It would have been so simple if i could prevent Calibre to modify my titles found with filenames, with those found in books metadata (or i don't use them, but i lose covers and other metadatas).

Thanx for your help anyway
myki is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting Fields/Tags within Fields/ Tags? mattlauck Library Management 9 10-19-2013 10:46 AM
Did you fill your eink reader? jocampo General Discussions 49 05-28-2011 09:23 PM
How to get cover to fill screen? seagull Amazon Kindle 11 03-15-2011 12:05 PM
Filenames to metadata, preserving filenames. nitrogun Calibre 5 09-13-2010 10:50 PM
Could you help me to fill in the questionniare? GreX News 0 11-26-2008 08:37 PM


All times are GMT -4. The time now is 02:49 PM.


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