Wintermute0110 / plugin.program.AEL.dev

Emulator frontend and app launcher for Kodi
GNU General Public License v2.0
105 stars 36 forks source link

TGDB scraper not filtering on platform #142

Closed Hybrid512 closed 3 years ago

Hybrid512 commented 3 years ago

Hi,

I upgraded recently and now, I have an issue with the TGDB scraper. I have the impression that the platform filter is not working anymore. I have some roms that are existing with the exact same name on many platforms and the scraper retrieves all of them even though I'm applying it on a launcher where the platform is set.

Here is what I have in the logs :

2021-06-09 14:24:11.702 T:8375     INFO <general>: AEL DEBUG: Asking user for a search string.
2021-06-09 14:24:18.153 T:8375     INFO <general>: AEL DEBUG: TheGamesDB.get_candidates() search_term         "Batman Forever"
2021-06-09 14:24:18.153 T:8375     INFO <general>: AEL DEBUG: TheGamesDB.get_candidates() rombase_noext       "Batman Forever"
2021-06-09 14:24:18.153 T:8375     INFO <general>: AEL DEBUG: TheGamesDB.get_candidates() AEL platform        "Nintendo SNES"
2021-06-09 14:24:18.153 T:8375     INFO <general>: AEL DEBUG: TheGamesDB.get_candidates() TheGamesDB platform "6"
2021-06-09 14:24:18.153 T:8375     INFO <general>: AEL DEBUG: net_get_URL() GET URL "https://api.thegamesdb.net/v1/Games/ByGameName?apikey=***&name=Batman+Forever&filter[platform]=6"
2021-06-09 14:24:18.670 T:8375     INFO <general>: AEL DEBUG: net_get_URL() Read 1890 bytes
2021-06-09 14:24:18.670 T:8375     INFO <general>: AEL DEBUG: net_get_URL() HTTP status code 200
2021-06-09 14:24:18.670 T:8375     INFO <general>: AEL DEBUG: net_get_URL() encoding application/json
2021-06-09 14:24:18.670 T:8375     INFO <general>: AEL DEBUG: TheGamesDB._check_overloading() remaining_monthly_allowance = 2999
2021-06-09 14:24:18.671 T:8375     INFO <general>: AEL DEBUG: Scraper found 11 result/s

As you can see, scraper found 11 results which is what I get on TGDB website when not filtering platforms.

When filtering on the SNES platform, I get only one.

Here is the URL : https://thegamesdb.net/search.php?name=batman+forever&platform_id%5B%5D=6

For what I can tell, I would says that your URL parameters for platform_id is wrong. On TGDB website this parameter is called platform_id while in your URL, you're using only platform.

Best regards

Hybrid512 commented 3 years ago

well ... after digging a bit, looks like the api itself is broken regarding platform filtering.

You can check by yourself on the TGDB Swagger : https://api.thegamesdb.net/#/Games/GamesByGameName_v1

I tried the same request with and without filter[platform]=6 (for SNES) and that doesn't change anything, I always get results for every platforms.

Hybrid512 commented 3 years ago

This was effectively a bug on the TGDB api side. This has been fixed by the TGBD team : https://github.com/TheGamesDB/TheGamesDBv2/issues/32#issuecomment-859673849

Wintermute0110 commented 3 years ago

Thanks. I posted a message in TGDB forum. I'm happy it's already fixed.