02-02-2012, 12:52 PM | #1 |
Evangelist
Posts: 435
Karma: 572984
Join Date: Jan 2010
Location: Long Island
Device: Kobo Libra 2, Kindle 4, Nook Gl4, Nook STR, REB 1100, Ebookwise 1500,
|
Template language question
I'm working on creating an epub catalog of my books and fanfiction that is sorted by the *location* of the book/fanfic on my Nook as I use the MyFiles directory structure rather than bothering with the Shelves. I use the following two templates to send documents to my Nook based on if it's an official book or a fanficition.
Official books: {#library}/{#type}/{#genre}/{#subgenre}/{series}/{series_index:>2} {title} - {author} Fanfiction: {#library}/{#type}/{#fandom1}/{#fandom2}/{#fandom3}/{#pairings}/{series}/{series_index:>2} {title} - {author} I'm very pleased with the results I get from these templates. Now for creating the epub catalog I figured out that what I need to do is create a tag for each "location". I decided that the easiest thing to do would be to create a custom column built from the data of the pertinent custom columns. I'll export the results of that column to Excel then use the bulk edit function to add the correct tag to the correct books. If someone knows of an easier way, please let me know. Using a fanfic as an example this is the result I want in the column: Fanfic/Gen/HarryPotter/General/Harry_Hermione (Library)(Type)(Fandom1)(Fandom2)(Pairing) - fandom3 is rarely used but it is used occasionally so I need to include it. Originally I used this template: {#library}/{#type}/{#fandom1}/{#fandom2}/{#fandom3}/{#pairings} The result I got was: Fanfic/Gen/HarryPotter/General//Harry_Hermione/ I understood where the double // came from but I can't figure out why it added the one at the end. Many tries later this is the template I ended up creating: {#library}{#type:|/|}{#fandom1:|/|}{#fandom2:|/|}{#fandom3:|/|}{#pairings:|/|}{#empty:|/|} I had to add an empty custom column to calibre and then include it in the template in order to prevent that / at the end. Is this just the way it has to be or am I missing something due to my lack of programming knowledge? I read thru the Template Language Tutorial, that's how I figured out how to do this in the first place, and I tried to look at the Template Function Reference but just confused myself even more with that. I also have a quick question about the Template Editor in Preferences/Save To Disk(Send To Device). How do you get it to give you actual results while in the editor? The default is {author_sort}/{title} - {authors} which gives you the result of Unknown/Unknown - Unknown. Which, okay, that's fine I guess but how do I get it to display an actual book from my database? ie Lackey, Mercedes/Intrigues - Mercedes Lackey I tried having a book selected before I clicked on Preferences but that didn't do anything. Plus if I start trying to work with custom columns in there it gives me EXCEPTION: Value: unknown field #library. I'm guessing because it doesn't actually know what to reference at this point because if I go ahead and use the template in Save To Disk it references the #library field properly. Thanks, Beth |
02-02-2012, 01:05 PM | #2 | |
Well trained by Cats
Posts: 30,454
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
|
|
Advert | |
|
02-02-2012, 01:10 PM | #3 |
Evangelist
Posts: 435
Karma: 572984
Join Date: Jan 2010
Location: Long Island
Device: Kobo Libra 2, Kindle 4, Nook Gl4, Nook STR, REB 1100, Ebookwise 1500,
|
|
02-02-2012, 02:00 PM | #4 |
Well trained by Cats
Posts: 30,454
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
02-02-2012, 04:13 PM | #5 |
Evangelist
Posts: 435
Karma: 572984
Join Date: Jan 2010
Location: Long Island
Device: Kobo Libra 2, Kindle 4, Nook Gl4, Nook STR, REB 1100, Ebookwise 1500,
|
Okay, I get that, but how do I tell it to look at a book? I selected a book before I clicked Preferences/Save To Disk/Template Editor but the default template still just returns Unknown and I get the exception error when I start playing with the custom columns. Is there someplace in the Template Editor itself that I'm supposed to be telling it what book to look at? When I use my custom template with the actual Save To Disk or Send To Device feature it references my custom columns with no problem.
|
Advert | |
|
02-02-2012, 04:22 PM | #6 | |
Well trained by Cats
Posts: 30,454
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Save to disk/Send to device templates (they are separate) are invoked when you select a book and click Send/Save |
|
02-02-2012, 04:38 PM | #7 |
Evangelist
Posts: 435
Karma: 572984
Join Date: Jan 2010
Location: Long Island
Device: Kobo Libra 2, Kindle 4, Nook Gl4, Nook STR, REB 1100, Ebookwise 1500,
|
So what's the point of the Template Editor other than to frustrate you by giving you error messages when you're trying to sort out your template coding? Because to me an editor implies that this is a place to test my coding before it goes out into the real world, so to speak.
|
02-02-2012, 07:55 PM | #8 | |
Well trained by Cats
Posts: 30,454
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Calibre has provided syntax checking, similar to a spell check function in a Word Processor. All you need to do is invoke the Save file to a Test directory to see if you have created Syntactically correct Garbage |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Stupid question about calibre language template | Cammagno | Calibre | 1 | 01-08-2011 09:00 AM |
Question for those who read in their non-native language | ficbot | General Discussions | 13 | 04-18-2010 08:47 PM |
Hi there and question about multiple language ebooks | rebl | Introduce Yourself | 10 | 03-30-2010 03:45 PM |
some question about iliad :language and isilo file | foxql | iRex | 2 | 03-04-2009 11:02 AM |
Language and Encoding Question | llhots | Calibre | 1 | 02-11-2009 11:01 PM |