Magnitus- / gogcli

Client to Interact With the API of GOG.com
MIT License
40 stars 0 forks source link

Allow inversion of filter #20

Open xKevin04 opened 1 year ago

xKevin04 commented 1 year ago

I use a manifest filtered for English and German windows setups including extras to download my entire library. Additional Languages and OS would only take up space I will never use. However, there are some games that haven't been translated to English or German (or may don't have a Windows version, but I don't know of any). By using my filter, I would miss these completely. In my case, "Kajko i Kokosz" is the only such game. Other examples could be "Anstoss 2 Gold Edition" and "ANSTOSS 3: Der Fußballmanager" which are only available in German, but those of course don't affect me personally.

My current workaround to deal with this problem: I generate a complete unfiltered manifest, then filter it via gogcli search to my preferences and download the big chunk of my games. To catch missed products, I wrote a script that searches the manifest for products that weren't matched by my filter settings at all. I then tag the results on GOG as "FOREIGN", search-filter the full manifest with gogcli again to find only products with that tag, and finally download it in every language and for all OS.

I think it would be neat to offer such a functionality as a native feature in gogcli. Maybe there's a better way to handle this edge case, it was just the best I could come up with in a short time and from what I can tell, it works fine.

Magnitus- commented 1 year ago

From the model, intersections are supported (from the top of my head, I don't recall where it is used exactly though): https://github.com/Magnitus-/gogcli/blob/main/manifest/manifest-filter.go#L17

However, what you are looking for here are unions which currently aren't supported in the model.

I think it probably wouldn't be too difficult to add it to the model, though how to bubble up that functionality to the end-user in a way that is intuitive would require a bit more consideration.

Maybe generating filter files that are separate from the manifest might be the easiest solution.

Edit: I think it would require an extra layer of abstraction in the model to implement composite filters as even intersections appear to be a dangling functionality, but I think it wouldn't be so bad.