Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 02-03-2022, 05:51 AM   #1
vyvlad
Junior Member
vyvlad began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Feb 2022
Device: Kobo Clara HD
special character managemenet in device filenames

calibre has a tendency to replace special characters with _ for filesystem comaptibility reasons. I have a lot of books with multiple special characters (colons, apostrophes, and other punctuation) in both the title and series names, and I tend to use the underlying filesystem to navigate my library on managed devices.

Is there an easy way to change the mapping of many special characters? Regex works well, but single-function mode means that you can only do one character swap per field (unless there's a chaining syntax I couldn't find), and I don't necessarily want to enter a full programming environment just to swap some characters.
vyvlad is offline   Reply With Quote
Old 02-03-2022, 05:56 AM   #2
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: 10,787
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I would not advise using illegal characters but if you want to switch all the underscores to something else safe like a period, see this thread.

I am not sure how you'd go about doing multiple replacements though, at least without a composite column.

Last edited by ownedbycats; 02-03-2022 at 06:07 AM.
ownedbycats is offline   Reply With Quote
Advert
Old 02-03-2022, 06:06 AM   #3
vyvlad
Junior Member
vyvlad began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Feb 2022
Device: Kobo Clara HD
Quote:
Originally Posted by ownedbycats View Post
I would not advise using illegal characters but if you want to switch all the underscores to something else safe like a period, see this thread.
Sorry I wasn't clear - I am not planning on using illegal characters in the filenames, but I want different behaviors for converting different illegal characters into valid filenames. For example, I want most punctuation to be converted to an empty string, but colons converted to a dash.
vyvlad is offline   Reply With Quote
Old 02-03-2022, 06:08 AM   #4
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: 10,787
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Yes, I misunderstood your post at first. Sorry.
ownedbycats is offline   Reply With Quote
Old 02-03-2022, 06:45 PM   #5
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by vyvlad View Post
Is there an easy way to change the mapping of many special characters? Regex works well, but single-function mode means that you can only do one character swap per field (unless there's a chaining syntax I couldn't find), and I don't necessarily want to enter a full programming environment just to swap some characters.
For something like that, using General Program mode makes sense. But, Template program mode would work. For example, changing random characters:

Code:
{title:'re(re($,"[os]","f"),"[bdcH]","a")'}
works to change "Bleak House" to "aleak afufe". But I would much rather use:
Code:
program:
title = re($title,"[os]","f");
title = re(title,"[bdcH]","a");
strcat(current_library_name(), '/', $author_sort, '/', title, ' - ', $author)
Which is an update to my current send-to-device save template.
davidfor is offline   Reply With Quote
Advert
Old 02-10-2022, 04:31 AM   #6
vyvlad
Junior Member
vyvlad began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Feb 2022
Device: Kobo Clara HD
Quote:
Originally Posted by davidfor View Post
For something like that, using General Program mode makes sense. But, Template program mode would work. For example, changing random characters:

Code:
{title:'re(re($,"[os]","f"),"[bdcH]","a")'}

Cool, I didn't realize Template mode this much flexibility. Thank you!
vyvlad is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Transforming Filenames With Special Characters Rand Brittain Library Management 8 01-21-2022 12:55 PM
Forma Can't read .cbz files with special characters in the .jpg filenames JawadLeLogeur Kobo Reader 3 06-24-2021 09:53 AM
Insert special character: some niggles Phssthpok Editor 2 11-19-2016 12:55 PM
Special Character searches ElMiko Calibre 2 09-05-2011 10:52 PM
CBR/Z character-support for inner filenames drMerry Calibre 3 05-11-2011 03:16 PM


All times are GMT -4. The time now is 04:15 AM.


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