View Single Post
Old 05-21-2014, 07:40 AM   #7
Snow Sciles
Connoisseur
Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.Snow Sciles ought to be getting tired of karma fortunes by now.
 
Posts: 65
Karma: 400010
Join Date: Mar 2013
Location: London
Device: Nook STG, PW2
chaley, when using strcmp, is it correct to leave the "It" value blank?

Code:
strcmp(
    current_library_name(), 
    'Fanfiction Library', 
    '', 
    sublist(field('#fandom'), 0, 1, ','), 
    field('authors')
)
eschwartz, your enthusiasm has convinced me to try program mode.

There are two things I'm going try. The first is to create a function that controls the author link in Book Details.

Here is what I've mustered so far

Code:
program:

default = "https://en.wikipedia.org/w/index.php?search={author}";
ao3     = "http://archiveofourown.org/works/search?work_search[creator]={author}";
ffnet   = "https://www.fanfiction.net/search.php?keywords={author}&ready=1&type=writer";

author_lookup = 

        first_matching_cmp(
           field('publisher'),
           'archiveofourown.org',
           ao3,
           'fanfiction.net',
           ffnet,
           default
        );
This works on books that have ao3 or ffnet as publisher. But for those that do not, instead of seeing the default wikipedia link, I get "Could not convert string to float: No such variable publisher".

I don't know what's wrong. I did expect to have to print author_lookup but it seems to work regardless, or perhaps first_match_cmp isn't a good function to use?


The second thing that I'm going to try, is column colouring. I've used the rules method, but Calibre became sluggish. I read this a known consequence of too many rules, so I limited things to only colouring the Title rather than All. Before I try, I want to know if doing it in program mode would prevent that sluggishness?
Snow Sciles is offline   Reply With Quote