Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-12-2016, 06:37 AM   #1
BobC
Guru
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
Apostrophe in Title/Filename

I have hit a problem using a new Reader - It has issues with files which contain an apostrophe in their filename.

When I transfer a file it uses {title_sort} in generating the filename and in some cases this results in a filename which contains an apostrophe.

While I can avoid this by using Titles that don't contain an apostrophe it is a messy approach as all my other readers are happy with this (I think FWICR that in the case of Kepubs this is handled by the extended Kepub driver).

Is there any way to "sanitise" the title when using an Android device driver (or preferably any driver) when generating the filename so that for instance a title "The Prince's Purse" finishes up as a filenem "Princes Purse, The" .

BobC
BobC is offline   Reply With Quote
Old 01-12-2016, 08:09 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,308
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can do pretty much anything you like in templates, since in calibre templates are basically an entire programming language. See http://manual.calibre-ebook.com/template_lang.html
kovidgoyal is online now   Reply With Quote
Advert
Old 01-12-2016, 09:09 AM   #3
BobC
Guru
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
@Kovid,

I thought that would be the mechanism but have not had any experience of building them. I was hoping this was a problem that someone had solved already and that I wouldn't have to start learning a whole programming language to re-invent an already perfected wheel.

BobC
BobC is offline   Reply With Quote
Old 01-12-2016, 09:47 AM   #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: 12,410
Karma: 8012664
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Use
Code:
{title_sort:re(',)}
to remove apostrophes from title_sort.
chaley is offline   Reply With Quote
Old 01-12-2016, 09:54 AM   #5
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
The template language is pretty simple, it contains a bunch of builtin functions() that you can apply directly to a {template}
Now, as Kovid implied, you can trivially create your own arbitrary functions in python as well.

The builtin regular expressions function is pretty simple to use.

Code:
{title_sort:re(',)}

EDIT: ninjaed again...
We have great timing and synchronicity, I see.
eschwartz is offline   Reply With Quote
Advert
Old 01-12-2016, 10:09 AM   #6
BobC
Guru
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
Thanks to you both. It was simpler than I though and I had just worked it out and tested it when I got both your answers.

I'd fiddled with the expression before but was trying to use a metadata plugboard and was tying myself in a knot.

BobC
BobC is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apostrophe in book title scheife Kindle Formats 8 10-24-2017 04:55 AM
Title page showing filename and not true book title... hikerguy Editor 3 03-30-2015 05:37 PM
Book Title from filename EricBr Kindle Formats 3 06-17-2012 10:43 PM
Error parsing templates when {authors} has an '&' or if {title} has a an apostrophe sr2012 Library Management 1 04-30-2012 02:37 AM
using filename for title pj123 Calibre 1 05-22-2011 06:18 PM


All times are GMT -4. The time now is 02:58 AM.


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