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 03-17-2012, 09: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: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: 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, 11:00 AM   #2
theducks
Well trained by Cats
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: 29,930
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
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
Old 03-17-2012, 11:20 AM   #3
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,770
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
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, 03: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: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: 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 03:15 PM.
Agama is offline   Reply With Quote
Reply

Tags
templates


Forum Jump

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


All times are GMT -4. The time now is 06:10 PM.


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