View Single Post
Old 05-26-2014, 04:57 PM   #11
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
I have found that the above program does not work. It works when I make a custom column, but when I put the code in the template box, on the book details settings page, everything defaults to the default.

I thought it worked, but found that the author links for books from ao3 and ff.net are saved in the "manage authors" settings. So I was mistaken. I don't know how that came to be, when I started this code all author links pointed to wikipedia. Which is the calibre default author link on the book details page.

From what I can gather, the field('publisher') is not being accessed in the book details template box.

This is the final code I tested in custom columns. But I want it to work in the book details template, is that possible?

Code:
program:

default  = strcat("https://en.wikipedia.org/w/index.php?search=", field('author'));
ao3        = strcat("http://archiveofourown.org/works/search?work_search[creator]=", field('author'));
ffnet      = strcat("https://www.fanfiction.net/search.php?keywords=", field('author'), "&ready=1&type=writer");
rkfic       = strcat("http://www.rockfic.com/user_profile.php?user_id=", field('#authorid'),  "&user=", field('author'), "&m=c");

author_lookup = 
        switch(
           field('publisher'),
           'archiveofourown.org',
           ao3,
           'www.fanfiction.net',
           ffnet,
           'rockfic',
           rkfic,
           default
        );

Last edited by Snow Sciles; 05-26-2014 at 05:17 PM.
Snow Sciles is offline   Reply With Quote