AB1908 / GOG-Galaxy-Export-Script

Export your list of games from GOG Galaxy
MIT License
152 stars 27 forks source link

Feature Request: Option to only export installed games #54

Closed TheFiZi closed 2 years ago

TheFiZi commented 2 years ago

Sometimes I only want to export what is installed instead of everything.

That or add an extra column "IsInstalled" with the value TRUE/FALSE and I can filter on that.

TheMelmacian commented 2 years ago

I looked into the database. There are a few tables which deal with installed games. They use the productId instead of the releaseKey but not in a way that allows easy joining. But I think the "PlayTasks" table can be used to determine if a game is installed. If a game is not installed there shouldn't be any play task ;)

@TheFiZi I prepared a version of the script that exports an "isInstalled" flag. Can you please test it and give feedback if it works? https://github.com/TheMelmacian/GOG-Galaxy-Export-Script/blob/test/galaxy_library_export.py For me it shows all the games that the galaxy client recognizes as installed correctly in the export.

The script also contains a few fixes for bugs I recently encountered and a first attempt to make the sql generation (and the sql itself) more readable.

TheFiZi commented 2 years ago

@TheMelmacian It's very very close. I wonder if I need to purge and re-create my GoG Galaxy Database just to clear out some cruft.

GoG Galaxy says I have 956 games and 133 installed.

The export from the script says I have 935 games and 182 are installed.

I suspect the difference between total games could be related to having multiple copies of a game across multiple platforms.

I removed my Humble Bundle and XBox Live integration since I don't really use either of those.

GoG Galaxy now says I have 872 games and 133 installed.

The new export from the script says I have 909 games and 182 installed.

I am going to try purging my GoG Galaxy DB, re-import and see what happens.

TheFiZi commented 2 years ago

So after blowing away my GoG Database and rebuilding it:

GoG says I have 872 games and 128 installed

The export from the script says 848 games and 130 installed.

That's a lot closer.

TheMelmacian commented 2 years ago

Yes, multiple copies of the same game are treated as one by the export script. It's possible that the two additional installed games are dlcs or games not visible in the client but without a look into the database I can only guess.

Sadly the database is a complete mess. A lot of old data is not cleaned properly and often games are imported incorrectly (games as dlc or dlcs as games, different games that are treated as one etc.). Or the game is in the database but marked as notVisibleInLibrary (different from isHidden; the export script currently ignores the notVisible flag).

If you know which are the two additional installed games you could look into the database to figure out why the client and export differ in this case.

AB1908 commented 2 years ago

Yea, I ultimately gave up on using Galaxy since Playnite is open source and does a lot of things better.

TheFiZi commented 2 years ago

Alright, thanks for giving it a shot.

I did try digging through the database before submitting my request and I couldn't make heads or tails of how they kept track of installed games. It felt like a mess to me (novice) as well.

I will checkout Playnite.