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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 02-28-2010, 10:49 AM   #1
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Optional characters in Save Template for Adding Books

My original books are all in a standard name format of:
format 1:
Lastname, Firstname - Series ## - Title.ext

Of course, some books have no Series, and they are in this format:
format 2:
Lastname, Firstname - Title.ext

I have a regex in the Adding Books Preferences page that always splits the name correctly, regardless of which of the two forms are drag/dropped into Calibre. The regex relies on the space-hyphen-space to do the splitting.

I'd like to be able to export from Calibre with Save Books in a way that would reproduce the same name that the book had when it was imported. That's pretty easy if all books were in one form, but the problem arises when a book does not have a series. If I use the series and series_number in the Save Template, I need to separate it by the space-hyphen-space, but if there's no series, that space-hyphen-space separator always appears in the filename. The result is that I get an extra space-hyphen-space in the filename when there's no series.

My question: Is there any way to make the space-hyphen-space separator optionally dependent on the presence or absence of the series so that the output name is in format 1 when there is a series, and in format 2 when there isn't? Is there some trick to this that I've missed? Thanks!
Starson17 is offline   Reply With Quote
Old 02-28-2010, 12:52 PM   #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: 43,835
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
the templates use pythons format strings, as far as I recall there's no way to do conditionals in those.
kovidgoyal is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing "Save Template" not working? monkbythesea Calibre 10 08-04-2010 03:30 AM
Using Custom Metadata in Save Template EJvdH Calibre 1 07-02-2010 06:06 AM
save to disk template speakingtohe Calibre 9 05-29-2010 06:02 AM
Save template for title metadata? Bob Butler Calibre 10 03-15-2010 01:05 PM
Garbage characters in gutenburg books ylsul Sony Reader 3 04-25-2007 02:09 PM


All times are GMT -4. The time now is 09:21 PM.


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