Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Devices

Notices

Reply
 
Thread Tools Search this Thread
Old 09-21-2021, 09:53 PM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
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}
Here's the template I was using for the column itself:

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:

Click image for larger version

Name:	2021-09-21 22_47_42-Window.png
Views:	104
Size:	1.9 KB
ID:	189345

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.
ownedbycats is online now   Reply With Quote
Old 09-22-2021, 04:02 PM   #2
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: 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}
which will convert all underscores in #kobopath to slashes. If you don't want *all* underscores converted then use some unique string to mean slash, for example ZZZ, then use the template
Code:
{#kobopath:re(ZZZ,/)}/{author_sort:sublist(0,1,&)}/{title} - {authors}
chaley is offline   Reply With Quote
Advert
Old 09-22-2021, 05:27 PM   #3
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
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.
ownedbycats is online now   Reply With Quote
Old 09-22-2021, 05:43 PM   #4
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: 11,738
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I will try that out. What other characters get cleaned? That way if I ever tweak things I'll know to avoid those.
In terms of cleaning differences between composites and text: front and back slashes.

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.
chaley is offline   Reply With Quote
Old 09-23-2021, 09:38 AM   #5
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,595
Karma: 61176603
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Using re(_,/) worked perfectly. Thank you
ownedbycats is online now   Reply With Quote
Advert
Reply


Forum Jump

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


All times are GMT -4. The time now is 01:26 AM.


MobileRead.com is a privately owned, operated and funded community.