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, 09:31 AM   #1
Agama
Fanatic
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: 555
Karma: 422221
Join Date: Jul 2010
Location: UK
Device: Sony PRS-300 & Kindle PW
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
Staff to 4 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: 10,954
Karma: 2574555
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
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? )
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
theducks is online now   Reply With Quote
 
Enthusiast
Old 03-17-2012, 11:20 AM   #3
chaley
Wizard
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: 3,879
Karma: 285970
Join Date: Jan 2010
Location: France
Device: Sony PRS-300, HTC WM6.5, Samsung Galaxy Nexus, HTC Sensation
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.
__________________
Support calibre developers at no cost to you by using calibre's get books feature.
Use Calibre Companion to wirelessly connect your Android phone or tablet to calibre
charles.haleys.org/calibre
chaley is offline   Reply With Quote
Old 03-17-2012, 03:12 PM   #4
Agama
Fanatic
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: 555
Karma: 422221
Join Date: Jul 2010
Location: UK
Device: Sony PRS-300 & Kindle PW
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

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 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 09:07 AM.


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