I need a little more clarification around updates
Posted: 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
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)