I need a little more clarification around updates

Need help with your application? Ask here.
Post Reply
tanderson
Posts: 13
Joined: Wed Jul 10, 2019 2:43 pm

I need a little more clarification around updates

Post by tanderson » Tue Jul 16, 2019 3:05 am

I have added comments to my case statement below, can someone validate that my comments would be the right behavior. It seems like some of these are very inefficient, maybe i am miss understanding.

switch ($Update->type) {
case "boxart":
//if value is [REMOVED] (we need to delete a specific box art but we don't know which one, so nuke them all and resync them all.)

//if value is anything else is a new entry (or an edit?),
//but it doesn't have enough info in the JSON so we need to query the whole /Games/Images
//for this title and look for a filename that matches this one
case "rating":
//if value is "Not Rated" (Null out what the DB has)
// if value is Anything else save it to the DB, overwrite whats there.
case "platform":
//if value is null (remove the current value)
//if value is anything else save the value, make sure we have that platform in the DB, if we don't index all platforms again.
case "youtube":
//if value is null (remove value)
//if value is anything else save the value (some of these are complete URL's some are not, massage the data here to be constant
case "coop":
//if value is null (remove value)
//if value is anything else save the value
case "players":
//if value is null (remove value)
//if value is anything else save the value
case "release_date":
//if value is null (remove value)
//if value is anything else save the value as a proper mysql date from this format 2006-10-02
case "overview":
//if value is null (remove value)
//if value is anything else save the value
case "game_title":
//if value is null (remove value, I doubt this could ever happen, seems a game should always have a title as a mandatory field.)
//if value is anything else save the value
case "developers":
//if value is empty array remove all past values
//if value is New array, empty all past values and add these values back. (I assume this is a complete list.. not just a list of who was added)
//Once added make sure we have entries for those developers, if not sync them all again.
case "genres":
//if value is empty array remove all past values
//if value is New array empty all past values and add these values back (I assume this is a complete list.. not just a list of who was added)
//Once added make sure we have entries for those genres, if not sync them all again.
case "game":
//if value is [NEW] (create a new entry)
//if value is [REMOVED] (Delete the entry)
}

A few other questions
  • The main /Games/ByPlatformID will only give me BoxArt even if i add the other types to the include query var. it seems the update API will also only give me BoxART, how do I update fanart, banner, screenshot and clearlogo? Do i need to completly pull a few thousand API requests for each and every title?
  • /Games/Images api takes a list of gameID's, what is the maximum number of GameID's i can send? Or is it only limited by the length of the query string? (which would be what your server is set to)

tanderson
Posts: 13
Joined: Wed Jul 10, 2019 2:43 pm

Re: I need a little more clarification around updates

Post by tanderson » Tue Jul 16, 2019 3:25 am

I decided to waste a few api calls and query a bunch of random updates to see if there are more types then the example shows and sure enough there were a few more. Do i have these correct... it seems these would negate the need to sync images on their own. (Which is great!!)

case "all_images":
//[REMOVED] (Delete all ART)
case "clearlogo":
//[REMOVED] (Delete the ART, but we don't know which one so nuke them all and resync)
//anything else is a new entry (or an edit?), but it doesn't have enough info so we need to query the whole ImageAPI for this title.
case "screenshot":
//[REMOVED] (Delete the ART, but we don't know which one so nuke them all and resync)
//anything else is a new entry (or an edit?), but it doesn't have enough info so we need to query the whole ImageAPI for this title.
case "banner":
//[REMOVED] (Delete the ART, but we don't know which one so nuke them all and resync)
//anything else is a new entry (or an edit?), but it doesn't have enough info so we need to query the whole ImageAPI for this title.
case "fanart": //I couldn't find an example of this but it should exist if the others do..
//[REMOVED] (Delete the ART, but we don't know which one so nuke them all and resync)
//anything else is a new entry (or an edit?), but it doesn't have enough info so we need to query the whole ImageAPI for this title.

tanderson
Posts: 13
Joined: Wed Jul 10, 2019 2:43 pm

Re: I need a little more clarification around updates

Post by tanderson » Tue Jul 16, 2019 4:41 am

after some experiments i have found that the /Games/Images api maxes out at a little over 1000 GameID's. I noticed that very few games have images other then boxart. Its possible that /Games/ByPlatformID might actually support fanart, etc just there is so little of it i couldn't get the api to return those values.

I will start working backwards to see if i can make ByPlatformID give me some fanart or banners!

tanderson
Posts: 13
Joined: Wed Jul 10, 2019 2:43 pm

Re: I need a little more clarification around updates

Post by tanderson » Tue Jul 16, 2019 4:52 am

seems ByPlatformID for sure does not allow fanart, banners, etc.

https://api.thegamesdb.net/Games/ByPlat ... 2Cplatform

In that list is Doom (ID, 4836) has fanart, but the API wont return it.

So it looks like i have answers to my last 2 questions, i need to query the Images API 1000 games at a time to download all the artwork. By my calc thats another 56 calls for the initial DB sync (before we start using update to keep the DB up to date)

56 isn't that bad i guess.

Still looking for feedback on my update logic if anyone has time :-)

Post Reply