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 08-12-2012, 12:21 PM   #1
fidvo
Addict
fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.
 
Posts: 296
Karma: 1599870
Join Date: Jun 2012
Device: none
Need help on a Save to Disk template

I'm trying to come up with a Save-To-Disk template to allow me to export my books. I've figured out some of what I need to do, but I'm stuck on the final piece. Specifically, I need to remove the extra underscores that get generated from the template when a book has no subseries and/or series.

I have the following custom columns:

Division (Major classification for sorting libraries)
Genre (Fiction, Reference, Science Fiction, etc)
AuthorLookup (For dealing with multiple authors, etc)
Subseries (A series-like field used when there's more than 1 level to the series information. If a book has a subseries, it will always have a series as well)

Currently, my template looks like this:

Code:
{#division}/{#genre}/{#authorlookup}/{series}/{series_index:0>3s}_{#subseries}{#subseries_index:0>3s}_{title}
In plain English, I always want the Division, Genre, and AuthorLookup as nested folders. Inside the AuthorLookup, I want just the book title if there's no series. If there's a series, I want another subfolder for the series, with each book in the series starting with its index (padded to 3 chars) followed by an underscore. After that, if there's a subseries I want the subseries name and index (padded to 3 chars) followed by another underscore. Finally, I want the book title.

Some examples of what I want:

Code:
Other/Fiction/Smith_John/Just Some Book.epub
Other/Fiction/Smith_John/Some Books/001_A Book.epub
Other/Fiction/Smith_John/Some Books/002_Another Book.epub
Other/Fiction/Smith_John/Lots of Books/001_FirstSet001_This Is a Book.epub
Other/Fiction/Smith_John/Lots of Books/002_FirstSet002_This Is Also a Book.epub
Other/Fiction/Smith_John/Lots of Books/003_SecondSet001_First Book of the Second Set.epub
Other/Fiction/Smith_John/Lots of Books/004_SecondSet002_Second Book of the Second Set.epub
If I just use the template above, I get:

Code:
Other/Fiction/Smith_John/__Just Some Book.epub
Other/Fiction/Smith_John/Some Books/001__A Book.epub
Other/Fiction/Smith_John/Some Books/002__Another Book.epub
Other/Fiction/Smith_John/Lots of Books/001_FirstSet001_This Is a Book.epub
Other/Fiction/Smith_John/Lots of Books/002_FirstSet002_This Is Also a Book.epub
Other/Fiction/Smith_John/Lots of Books/003_SecondSet001_First Book of the Second Set.epub
Other/Fiction/Smith_John/Lots of Books/004_SecondSet002_Second Book of the Second Set.epub
As you can see, in cases where there's no series, I get 2 underscores in front of the book title (I think one of these is converted from an empty folder name).
In cases where there's a series but no subseries, I get 2 underscores instead of 1 between the series index and the book title.

I've figured out prefixes and suffixes, and they help some, but I can't use them with padded indices (I get an error when trying to Apply). So how do I strip out the extra underscores when there's no subseries (or series)?
fidvo is offline   Reply With Quote
Old 08-12-2012, 12:48 PM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
{#division}/{#genre}/{#authorlookup}/{series:||/}{series_index:0>3s||_}{#subseries}{#subseries_ind ex:0>3s||_}{title}
chaley is offline   Reply With Quote
Advert
Old 08-12-2012, 03:34 PM   #3
fidvo
Addict
fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.
 
Posts: 296
Karma: 1599870
Join Date: Jun 2012
Device: none
Thanks, chaley! I can what see I was doing wrong. I was trying to put another colon between the 0>3s and the ||_.

The only thing I had to tweak from your template was taking out the space in the middle of the word "index" in #subseries_index (probably an artifact of posting it on the forum).

Now it's perfect! Thanks again.
fidvo is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Save to disk template help plz. Crusher Conversion 12 03-15-2012 03:14 PM
Saving to Disk Template hurricane51 Conversion 2 07-07-2011 01:22 AM
A little help with a save template...? Belfaborac Library Management 2 02-04-2011 09:47 PM
save file template for series bucsie Calibre 2 11-08-2010 02:07 AM
save to disk template speakingtohe Calibre 9 05-29-2010 06:02 AM


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


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