08-12-2012, 12:21 PM | #1 |
Addict
Posts: 301
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} 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 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 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)? |
08-12-2012, 12:48 PM | #2 |
Grand Sorcerer
Posts: 11,962
Karma: 7225107
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}
|
Advert | |
|
08-12-2012, 03:34 PM | #3 |
Addict
Posts: 301
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. |
|
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 |