This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Comic Plugin, Strange Bugs

Tags: None
(comma "," separated)
User avatar
MTGap
Alumni
Posts
45
Karma
0
OS

Comic Plugin, Strange Bugs

Thu Jul 30, 2009 11:54 pm
I'm trying to make a comic plugin for the comic strip The Dinette Set. The way they have URLs for each image is similar to Dilbert.coms' So I tried modifying an existing Dilbert comic plugin. I can't seem to get it to work. I can't get it to go to today's comic or move through the dates.

Here's the Dinette Set image urls: http://assets.comics.com/dyn/str_strip/ ... 1.full.gif

And the Dilbert image urls: http://dilbert.com/dyn/str_strip/000000 ... .print.gif

And here's the original Dilbert Plugin:

Code: Select all
function init()
{
    comic.comicAuthor = "Scott Adams";
    comic.firstIdentifier = "1994-01-01";
    comic.websiteUrl = "http://dilbert.com/strips/comic/" + comic.identifier.toString(date.ISODate) + "/";

    var url = "http://dilbert.com/fast/" + comic.identifier.toString(date.ISODate) + "/";
    var infos = {
        "User-Agent": "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.6 (like Gecko)",
        "Accept": "text/html, image/jpeg, image/png, text/*, image/*, */*",
        "Accept-Encoding": "functionlate",
        "Accept-Charset": "iso-8859-15, utf-8;q=0.5, *;q=0.5",
        "Accept-Language": "en",
        "Host": "dilbert.com",
        "Connection": "Keep-Alive"
    }
    comic.requestPage(url, comic.Page, infos);
}

function pageRetrieved(id, data)
{
    if (id == comic.Page) {
        var re = new RegExp("<img src=\"(/dyn/str_strip/[0-9/]+/[0-9]+\\.strip\\.print\\.gif)\"");
        var match = re.exec(data);

        if (match != null) {
            url = "http://dilbert.com/" + match[1];
        } else {
            url = "http://dilbert.com/img/v1/404.gif";
        }
        comic.requestPage(url, comic.Image);
    }
}


My modified plugin for The Dinette Set:

Code: Select all
function init()
{
    comic.comicAuthor = "Julie Larson";
    comic.firstIdentifier = "2005-03-02";
    comic.websiteUrl = "http://comics.com/the_dinette_set/" + comic.identifier.toString(date.ISODate) + "/";
   
    var url = "http://comics.com/the_dinette_set/" + comic.identifier.toString(date.ISODate) + "/";
    var infos = {
        "User-Agent": "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.6 (like Gecko)",
        "Accept": "text/html, image/jpeg, image/png, text/*, image/*, */*",
        "Accept-Encoding": "functionlate",
        "Accept-Charset": "iso-8859-15, utf-8;q=0.5, *;q=0.5",
        "Accept-Language": "en",
        "Host": "comics.com",
        "Connection": "Keep-Alive"
    }
    comic.requestPage(url, comic.Page, infos);
}

function pageRetrieved(id, data)
{
    if (id == comic.Page) {
        var re = new RegExp("<img src=\"(/dyn/str_strip/[0-9/]+/[0-9]+\\.full\\.gif)\"");
        var match = re.exec(data);

        if (match != null) {
            url = "http://assets.comics.com/" + match[1];
        } else {
            url = "http://assets.comics.com/dyn/str_strip/000000000/00000000/0000000/000000/20000/3000/100/23146/23146.full.gif";
        }
        comic.requestPage(url, comic.Image);
    }
}


Where is the problem? I don't exactly understand how that regex works right there, but it works for Dilbert somehow. It can get the initial date's comics fine, but not much else works from there. Any help is appreciated ;D


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]