03-07-2015, 09:55 PM | #1 |
Zealot
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
|
Template for sending to device
Well i am loving more and more C-Companion as it is much easier to manage a huge ebook collection in conjunction with a tablet.
I like to get a folder structure when sending books from calibre to my tablet for better file browsing: For now i have following template: {series:'ifempty($, field('authors'))'}/{series_index:0>4s| | - }{title} - {authors} This results in: When book has a "series, series index, author and title: "series/series index(for digits) - title - author if no series simply "author/title - author" Now for easier browsing I would love to have, in case i have a series, for example the letteres "SR - "at the beginning of a Serie folder. "SR - {series}/series index - etc Any idea how to do that? Last edited by Thomas_AR; 03-07-2015 at 10:48 PM. |
03-08-2015, 01:11 AM | #2 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Begin with the template fragment:
Code:
{series:'test($, strcat("SR - ", field("series")), field("authors")))'} |
Advert | |
|
03-08-2015, 10:47 AM | #3 | |
Zealot
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
|
Quote:
at the plugboard. I am no quiet sure for what to use it For now i do this templates in the Device configuration. |
|
03-08-2015, 10:51 AM | #4 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Device configuration controls filenames, plugboards allow dynamically updating metadata fields.
One common use is to insert series into the title, so devices, which generally don't support series, show the title as e.g. "title (series, Book #)" |
03-08-2015, 11:14 AM | #5 | |
Zealot
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
|
Quote:
Ah just one question: I see that i can insert the(my) template in "Configure this device" and in "Preferences - Send book to devices". What is the difference? Last edited by Thomas_AR; 03-08-2015 at 11:18 AM. |
|
Advert | |
|
03-08-2015, 12:20 PM | #6 |
Well trained by Cats
Posts: 29,944
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Preferences becomes the default for NEW devices. Once a device has been used, you need to change at the device level
|
03-08-2015, 12:33 PM | #7 |
Zealot
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
|
Thanks for all your kind help.
So, i think i nearly have it - nice clear folder structure. {series:'test($, strcat("_", field('series'), " - ",field('authors')), field('authors'))'}/{series_index:0>4s| | - }{title} - {authors} But there is one problem in case of series: If there is only one author everything regarding file structure is perfect, but if i have various authors (i have series with about 10 different authors) i get different folders for the series and the different authors. series - author 1 series - author 2 etc. Is there a possibility in case there are various authors for one series to make one folder like: "Series - Various" or something similar? But this is not so important, i can live without the authors string in the series folder name. Thanks again for your patience. Last edited by Thomas_AR; 03-08-2015 at 12:50 PM. |
03-08-2015, 12:50 PM | #8 |
Grand Sorcerer
Posts: 11,773
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
As you are sending files to CC and wanting to use a rather complex folder structure for use with file managers, you should know about the path length restrictions. The wireless driver in calibre enforces a maximum file length of approximately 200 characters for a book file on your device. The limit comes from an attempt to ensure that a Windows machine can use MTP to see the files. If your template generates a name longer than allowed then each component of the name (the parts between / characters) will be truncated by removing characters out of the middle of the component until the path fits. If you have books with multiple authors and long titles, it is virtually guaranteed that the path on the device will not be what you expect.
You can ensure that the path names follow your rules within the limit by using a template that ensures that the components fit within acceptable lengths while being truncated using your rules. See the "shorten" template function. BTW: eschwartz;s example has an extra parenthesis at the end. It should be Code:
{series:'test($, strcat("SR - ", field("series")), field("authors"))'} |
03-08-2015, 01:04 PM | #9 |
Zealot
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
|
Hello chaley,
thanks and yes i am aware of the 200 character limitation. Regarding the "extra parenthesis": I had to eliminate one of the three at the endto get his example to work, i got a syntax error with all 3 of them. Or do i miss something? Last edited by Thomas_AR; 03-08-2015 at 01:10 PM. |
03-08-2015, 01:09 PM | #10 | |
Grand Sorcerer
Posts: 11,773
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
{series:'test($, strcat("_", field('series'), " - ", cmp(count(field("authors"), '&'), 2, field('authors'), 'various', 'various')), field('authors'))'}/{series_index:0>4s| | - }{title} - {authors} Code:
program: s = field('series'); si=field('series_index'); a = field('authors'); t = field('title'); short_author=cmp(count(a, '&'), 1, a, a, 'various'); strcat( test(s, strcat("_", s, " - ", short_author), a), '/', finish_formatting(si, '0>4s', '', ' - '), t, ' - ', a) Last edited by chaley; 03-08-2015 at 01:12 PM. |
|
03-08-2015, 01:12 PM | #11 | |
Grand Sorcerer
Posts: 11,773
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
03-08-2015, 01:14 PM | #12 |
Zealot
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
|
Thanks, i think with this i am happy.
Uh, something new again "template in GPM". Will see how to do this and where P.S. Tried: Code:
{series:'test($, strcat("_", field('series'), " - ", cmp(count(field("authors"), '&'), 2, field('authors'), 'various', 'various')), field('authors'))'}/{series_index:0>4s| | - }{title} - {authors} I think i leave it without the author in the serious folder Last edited by Thomas_AR; 03-08-2015 at 01:40 PM. |
03-08-2015, 01:15 PM | #13 |
Zealot
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
|
|
03-08-2015, 01:24 PM | #14 | |
Grand Sorcerer
Posts: 11,773
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You can use a GPM template anywhere you can use a normal template. For example, you could paste the template I provided into the box where you put the Template Program Mode template you are using now. There is a template test & development editor available via the "Template Tester" on the calibre books spreadsheet. I put the template tester onto the context menu (the right-click menu) so it is easily accessible for a given book. |
|
03-08-2015, 01:33 PM | #15 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I would (and do) use a sublist to restrict "authors" to the first author, e.g. {authors:sublist(0,1,&)} -- or in GPM,
Code:
short_author = sublist( field('authors'), '0', '1', '&' ); Last edited by eschwartz; 03-08-2015 at 01:40 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Send to device - Template help | Snow Sciles | Library Management | 12 | 05-26-2014 05:16 PM |
Generic "Sending to Device" template not kicking in on Folder Device | At_Libitum | Library Management | 2 | 11-01-2013 07:12 AM |
Save to Device template | HFC3 | Library Management | 6 | 07-08-2013 11:48 AM |
Save template for sending books to Kindle 3 | Eaglebeak60 | Devices | 2 | 02-14-2011 06:12 PM |
Send to device template | rockeh | Calibre | 6 | 08-17-2010 05:28 PM |