After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766678 - Add TheGamesDB source
Add TheGamesDB source
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: lua
unspecified
Other All
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2016-05-19 18:53 UTC by Bastien Nocera
Modified: 2016-05-28 22:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: Rename gamefaqs tests to games (5.17 KB, patch)
2016-05-19 18:53 UTC, Bastien Nocera
committed Details | Review
tests: Fix dist with lua-factory disabled (612 bytes, patch)
2016-05-19 18:53 UTC, Bastien Nocera
committed Details | Review
lua-factory: Add TheGamesDB source (8.62 KB, patch)
2016-05-19 18:53 UTC, Bastien Nocera
none Details | Review
tests: Port games test from gamesfaq to thegamesdb (276.53 KB, patch)
2016-05-19 18:53 UTC, Bastien Nocera
none Details | Review
lua-factory: Remove GameFAQs source (7.70 KB, patch)
2016-05-19 18:53 UTC, Bastien Nocera
committed Details | Review
tests: Port games test from gamesfaq to thegamesdb (276.53 KB, patch)
2016-05-19 20:02 UTC, Bastien Nocera
committed Details | Review
tests: Add test cases to thegamesdb (7.40 KB, patch)
2016-05-20 11:35 UTC, Adrien Plazas
needs-work Details | Review
test: Add two test cases to thegamesdb (20.92 KB, patch)
2016-05-20 12:36 UTC, Adrien Plazas
none Details | Review
lua-factory: Add TheGamesDB source (9.00 KB, patch)
2016-05-20 19:58 UTC, Bastien Nocera
committed Details | Review
test: Add two test cases to thegamesdb (20.94 KB, patch)
2016-05-20 19:59 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2016-05-19 18:53:04 UTC
.
Comment 1 Bastien Nocera 2016-05-19 18:53:15 UTC
Created attachment 328219 [details] [review]
tests: Rename gamefaqs tests to games

As we want to use this test suite for all games.
Comment 2 Bastien Nocera 2016-05-19 18:53:29 UTC
Created attachment 328220 [details] [review]
tests: Fix dist with lua-factory disabled
Comment 3 Bastien Nocera 2016-05-19 18:53:37 UTC
Created attachment 328221 [details] [review]
lua-factory: Add TheGamesDB source
Comment 4 Bastien Nocera 2016-05-19 18:53:48 UTC
Created attachment 328222 [details] [review]
tests: Port games test from gamesfaq to thegamesdb
Comment 5 Bastien Nocera 2016-05-19 18:53:55 UTC
Created attachment 328223 [details] [review]
lua-factory: Remove GameFAQs source

The website managers made it clear that they did not want anyone to use
the search engine to find metadata, as stated in the robots.txt file.

As this won't be useful to gnome-games, remove it.
Comment 6 Bastien Nocera 2016-05-19 20:02:14 UTC
Created attachment 328226 [details] [review]
tests: Port games test from gamesfaq to thegamesdb
Comment 7 Adrien Plazas 2016-05-20 11:35:39 UTC
Created attachment 328250 [details] [review]
tests: Add test cases to thegamesdb
Comment 8 Bastien Nocera 2016-05-20 11:42:17 UTC
Review of attachment 328250 [details] [review]:

attachment 328226 [details] [review] already has a port of the tests.
Comment 9 Adrien Plazas 2016-05-20 12:36:59 UTC
Created attachment 328256 [details] [review]
test: Add two test cases to thegamesdb

Add thumbnail tests for:
- Kirby's Dream Land on Game boy
- Sonic th Hedgehog on Master System
Comment 10 Bastien Nocera 2016-05-20 19:56:57 UTC
Review of attachment 328256 [details] [review]:

::: tests/games/data/resolve-getgame-kirby-gb.data
@@ +4,3 @@
+<Game>
+<id>3190</id>
+<GameTitle>Kirby's Dream Land 2</GameTitle>

That's not a GetGame output, that's a GetGamesList output.

::: tests/games/data/resolve-getgame-sonic-sms.data
@@ +4,3 @@
+<Game>
+<id>3014</id>
+<GameTitle>Sonic the Hedgehog Chaos</GameTitle>

Same thing here.

