[grilo-plugins] thegamesdb: Fix cover not found when there's no back cover
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] thegamesdb: Fix cover not found when there's no back cover
- Date: Sat, 28 May 2016 22:55:20 +0000 (UTC)
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).
src/lua-factory/sources/grl-thegamesdb.lua | 12 +++++++++---
tests/games/test_games.c | 6 ++++++
2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/lua-factory/sources/grl-thegamesdb.lua b/src/lua-factory/sources/grl-thegamesdb.lua
index 9957a74..045851f 100644
--- a/src/lua-factory/sources/grl-thegamesdb.lua
+++ b/src/lua-factory/sources/grl-thegamesdb.lua
@@ -211,9 +211,15 @@ function fetch_game_cb(results)
if game.Images and
game.Images.boxart then
- for index, boxart in pairs(game.Images.boxart) do
- if boxart.side == 'front' then
- media.thumbnail = base_url .. boxart.xml
+ -- Handle having a single boxart image
+ if game.Images.boxart.side and
+ game.Images.boxart.side == 'front' then
+ media.thumbnail = base_url .. game.Images.boxart.xml
+ else
+ for index, boxart in pairs(game.Images.boxart) do
+ if boxart.side == 'front' then
+ media.thumbnail = base_url .. boxart.xml
+ end
end
end
end
diff --git a/tests/games/test_games.c b/tests/games/test_games.c
index efdad2c..e02d354 100644
--- a/tests/games/test_games.c
+++ b/tests/games/test_games.c
@@ -177,6 +177,12 @@ test_resolve_thumbnails_found (void)
0,
"http://thegamesdb.net/banners/boxart/original/front/3016-1.jpg");
+ test_resolve_thumbnail_found (source, keys, options,
+ "Astérix",
+ "",
+ 0,
+ "http://thegamesdb.net/banners/boxart/original/front/11837-1.jpg");
+
g_list_free (keys);
g_object_unref (options);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]