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 06-15-2013, 01:20 PM   #1
macnab69
Zealot
macnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toys
 
Posts: 129
Karma: 5754
Join Date: Jan 2012
Location: South Africa
Device: Kindle 4
Help: regex for add books

If I use this format for filename:
author - [series] [series_index] title
I can use this regex:
(?P<author>.+) - \[(?P<series>.+)\] \[(?P<series_index>.+)\] (?P<title>[^_]+)

I would prefer:
author - [series series_index] title

but I don't know how to stop
(?P<series>.+)
when it gets to numbers, and then include the numbers in series_index

EDIT: Never mind. What if the series name is Oceans 11? Will have to stick to current format.

What I need is the equivalent to
{authors} - [{series} {series_index}] {title}
which is used in Save to disk.

Last edited by macnab69; 06-15-2013 at 01:35 PM. Reason: Founf answer
macnab69 is offline   Reply With Quote
Old 06-16-2013, 12:20 AM   #2
gabby98
Wizard
gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.
 
gabby98's Avatar
 
Posts: 1,751
Karma: 2667650
Join Date: Jul 2012
Device: Android, Nook Simple Touch, Nook Color, ..., Glo
Quote:
Originally Posted by macnab69 View Post
.....
What I need is the equivalent to
{authors} - [{series} {series_index}] {title}
which is used in Save to disk.


only problem here is if you do not have a series/series index then you will have empty brackets in your book title when you save to disk. I have something similar but I use a custom column {#myseries} that only fills with the desired text if there is a series (it could even be a hidden column) then I use it in my save to disk and it only appears if needed. You could probably do the same with yours, something like

Code:
{authors} - {#myseriesL}{series} {series_index}{#myseriesR} {title}
then if there is a series, it will have the brackets, but if there isn't one, the brackets won't appear.

I used 'Column built from other columns' with the following template to create my {#myseries} column:

Code:
{series:test(~,)}
I use a ~ in front of my Series names in my folders
gabby98 is offline   Reply With Quote
Advert
Old 06-16-2013, 12:59 AM   #3
macnab69
Zealot
macnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toys
 
Posts: 129
Karma: 5754
Join Date: Jan 2012
Location: South Africa
Device: Kindle 4
You inspired me to get rid of the empty brackets, so:

If there is no series I want this
author - title
If there is a series I want this:
author - [series series_index] title
with a leading 0 if the series_index is less than 10.

So I use this for the save to disk template
{authors} - {series:| [| } {series_index:0>2s| |]} {title}

Works perfectly for both cases.
macnab69 is offline   Reply With Quote
Old 06-16-2013, 01:42 AM   #4
gabby98
Wizard
gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.gabby98 ought to be getting tired of karma fortunes by now.
 
gabby98's Avatar
 
Posts: 1,751
Karma: 2667650
Join Date: Jul 2012
Device: Android, Nook Simple Touch, Nook Color, ..., Glo
{series:| [| } , huh

I was looking for a regex way for you to do what you wanted, but looks like you found

Cool
gabby98 is offline   Reply With Quote
Old 06-16-2013, 01:53 AM   #5
macnab69
Zealot
macnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toysmacnab69 shares his or her toys
 
Posts: 129
Karma: 5754
Join Date: Jan 2012
Location: South Africa
Device: Kindle 4
Looked up template in the calibre manual. It discusses exactly what I was looking for.
macnab69 is offline   Reply With Quote
Advert
Reply

Tags
add books, regex


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Name for series index in regex for add books macnab69 Library Management 0 06-15-2013 12:53 PM
My RegEx works in Test but not for Add Books kanigetts Library Management 11 09-18-2012 02:59 AM
Want RegEx to add books to Calibre huon Library Management 0 02-02-2012 12:52 AM
Add Books - Regex Help Please nynaevelan Calibre 2 08-16-2011 01:30 PM
understandng the sample add books regex cybmole Library Management 11 03-02-2011 06:08 AM


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


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