::: tests/games/data/resolve-kirby-gb.data
@@ +2,3 @@
+
+<Data>
+<baseImgUrl>http://thegamesdb.net/banners/</baseImgUrl>

*This* is the GetGame output and not the GetGamesList output.

::: tests/games/data/resolve-sonic-sms.data
@@ +2,3 @@
+
+<Data>
+<baseImgUrl>http://thegamesdb.net/banners/</baseImgUrl>

Ditto.

::: tests/games/test_games.c
@@ +168,3 @@
+  test_resolve_thumbnail_found (source, keys, options,
+                                "Kirby's Dream Land",
+                                "application/x-game-boy-rom",

that's application/x-gameboy-rom, not application/x-game-boy-rom
Comment 11 Bastien Nocera 2016-05-20 19:58:58 UTC
Created attachment 328290 [details] [review]
lua-factory: Add TheGamesDB source
Comment 12 Bastien Nocera 2016-05-20 19:59:18 UTC
Created attachment 328291 [details] [review]
test: Add two test cases to thegamesdb

Add thumbnail tests for:
- Kirby's Dream Land on Game boy
- Sonic th Hedgehog on Master System
Comment 13 Bastien Nocera 2016-05-20 20:01:19 UTC
(In reply to Bastien Nocera from comment #11)
> Created attachment 328290 [details] [review] [review]
> lua-factory: Add TheGamesDB source

Correct the disambiguation that still used numerical IDs for platforms (inherited from the gamefaqs script), and now goes through an exact match test before returning a result.

(In reply to Bastien Nocera from comment #12)
> Created attachment 328291 [details] [review] [review]
> test: Add two test cases to thegamesdb
> 
> Add thumbnail tests for:
> - Kirby's Dream Land on Game boy
> - Sonic th Hedgehog on Master System

I corrected the test data, and the mime-type so that we didn't try to find a Kirby's Dreamland on Neo Geo or something ;)
Comment 14 Victor Toso 2016-05-21 06:59:21 UTC
Review of attachment 328219 [details] [review]:

looks good
Comment 15 Victor Toso 2016-05-21 06:59:48 UTC
Review of attachment 328220 [details] [review]:

sure
Comment 16 Victor Toso 2016-05-21 07:00:35 UTC
Review of attachment 328223 [details] [review]:

pity :(
Comment 17 Victor Toso 2016-05-21 07:03:50 UTC
Review of attachment 328226 [details] [review]:

sure
Comment 18 Victor Toso 2016-05-21 07:27:32 UTC
Review of attachment 328290 [details] [review]:

Small description about the source in commit log?

Patch looks good. Could you please rebase it? I was not able to apply cleanly and I'd like to try it out before acking

::: src/lua-factory/sources/grl-thegamesdb.lua
@@ +49,3 @@
+---------------------------------
+
+function get_platform_name(mime_type, suffix)

This function could be moved under Utilities sector instead of Handlers sector

@@ +52,3 @@
+    local platform_names = {}
+
+    -- mime-types are upstream in shared-mime-info

Where? Can't we load this and the names as GResource?

@@ +112,3 @@
+    if not url then return nil end
+    -- Return a 3-letter suffix
+    return url:match('.-%.(...)$')

I think you want to use the wildcard '*' instead of '-' otherwise it could fail to get the suffix if uri has dots in the name
grl-video-title-parsing also gets the suffix (but remove it)
https://git.gnome.org/browse/grilo-plugins/tree/src/lua-factory/sources/grl-video-title-parsing.lua#n64

@@ +240,3 @@
+
+    if game.Developer then
+      -- FIXME media.developer = game.Developer.xml

You would rather that we include this metadata in grilo or that the lua source iteself could create them like the c plugins do?
https://bugzilla.gnome.org/show_bug.cgi?id=762567
Comment 19 Victor Toso 2016-05-21 07:35:00 UTC
Review of attachment 328291 [details] [review]:

Looks good

::: tests/games/test_games.c
@@ +176,3 @@
+                                "application/x-sms-rom",
+                                0,
+                                "http://thegamesdb.net/banners/boxart/original/front/3016-1.jpg");

I would go for an array of testing-struct like [0]. That way, it is easy to include test cases.
But either way is fine for me.

[0] https://git.gnome.org/browse/grilo-plugins/tree/tests/thetvdb/test_thetvdb_resolve_episodes.c#n108
Comment 20 Bastien Nocera 2016-05-28 22:22:24 UTC
The attachments ended up broken making it impossible to test. Please file new bugs for any errors in those.

Attachment 328219 [details] pushed as 52defab - tests: Rename gamefaqs tests to games
Attachment 328220 [details] pushed as d53499d - tests: Fix dist with lua-factory disabled
Attachment 328223 [details] pushed as 15841f3 - lua-factory: Remove GameFAQs source
Attachment 328226 [details] pushed as 36235f0 - tests: Port games test from gamesfaq to thegamesdb
Attachment 328290 [details] pushed as 8ab84cd - lua-factory: Add TheGamesDB source
Attachment 328291 [details] pushed as ac18356 - test: Add two test cases to thegamesdb
Comment 21 Bastien Nocera 2016-05-28 22:57:18 UTC
(In reply to Victor Toso from comment #18)
> Review of attachment 328290 [details] [review] [review]:
> 
> Small description about the source in commit log?
> 
> Patch looks good. Could you please rebase it? I was not able to apply
> cleanly and I'd like to try it out before acking

It's a problem with bugzilla or git-bz mangling the patch. It was already rebased.

> ::: src/lua-factory/sources/grl-thegamesdb.lua
> @@ +49,3 @@
> +---------------------------------
> +
> +function get_platform_name(mime_type, suffix)
> 
> This function could be moved under Utilities sector instead of Handlers
> sector

Done.

> @@ +52,3 @@
> +    local platform_names = {}
> +
> +    -- mime-types are upstream in shared-mime-info
> 
> Where? Can't we load this and the names as GResource?

Those aren't names, those are identifiers used in the request. They look an awful lot like names though, I must admit.

> @@ +112,3 @@
> +    if not url then return nil end
> +    -- Return a 3-letter suffix
> +    return url:match('.-%.(...)$')
> 
> I think you want to use the wildcard '*' instead of '-' otherwise it could
> fail to get the suffix if uri has dots in the name
> grl-video-title-parsing also gets the suffix (but remove it)
> https://git.gnome.org/browse/grilo-plugins/tree/src/lua-factory/sources/grl-
> video-title-parsing.lua#n64

Fixed, and fixed the two-letter suffixes too.

> @@ +240,3 @@
> +
> +    if game.Developer then
> +      -- FIXME media.developer = game.Developer.xml
> 
> You would rather that we include this metadata in grilo or that the lua
> source iteself could create them like the c plugins do?
> https://bugzilla.gnome.org/show_bug.cgi?id=762567

Yep, but until that's done...

commit 6cffca1702e8eedd1428199feca0433a19de9e34
Author: Bastien Nocera <hadess@hadess.net>
Date:   Sun May 29 00:54:14 2016 +0200

    thegamesdb: Move a few helpers to the helpers section
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=766678#c18

commit a4ab69de82564948f6b2bb3331081690cb4b9eb9
Author: Bastien Nocera <hadess@hadess.net>
Date:   Sun May 29 00:51:20 2016 +0200

    thegamesdb: Add support for Game Gear disambiguation
    
    We were expecting all suffixes to be 3 letters, they can be 2 in the
    case of the Game Gear suffix (*.gg).
    
    This also fixes the matching according to the review in:
    https://bugzilla.gnome.org/show_bug.cgi?id=766678#c18

commit 4176fd55a362ca132c32cbaf047687b9bed52df4
Author: Bastien Nocera <hadess@hadess.net>
Date:   Sun May 29 00:47:46 2016 +0200

    fixup! thegamesdb: Fix cover not found when there's no back cover

commit 14ecb7a588dda4fe2d0fc6b8075b2e2c7ca5c25b
Author: Bastien Nocera <hadess@hadess.net>
Date:   Sun May 29 00:46:14 2016 +0200

    tests: Add missing files to EXTRA_DIST in games

commit 363c0e7727b9448cfd4f4661115c3828e9176832
Author: Bastien Nocera <hadess@hadess.net>
Date:   Sun May 29 00:35:02 2016 +0200

    thegamesdb: Fix cover not found when there's no back cover
    
    As in the test case included ("Astérix" on the Game Gear).