Quote:
Originally Posted by ParadiseLost
Im not entirely sure that i understand your Comment. In my issue the Magazine is Dragon Magazine Issue # 400 issued on June 2011. The Fields I use are as follows:
Title: Dragon 400
Author: Wizards of the Coast
Series: Dragon Magazine [400] (auto numbers)
Published Date: June 2011
Publisher: Wizards of the Coast
So i used the Template that worked so great for me in with Series Books and Non series returning the results i posted in the last post.
However with the Magazine I get:
[Dragon Magazine 400] - Dragon 400
If i changed the Title to match the Series is there a way i could alter or append to my original template to check if title and series are the same value and if so not to repeat the information? To arrive at:
Dragon Magazine 400
Yes, i could simply erase the series column but i do use it in sorting. (I think maybe im just being stubborn here -.-)
In either regard thanks for your assistance.
|
For a template to do what you are asking, calibre must be able to know that the book is a magazine and generate output different from a book. It must be able to determine that fact using only the information in the book's metadata. From what I see, *you* know that it is a magazine but there is nothing in the metadata that tells that to calibre. Perhaps one could do some pattern matching, looking to see if the series number occurs in the title, but this wouldn't be very reliable.
The right way to go is to add some metadata that calibre can use to determine that the book is a magazine. There are several possibilities including:
- Add a specific tag that the template could look for
- Add a yes/no custom column
- Add a "book type" custom column
- Add a custom column that contains the template you want calibre to use. A "column with a fixed set of values" would be good for this.
You would use a send/save template that chooses what to do by using the new metadata. For example, if you did the fourth (column containing the template) and if you gave that column the lookup name #template, then the following template in
template program mode would use that value to generate the file name:
Code:
{#template:'template($)'}
For a book you would put the following into the #template column:
Code:
{series:|[|}{series_index:0>2s| |] - }{title}
For a magazine you would put something like the following, perhaps without the brackets
Code:
{series:|[|}{series_index:0>2s| |]}
This is the most general solution, permitting each book or magazine to have a different output template.
A template in
general program mode for the yes/no column solution would look something like:
Code:
program:
test(strcmp(field('#ismagazine'), 'yes', '', '1', ''),
template('{series:|[|}{series_index:0>2s| |]}'),
template('{series:|[|}{series_index:0>2s| |] - }{title}'))
And so on.