View Single Post
Old 08-24-2014, 10:23 AM   #3268
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,045
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by MiniMouse View Post
Is there a way to include more columns in a selection for a cover in der Genrate Cover Plugin in my personal.ini from FFDL?

I know that I can select a cover for a fandom (category) but can I make it more if/then?

I mean if the category is 'Merlin' and the first two characters in my 'characters' column are 'Arthur, Merlin' than select cover A from Generate Cover Plugin.

Or maybe even further, if the category is 'Merlin' and the first two characters in my 'characters' column are 'Arthur, Merlin' and the 'relationship' column is Arthur/Merlin' than select cover B from Generate Cover Plugin.
Yes, it is possible. But it involves using regular expressions.

Full generate_cover_settings spec:

Spoiler:
Code:
## If you have the Generate Cover plugin installed, you can use the
## generate_cover_settings parameter to intelligently decide which GC
## setting to run.  There are three parts 1) a template of which
## metadata part(s) to look at, 2) a regular expression to match the
## template, and 3) the name of the GC setting to use, which must
## match exactly.  Use this parameter in [defaults], or by site eg,
## [ficwad.com]
## Make sure to keep at least one space at the start of each line and
## to escape % to %%, if used.
## template => regexp to match => GC Setting to use.
## To use this, make sure you go to the Generate Cover tab in FFDL
## config and check 'Allow generate_cover_settings from personal.ini
## to override'
#generate_cover_settings:
# ${category} => Buffy:? [tT]he Vampire Slayer => BuffyCover
# ${category} => Star Trek => StarTrekCover

Because generate_cover_settings applies a regular expression to a string template that can contain any of the book metadata, it is possible to use more than one metadatum.

You do, however, have to allow for having other values, and you have to list them from most specific to least specific because the first line that matches will be the one used:
Code:
# saves having to match both Arthur/Merlin and Merlin/Arthur, etc.
# characters and other lists are already sorted by default.
sort_ships:true

generate_cover_settings:
 ${category}:${characters}:${ships} => .*Merlin.*:.*Arthur, .*Merlin.*:.*Arthur/Merlin.* => CoverMostSpecific
 ${category}:${characters} => .*Merlin.*:.*Arthur, .*Merlin.* => CoverMoreSpecific
 ${category} => Merlin => CoverMerlin
Testing this is an ideal time to use the built-in teststory feature to avoid hitting servers a bunch:

Spoiler:

You'll need to have a copy of the generate_cover_settings, etc that you're testing in [default], [epub] or [test1.com] sections. This is also a good time to be working in a separate test library until you're happy with it.

In personal.ini add:
Code:
[teststory:2000]
add_to_category_list:Merlin

[teststory:2001]
add_to_category_list:Merlin
add_to_characters_list:Merlin,Arthur,Bob,Zack,Aaron

[teststory:2002]
add_to_category_list:Merlin
add_to_characters_list:Merlin,Arthur,Bob,Zack,Aaron
add_to_ships_list:Thor/Jane,Merlin/Arthur
Now when you add/update stories with these URLs, they will have the metadata shown above:

http://test1.com?sid=2000
http://test1.com?sid=2001
http://test1.com?sid=2002
JimmXinu is offline