View Single Post
Old 05-25-2022, 05:47 AM   #406
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: 12,529
Karma: 8075938
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Vespero View Post
Is there a way to change the template based on the format of the book being sent?"

I send both .epub and .cbz to my device and prefer different naming schemes for them.

With .epub, I like
books/{author_sort}/{series}/{title}

But with .cbz, I want
books/{author_sort}/{series}/{title}
(being comics, each chapter/volume is already named {series}{series_index})

Currently, I either have to manually edit the template each time I switch formats (which also requires restarting Calibre and remounting the folder), or I have to switch how the device is mounted (Connect to Folder for .cbz and Wireless Connection for .epub)

There's got to be an easier way though, right?
The template doesn't know and can't see the format type (extension).

@ownedbycats solution works for books that have one or the other format. If a book has both and you choose the format when you send to device then it won't give you joy. However, if you let calibre choose by priority then you can build that same priority into the template.

I haven't looked at file name template processing for years. Now that we have template global variables I might be able to pass the format extension there. EDIT: No can do. The file path is generated before the extension is chosen.

Last edited by chaley; 05-25-2022 at 05:59 AM.
chaley is offline   Reply With Quote