Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-17-2012, 10:31 AM   #1
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
Save Template: Strip out spaces

I know that it's only cosmetic but I would like to remove spaces from filenames used to send books to my device.

My save template is currently: {title_sort:.8}

Can I add some code to either strip out spaces or convert them to hyphens?
Agama is offline   Reply With Quote
Old 03-17-2012, 12:00 PM   #2
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 15,244
Karma: 6020307
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Agama View Post
I know that it's only cosmetic but I would like to remove spaces from filenames used to send books to my device.

My save template is currently: {title_sort:.8}

Can I add some code to either strip out spaces or convert them to hyphens?
Send to File has the option to replace spaces with underscores.

(are you having the same problem I have with my PEz. Bookmarks do not work (be able to retrieve location) with files that have spaces? )
theducks is offline   Reply With Quote
 
Advertisement
Old 03-17-2012, 12:20 PM   #3
chaley
"chaley", not "charley"
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: 5,896
Karma: 1216548
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Agama View Post
Can I add some code to either strip out spaces or convert them to hyphens?
Using single function mode:
Code:
Strip spaces: {title_sort:.8:re( ,)}
Convert spaces to hyphens: {title_sort:.8:re( ,-)}
Using template program mode:
Code:
Strip spaces: {title_sort:.8:'re($, ' ' ,'')'}
Convert spaces to hyphens: {title_sort:.8:'re($, ' ' ,'-')'}
or
Code:
Strip spaces: {title_sort:'shorten(re($, ' ' ,''), 8, '', 0)'}
Convert spaces to hyphens: {title_sort:'shorten(re($, ' ' ,'-'), 8, '', 0)'}
Using general program mode:
Code:
Strip spaces: program: shorten(re(field('title_sort'), ' ', ''), 8, '', 0)
Convert spaced to hyphens: program: shorten(re(field('title_sort'), ' ', '-'), 8, '', 0)
and so on.
chaley is offline   Reply With Quote
Old 03-17-2012, 04:12 PM   #4
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
Thanks for the replies. I used the simple function solution and both stripping and converting work exactly as required. (I'll save the more complex methods for a rainy day!)

(And... No, I was not having a bookmark problem, I just don't like spaces in filenames.)

Last edited by Agama; 03-17-2012 at 04:15 PM.
Agama is offline   Reply With Quote
Reply

Tags
templates

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Old Thread] Save Template not working TGinAZ Calibre 7 01-18-2012 02:03 AM
A little help with a save template...? Belfaborac Library Management 2 02-04-2011 10:47 PM
problem to save with customize template Roxro Library Management 4 01-22-2011 08:37 AM
save file template for series bucsie Calibre 2 11-08-2010 03:07 AM
save to disk template speakingtohe Calibre 9 05-29-2010 07:02 AM


All times are GMT -4. The time now is 03:18 AM.


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