View Single Post
Old 03-04-2014, 05:11 PM   #3
fidvo
Addict
fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.
 
Posts: 296
Karma: 1599870
Join Date: Jun 2012
Device: none
eschwartz, you're a genius!

Having a single branching template is a reasonable workaround. It's not quite as convenient as storing separate templates, but once you gave me the idea, I did some research and experimentation, and it looks like the switch function and the current_library_name function can be used together to select different templates based upon which library is active.

It even works when certain custom fields used in one of these sub-templates don't even exist in a different library.

The nice thing about using the switch function is that if I ever need to add another library in the future, I just have to add another pattern/value pair to the script. It's not as convenient as multiple templates, but it's the next best thing.

As soon as I work out my final template, I'll post it over on that other thread that you mentioned so that others can make use of it if they wish.

This is the last piece I needed in order to consolidate my copies of Calibre Portable.

Thanks!
fidvo is offline   Reply With Quote