![]() |
#1 |
Member
![]() Posts: 15
Karma: 10
Join Date: Jan 2020
Device: iPhone/Voice Dream Reader
|
Save Template, is appending one tag to a filename possible?
Hi,
I've searched this forum and Google, I think I'm more lost now ![]() I want to create a save template that will append one specific tag to the filename if that tag is linked to a book. All other books without tag "xyz" will not have this filename changed. Default: {author_sort}/{title}/{title} - {authors} Obvious: {author_sort}/{title}/{title} - {authors} - {tags} This lists ALL tags though... Is there a way to parse the tags field? Thanks. -Chris |
![]() |
![]() |
![]() |
#2 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,970
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Don't remember about specific tags in SFM. But this will list the first tag alphabetically and also get rid of an extra '-' when there's no tag.
{tags:sublist(0,1,&)| - |} Last edited by ownedbycats; 04-28-2023 at 08:27 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() Posts: 15
Karma: 10
Join Date: Jan 2020
Device: iPhone/Voice Dream Reader
|
Thanks ownedbycats.
Using {tags:sublist(0,1,&)| - |} produces the same result as {tags} I searched "Reference for all built-in template language function" and found nothing specific to tags that might work. Of course, I have no idea if any of the other functions may work. I guess I could save the file with {tags} and use an external script to rename the file. I'd prefer that being a last resort though. |
![]() |
![]() |
![]() |
#4 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,444
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
The separator for tags is a comma, not an ampersand. As said in Using functions in templates - Single Function Mode (SFM), you enter a literal comma using \, Code:
{tags:sublist(0,1,\,)} Code:
{tags:'sublist($, 0, 1, ',')'| - |} Code:
{tags:'if '^xyz$' inlist $tags then 'xzy' fi'| - |} Code:
{tags:'in_list($, ',', '^xyz$', 'xyz', '')'| - |} |
||
![]() |
![]() |
![]() |
#5 |
Member
![]() Posts: 15
Karma: 10
Join Date: Jan 2020
Device: iPhone/Voice Dream Reader
|
wow, thanks chaley.
I used the GPM version, I can even understand it once you spelled it out for me. I also tried the TPM version, they both work perfectly. I really appreciate the help. Cheers, -Chris |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,970
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Oops, sorry - I copied the sublist from an author_sort and forgot to change the separator.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Request: Match Calibre Filename template recipe | cbook7 | Library Management | 10 | 06-05-2020 05:11 AM |
Download Filename Template? | nqk | Server | 2 | 06-02-2020 04:19 AM |
Template for folder/filename for Author/Title with Chinese characters | ctop | Library Management | 2 | 02-07-2020 07:37 AM |
Change filename template in Calibre's library | 8140david | Library Management | 3 | 09-25-2016 11:39 AM |
filename template feature | artbatista | Calibre | 0 | 08-23-2009 01:05 PM |