View Single Post
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