![]() |
#1 |
Addict
![]() Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
|
![]()
I use 3 different "Save to Disk" setup templates for my various libraries because they each have specialized content that requires a unique save format. I have looked for a way to have each library maintain its own set of default templates but can't see a way to do it.
Presently I keep those templates in a plain text file, labeled so I know which goes to which. Then I use the drop down selection in a given library and select the correct one. If there isn't a way to do this currently, I would like to suggest that be considered as a future added feature. I switch libraries constantly and this would sure same me some extra 'lookup' efforts! Monty |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,957
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
It is doable (my coding skils are not quite up to this) in Program Mode
Take a look at http://manual.calibre-ebook.com/template_lang.html class calibre.utils.formatter_functions.BuiltinCurrentLi braryName[source] You should be able to use: current_library_name() – return the last name on the path to the current calibre library. This function can be called in template program mode using the template “{:’current_library_name()’}”. With a switch(val, pattern, value, pattern, value, ..., else_value) |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Addict
![]() Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
|
theducks,
Thanks...my eyes are glazing over a bit, as my coding skills are mostly non-existent. But, you gave me something that might work, so I will play with it and see what I can come up with! Monty |
![]() |
![]() |
![]() |
#4 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
The problem is that save-to-disk works like the device drivers, and is a global preference (it is stored in your config data, not in the library database).
As theducks said, current_library_name() is your friend -- but if you are unsure how to use it, feel free to ask and we can write a suitable template for you. ![]() Just tell us what you want to see. Note: There is a dedicated help sticky in this subforum with various tips and things that people have asked for in the past. |
![]() |
![]() |
![]() |
#5 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
The basic idea looks like this:
Code:
program: switch( current_library_name(), 'libraryname1', template1, 'libraryname2', template2, 'libraryname3', template3, fallback_template ) |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Addict
![]() Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
|
Thanks for this! I need to learn how to do this, at least in some minimal form. Let me see how far I get; I will probably be back with some noob type questions, LoL.
|
![]() |
![]() |
![]() |
#7 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,957
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
That will be new template (after you substitute the Library names and the corresponding templates)
![]() ![]() |
![]() |
![]() |
![]() |
#8 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 309
Karma: 1645952
Join Date: Jun 2012
Device: none
|
FWIW, here is my Save to Disk template:
Code:
program: switch(current_library_name(), 'Library - Main', template('{#path:re(\.,/)}/{series_index:0>3s||_}{#subseries}{#subseries_index:0>3s||_}{title}'), 'Library - Special', template('{#path:re(\.,/)}/{series_index:0>3s||_}{title}'), 'Library - In Progress', template('{author_sort}/{series}/{series_index:0>3s}_{title}'), template('{#path:re(\.,/)}/{#seriesid:re(\.,/)}{#titleid:re(\.,/)}')) |
![]() |
![]() |
![]() |
#9 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
![]() Code:
program: # Initialize repetitive and/or complicated values for later use. path = re( field('#path'), '\.', '/' ); seriesid = re( field('#seriesid'), '\.', '/' ); titleid = re( field('#titleid'), '\.', '/' ); sidx = finish_formatting( field('series_index'), '0>3s', '', '_' ); subsidx = finish_formatting( field('#subseries_index'), '0>3s', '', '_' ); # Compute final return value. switch( current_library_name(), 'Library - Main', strcat( path, '/', sidx, field('#subseries'), subsidx, field('title') ), 'Library - Special', strcat( path, '/', sidx, field('title') ), 'Library - In Progress', strcat( field('author_sort'), '/', field('series'), '/', sidx, field('title') ), strcat( path, '/', seriesid, titleid ) ) |
|
![]() |
![]() |
![]() |
#10 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 309
Karma: 1645952
Join Date: Jun 2012
Device: none
|
Quote:
I'll have to give this a try. ![]() |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Reimport same library in Calibre (without Save to Disk)? | rebl | Library Management | 9 | 06-11-2015 08:53 PM |
Multiple save to disk templates? | fidvo | Library Management | 5 | 03-10-2014 05:38 PM |
plugin for favorite save to disk templates | gabby98 | Plugins | 3 | 07-03-2013 01:35 PM |
How to remove unwanted Save-to-disk templates | alexmobile | Calibre | 5 | 02-22-2012 05:54 AM |
Confused.. Difference between a Calibre Library & Save to Disk | ipsofacto | Library Management | 5 | 01-05-2012 09:46 AM |