Game_Info Plugin #151

Merged
merged 6 commits into from Apr 22, 2013

Projects

None yet

5 participants

@thomaspreece

I've created a plugin to interface with thefreegamesdb.com returning information about free pc games.

@majuscule
Member

Looks like the API is down for the moment for updates :-(

http://thefreegamesdb.com/API/SearchGame.php?Search=block&ContentType=JSON

API Currently Offline until updates are completed. Please try back in a few days.
@thomaspreece

Yeah the site is undergoing major reworks on the game categories/database so I had turned off the API to prevent developers making an app that becomes outdated very fast, I've since turned it back on but put up a warning. However the plugin only returns data if it finds an exact name match so isn't affected by the major reworks (doesn't depend on the games category) hence I created a separate DuckDuckGo.php for this plugin (http://thefreegamesdb.com/API/DuckDuckGo.php?Name=homesick).

@thomaspreece

I've changed the online php and the code so the plugin gets code from both thefreegamesdb.com and thegamesdb.net (I would of got information directly from thegamesdb.net but they don't have JSON yet, just XML).
So thefreegamesdb.com/API/DuckDuckGo.php gets information from thegamesdb.net XML and its internal database and if an exact game name match is made it returns the game information.

@majuscule
Member

Cool! I see. So I've taken another look and tried it out. I noticed a few ways that this can be improved. Firstly, some of the source links generated give a 404, such as http://thefreegamesdb.com/1121/Homesick. Also, I think it we should give this spice a big header (pass force_big_header: 1 to items[0]). While we're doing that, we should use the cannonical style for such. In this case, where we know we've got an exact match if it fires, I'd suggest a header in the form Game Title (Games). Check out the movies spice (like, https://duckduckgo.com/?q=movie+the+dark+knight) for an example of what we should be aiming for.

Let me know what you think of these suggestions!

Thanks :-)

@majuscule majuscule was assigned Apr 7, 2013
@thomaspreece

Sorry about the 404, I miss-typed the link generator in the PHP code should be fixed now: http://thefreegamesdb.com/Games/1121/Homesick instead of http://thefreegamesdb.com/1121/Homesick.
I was looking for a way to get the big header but could not find it as it appears not to be documented, added in (Games) after title and big header :)

@majuscule
Member

Cool! Thanks for mentioning that about the documentation. It should be documented. We just migrated our documentation from DuckDuckHack entirely to our github readmes, and it appears to have gotten lost in the move. I'll fix that right away :-)

Other than that, I think it looks fantastic. I'd add 'games' to the trigger list though, and actually, I was going back and forth on this - but I think it's better without shortening the about text. Our ZCI boxes have a maximum height and can scroll. It's not totally awesome to have a wall of text there all the same, but in this case I think it looks better, particularly since we don't currently have a clean way to find an 'appropriate' place to break the text.

What do you think?

@thomaspreece

My only concern with putting no limit on the text is that it will make the link for more info (and in the case of thefreegamesdb.com a link to download links and official webpage) very far down and I've found users don't tend to unhide things/scroll very much. Is there a way so that the text is unlimited but the link is still shown when the text goes over the max height.
Alternatively I could cap it to maybe the first two sentences that way, it doesn't look so badly cutoff.

@majuscule
Member

That makes sense, I think this is a good middle ground then. It looks good. The last step is that every plugin should have its own test file. This helps us protect against later regressions, as well as to ensure that the code is working when it is installed onto a system. Take a look inside the t/ directory, they should all be pretty straightforward as examples.

@majuscule
Member

BTW, tests can be run with prove -Ilib or perl -Ilib t/SpiceName.t.

@thomaspreece

I've created a test file but I've never done PERL before (and there is no documentation that I can find for test files) so I don't know if I've done it correctly but I pretty much just copied the one for xkcd. I've run the command and it comes back successful so I think I changed it correctly.

@majuscule
Member

Awesome. You wrote it perfectly. Merging this in now with one addition - I'm adding a result cache, as I imagine these results do not tend to change much. Let me know if you think that that is not a good idea for whatever reason.

This should go live soon, and I will let you know here right away when it is.

Thank you again for contributing :-)

@majuscule majuscule merged commit 6f69a0a into duckduckgo:master Apr 22, 2013
@thomaspreece

Sounds good to me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment