NintendoClients
NintendoClients copied to clipboard
Automatic title version detection
Currently, the latest title version is hardcoded in games.py and must be updated manually whenever an update is released.
It would be nice if we could automate this. Maybe a bot can create a pull request whenever an update is released. I don't want to use my own client certificate though.
Maybe someone keeps a public database of Switch titles. If yes, check if it's good. Is it reasonably up to date?
Is it viable to pull the latest version during runtime? I'm pretty sure that data is on the eShop API. I did some work a super long time ago with the eShop API (https://github.com/RedDuckss/NXUI/blob/master/title_metadata.js), the eShop certificate is common between consoles. But I'm pretty sure the eShop API requires authentication now
However there is a publicly maintained list of Switch title info which seems to scrape its data from the eShop website; https://github.com/blawar/titledb
It has a versions.json file which contains every version released for every Switch game with the date the update was released. It seems to be very well maintained, being updated every day (probably automated) but if you use this then you're relying on blawar to keep it up to date, so getting the data yourself might be better in the long run
I've written a bot that sends me an email whenever a title is updated. Still need to update games.py manually, but at least I'm notified of updates immediately now.
I think I want to redesign games.py at some point anyway. Very few games are defined right now and everything is hardcoded. Maybe some kind of database-like approach would be better?
Idea to think about: games.find_title_by_id(...)
returns a Game
object that defines attributes such as the latest title version, game server id and access key. If possible, the database behind such a function would be updated (semi-)automatically.
I know a lot of data about a title can be gotten automatically but the access key will be the hardest part since afaik there's no real way to get that without physically having each game
This is able to check A GitHub repo for game updates, perhaps some implementation of what you want to do here is possible using the same method?
edit: it seems to just check title versions from a github repo… not Nintendo servers
import requests
def download_versions():
url = "https://raw.githubusercontent.com/16BitWonder/nx-versions/master/versions.txt"
r = requests.get(url, allow_redirects=True)
print(r.content)
txt = open('versions.txt', 'wb')
output = txt.write(r.content)
txt.close()
download_versions()
This should download everything (I made it a definition so it should be callable)
I removed games.py because it was incomplete and hard to maintain. If we want to keep a database of games I would probably do it in a different repository.