Slashbunny / gog-galaxy-plugin-downloader

Downloads and Updates GOG Galaxy 2.0 Plugins/Integrations
GNU General Public License v3.0
268 stars 20 forks source link

Use github API to get plugin version and download link #9

Closed ZeeWanderer closed 4 years ago

ZeeWanderer commented 4 years ago

Consider using "https://api.github.com/repos/${repo}/releases/latest", where ${repo}, for example, is "Slashbunny/gog-galaxy-plugin-downloader", to get latest releases of any plugin that is hosted on github. That would remove the necessity of manual updates at the cost of automatic version lock file and some reliability. So far determining right asset seems simple: there is either only one or it has "win" somewhere in file name.

Also: I do not need all the plugins and provided 'batches' are also not suitable which means i have to keep and manually update my own plugins file which is bothersome. Consider adding an ability to specify only plugin names.

tylerbrawl commented 4 years ago

This is a great idea, both for developers (particularly point 1) and users (particularly point 2). I would personally love to be able to choose which plugins are downloaded.

Slashbunny commented 4 years ago

1) That makes sense. Some plugins don't have releases and some plugins aren't on Github, but I suppose we can just have a few different strategies to deal with the different scenarios.

"Detecting" the proper release may be tricky. Some don't mention win or anything and some have the version as part of the name and some have the sha1 hash of the last commit in the name of the file (ie twitch_8b831aed-dd5f-c0c5-c843-41f9751f67a2_v0.5_win32.zip - although that does have win in it and it's the only artifact on the release.. so it doesn't matter). Perhaps some basic pattern matching as part of the configuration of the plugin would be enough to handle all edge cases.

I'll have to try a few things out and see what works. Another option may to make a separate script to do this- Basically a script that does what you are describing, and outputs a complete plugins.yml. That will make it just as reliable as it is now without the overhead of manually having to update it or users having to hit a bunch of Github endpoints to check for the latest version every invocation.

2) I was going to do this, but didn't get around to it yet. I was also struggling with how to implement it for Windows users that just want to run an .exe file from their desktop without having to craft some "selection" UI for them. As a workaround, I created the the separate executables that run different "batches" for Windows users, but it's definitely not ideal. I'll add a filter option regardless for CLI users.

Slashbunny commented 4 years ago

I added a new version with the ability to filter the plugins that are downloaded. On Windows, it'd just be something like this:

> gog-plugins-downloader.exe -p battlenet,bethesda,epic,gw2,humblebundle,minecraft,origin,paradox,psn,rockstar,steam,twitch,uplay,wargaming

Plugins can be listed like so:

> gog-plugins-downloader.exe -l
Available plugins:
battlenet [default]
bethesda [default]
epic [default]
humblebundle [default]
origin [default]
paradox [default]
psn [default]
rockstar [default]
steam [default]
uplay [default]
discord
itch
twitch
wargaming
ffxiv
gw2
minecraft
poe
thcrap
3ds
n64
nds
nes
ngameboy
ncube
nwii
nwiiu
snes
psp
ps2
ps3
Slashbunny commented 4 years ago

I added a script to parse FriendsOfGalaxy's main configuration file, then find the latest version of each plugin, similar to what the Galaxy client does (I assume). It then updates plugins.yaml for clients using this tool: https://github.com/Slashbunny/gog-galaxy-plugin-downloader/commit/b8b22cdb2b0fe9dc2235c80f80623604547af7e7

The non-FriendsOfGalaxy plugins often do not have releases or their release versions do not match the version defined in manifest.json, which makes it a pain to make a clean, generalized solution. The "good" news is these are rarely updated and/or unmaintained, so it is acceptable to manually update them for the time being, IMO.

For this reason (and the fact the GOG Galaxy client already accomplishes what this script does for 99% of the userbase and I personally do not even use it anymore except to pull in the twitch plugin), I am going to close this enhancement.