Topic: Kotaku widget? Can I start one?

Hey, Chumby widget developers.

I was going to try to create a Kotaku news widget, so that I can never be too far away from my gaming news. Is anybody already in the middle of making one? I noticed the official Chumby widget guys have done a lot of gawker sites already, and I just didn't want to get halfway through the process only to find out that there's another one that's almost finished.

--T

Re: Kotaku widget? Can I start one?

Todd -- this one's been on the list but we at Chumby haven't gotten to it yet. So from our perspective, build away! Thanks.

Re: Kotaku widget? Can I start one?

Awesome. Working on it now.

Hey, can I ask how you managed to extract the images from the engadget feed? It seems like I could either...

a) Use a third-party AS2.0 RegExp class to extract the images (which seems like it would be slow when running on the device)
b) Host a php file that grabs the feed and neatens it up for Chumbification (which would work, but would double the bandwidth)
c) Some clever idea that I haven't thought of yet.

Thanks... and sorry for not having this discussion in the Flash area.

--T

Re: Kotaku widget? Can I start one?

If I can suggest,
For my xbox control,
I went down several corridors,
Many of them very very dark and scary!
I finally ended up with an ASP 2.0 script,
Reformatting the xbox iframe into chumby happy var/value pairs,
Then also remote relaying the images.

I don't think I really needed to remote relay the images,
Just the urls,
Wrote another version that I'm testing the live URLs on tonight.
So, Chumby, Me, Xbox.
Chumby pulls vars from me,
Pulls images from XBOX.

CRJ
Charley Jones, PMP
A+ MOUS MCP MCSA MCSE MCDBA MCAD MCT MCTS MCITP PMP ITIL
Founder & President: S3OLV.Com    Founder & President: LVXUG.Com

Re: Kotaku widget? Can I start one?

i just took a quick look at the files that chumby pulls for the engadget feed. there are no calls to an external scrip/server - just a call to the engadget feed (and to the associated image on blogsmithmedia.com). they must be handling the parsing within the widget.

incidentally, firebug is really useful for sussing out what a widget is doing behind the scenes. you can watch it grab the crossdomain.xml, and see what feeds/images are requested.

Re: Kotaku widget? Can I start one?

Thanks for the informative (and, in crjones' case, nicely poetic) responses.

For the record, I found a custom RegExp class _was_ much too slow, so I'm using lots of substring() calls at the moment. The whole thing strikes me as pretty fragile, so I might switch to using an intermediary php script at some point.

--Todd

Re: Kotaku widget? Can I start one?

We typically parse the HTML as XML and use various routines to descend through the tree looking for what we want.

For instance, we have the following methods added to Object, which will apply to XML nodes:

Object.prototype.firstChildOfType = function(s) {
    var n = this.firstChild;
    while (n) {
        if (n.nodeName==s) {
            return n;
        }
        n = n.nextSibling;
    }
    return null;
}

Object.prototype.firstDescendantOfType = function(s) {
    var n = this.firstChildOfType(s);
    if (n) return n;
    n = this.firstChild;
    while (n) {
        var k = n.firstDescendantOfType(s);
        if (k) return k;
        n = n.nextSibling;
    }
    return null;
}

Then you can do things like:

var imageTagItem = someNode.firstDescendantOfType('img');
var href = imageTagItem.attributes.href;

If something isn't well-formed enough to parse as XML, we'll often use String.split to quickly break the text up into chunks that we can parse more easily. For instance, splitting on the string "<img" will help find img tags.

Re: Kotaku widget? Can I start one?

Hmmm, I like the idea of splitting by <img
My problem was that the html wasn't well formed enought to use loadvars,
So I opted to do the pre-processing in .Net first,
If you're not brining the HTML in through loadvars,
(Which fails is poorly formed HTML)
How are you briging it in?

CRJ
Charley Jones, PMP
A+ MOUS MCP MCSA MCSE MCDBA MCAD MCT MCTS MCITP PMP ITIL
Founder & President: S3OLV.Com    Founder & President: LVXUG.Com

Re: Kotaku widget? Can I start one?

We very rarely use LoadVars - we typically use XML.load() for pretty much everything.

However, for poorly formed or non-XML data, we will use the XMl.onData handler (which gets the raw response text) rather than the XML.onLoad handler (which assumes well-formed data).  I've even used both when I get something through XML.onData which can be repaired, parsed, then sent on to the XML.onLoad handler.  I recently did that for an XML feed which had weird entities that Flash's XML parser could not handle.

Re: Kotaku widget? Can I start one?

Fantastic!
I'll give OnData a try....

CRJ
Charley Jones, PMP
A+ MOUS MCP MCSA MCSE MCDBA MCAD MCT MCTS MCITP PMP ITIL
Founder & President: S3OLV.Com    Founder & President: LVXUG.Com

Re: Kotaku widget? Can I start one?

Hey, all.

Well, in case anybody's interested, I turned on the public flag on the Kotaku reader. If you guys want to check it out after it's gotten the go-ahead from the powers that be, I'd appreciate any comments. (I'm guessing it'll be in the Widget Laboratory section)

For what it's worth, I ended up not parsing the HTML as XML, since I didn't think I'd have the time to redo all of that and get this thing out in a reasonable time period (my free time is pretty limited this month). What I have seems to work pretty well, though. So I'm reasonably happy...

--T

Re: Kotaku widget? Can I start one?

I updated my Chumby with this new widget... nice work!  Looks great... I'm not sure if it's related but I'm noticing my Chumby has been hanging sometimes and it's always stuck on this widget.  Nothing works - always needs a reboot.  It doesn't always lock up, but a few times I've left it alone for a bit and I've come back to find it on this widget and it's locked up.

Re: Kotaku widget? Can I start one?

^^^I'm having the same exact problem. I'll leave and come back it's always stuck on this widget, so I just removed it until there is a new version. I submitted the problem in the bug section though.

Re: Kotaku widget? Can I start one?

Hey, guys. Thanks for the heads-up (and sorry for the delayed reply -- I was traveling). I'm going to look into the freezing problem over the weekend and see if I can figure out what the heck's going on. In the meantime, if you want to remove the widget, I won't take it personally. smile

--Todd