09-21-2021, 09:53 PM | #1 |
Custom User Title
Posts: 8,595
Karma: 61176603
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Slashes converted to underscores when column used in save path
I had a #kobopath composite used to categorize my books at the top level. The full save path is:
Code:
{#kobopath}/{author_sort:sublist(0,1,&)}/{title} - {authors} Code:
program: # Returns 'Fanfiction/Fandom' (based on tags) for fanfics if $$#fanficcat then re(sublist($tags, 0, 1, ','), '\.', '/') # Returns 'PDF' for PDFs elif $formats == 'PDF' then 'PDF' # Returns 'Loans' for Loans elif $#kobostatus == 'On Loan' then 'Loans' # Returns blank for paperbooks # This bit isn't needed anymore # elif $formats == 'PAPERBOOK' then # '' # Returns topmost tag for all other books else re(sublist($tags, 0, 1, ','), '^(.*?)($|\..*$)', '\1') fi For fanfics, I used Fanfiction/Fandom entries to sort them into subfolders. This worked perfectly fine when it was a composite column. However, I copied it all over to a text column (originally #kobopath2, but I dropped the 2 after deleting the composite) because it was impacting performance too much and I only needed it for books I want on the device. It has the same Fanfiction/Fandom as before, but now Calibre turns the slashes into underscores and breaks the subfoldering: I tried inverting the slash, but that didn't work - even if it did, it would cause my template (I use it to generate the column output with my send-to-device Action Chain) to error. Any idea what I should do? I figure it's deliberate as it's technically an illegal character, but I'm not sure why it only affect non-composite columns. My fallback plan would be to just entirely drop the second part. I'd rather not do this. Sending all those fanfics to device again would be a hassle. Last edited by ownedbycats; 09-22-2021 at 09:03 AM. |
09-22-2021, 04:02 PM | #2 |
Grand Sorcerer
Posts: 11,738
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
For various historical reasons all non-composite fields are cleaned when used in a save path. That won't change.
You can work around this by applying a function to the component when you use it in a template. The function is applied after the component is cleaned. Example: Code:
{#kobopath:re(_,/)}/{author_sort:sublist(0,1,&)}/{title} - {authors} Code:
{#kobopath:re(ZZZ,/)}/{author_sort:sublist(0,1,&)}/{title} - {authors} |
Advert | |
|
09-22-2021, 05:27 PM | #3 |
Custom User Title
Posts: 8,595
Karma: 61176603
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I will try that out. What other characters get cleaned? That way if I ever tweak things I'll know to avoid those.
|
09-22-2021, 05:43 PM | #4 | |
Grand Sorcerer
Posts: 11,738
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
I haven't looked at what is done to the final path string. Underscore and minus should be safe, but I would stay away from other punctuation and non-latin characters. |
|
09-23-2021, 09:38 AM | #5 |
Custom User Title
Posts: 8,595
Karma: 61176603
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Using re(_,/) worked perfectly. Thank you
|
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Should composite columns appear in Grouped Searches? | ownedbycats | Library Management | 3 | 02-13-2021 03:43 PM |
Quickview and composite columns | ownedbycats | Library Management | 2 | 12-25-2020 04:43 PM |
Composite Columns: Stripping HTML from a value | M. Northstar | Library Management | 2 | 08-28-2019 05:39 PM |
Color coding and designing composite columns | ElMiko | Library Management | 12 | 01-04-2015 08:55 PM |
composite custom columns sorted numerically | Doug-W | Library Management | 2 | 02-18-2011 02:16 AM |