closes #4757
i haven't tested this thoroughly, but at first glance it works
…
Reloading of the library also magically works, even though i haven't implemented any function to use the `force_load=True` on `get_collected_games()`. Someone more knowledgeable about the codebase please help.
<details>
<summary>screenshot and api json the data from the screenshot is coming from</summary>

i haven't bought any games on itch.io yet, so this would probably also need to be tested by someone with a more versatile itch.io library
this is my `https://api.itch.io/profile/collections`:
```json
{
"collections": [
{
"updated_at": "2024-07-30T18:10:02.000000000Z",
"title": "my collection",
"created_at": "2023-09-04T14:55:32.000000000Z",
"games_count": 5,
"id": 3614632
}
]
}
```
as you see, i only have one collection, so lutris uses that one
if I had more collections, lutris would the first collection called "lutris", if there is none it wouldn't use any collections
this is my `https://api.itch.io/collections/3614632/collection-games`:
```json
{
"page": 1,
"per_page": 100,
"collection_games": [
{
"game": {
"id": 2840340,
"traits": [
"p_windows",
"p_linux",
"p_osx",
"can_be_bought"
],
"type": "default",
"url": "https://vividev.itch.io/kiosk",
"title": "Kiosk",
"published_at": "2024-07-22T12:34:53.000000000Z",
"created_at": "2024-07-18T17:26:32.000000000Z",
"classification": "game",
"short_text": "Short horror experience in a fast food kiosk",
"cover_url": "https://img.itch.zone/aW1nLzE3MDI4MDY4LnBuZw==/315x250%23c/Hkkkc9.png",
"min_price": 0
},
"created_at": "2024-07-30T18:10:02.000000000Z",
"user_id": 8767225,
"blurb": null,
"position": 5
},
{
"game": {
"still_cover_url": "https://img.itch.zone/aW1hZ2UvMjA2MTE0Lzk3MzA0OC5naWY=/315x250%23cm/NuyrK7.gif",
"id": 206114,
"traits": [
"p_windows",
"p_osx"
],
"short_text": "A basketball themed visual novel and dating sim with stat management!",
"url": "https://intothehoop.itch.io/demo",
"title": "Into The Hoop Demo",
"published_at": "2017-12-14T14:08:22.000000000Z",
"created_at": "2017-12-14T11:53:48.000000000Z",
"type": "default",
"classification": "game",
"cover_url": "https://img.itch.zone/aW1hZ2UvMjA2MTE0Lzk3MzA0OC5naWY=/315x250%23c/5J8k0f.gif",
"min_price": 0
},
"created_at": "2024-07-30T15:07:08.000000000Z",
"user_id": 8767225,
"blurb": null,
"position": 4
},
{
"game": {
"embed": {
"height": 685,
"fullscreen": false,
"width": 960
},
"still_cover_url": "https://img.itch.zone/aW1hZ2UvMTgzMTY1Lzg2MTUzNC5naWY=/315x250%23cm/qnXs09.gif",
"id": 183165,
"url": "https://zephyo.itch.io/hi-no-homo",
"short_text": "realistic simulator of awkward people saying hi",
"traits": {},
"title": "hi no homo",
"published_at": "2017-10-15T17:55:16.000000000Z",
"created_at": "2017-10-10T21:57:55.000000000Z",
"type": "html",
"classification": "game",
"cover_url": "https://img.itch.zone/aW1hZ2UvMTgzMTY1Lzg2MTUzNC5naWY=/315x250%23c/tDaRZE.gif",
"min_price": 0
},
"created_at": "2023-11-19T01:36:48.000000000Z",
"user_id": 8767225,
"blurb": null,
"position": 3
},
{
"game": {
"still_cover_url": "https://img.itch.zone/aW1nLzIxNTI3NTAuZ2lm/315x250%23cm/b1m9g%2F.gif",
"id": 415035,
"traits": [
"p_windows",
"p_linux",
"p_osx",
"can_be_bought"
],
"short_text": "‘goth gf’s iPhone’ airdrops you - accept or decline? A love/horror story about life, death, & memes.",
"url": "https://zephyo.itch.io/missed-message",
"title": "missed messages.",
"published_at": "2019-05-01T05:44:05.000000000Z",
"created_at": "2019-04-30T00:55:09.000000000Z",
"type": "default",
"classification": "game",
"cover_url": "https://img.itch.zone/aW1nLzIxNTI3NTAuZ2lm/315x250%23c/JW5rGE.gif",
"min_price": 0
},
"created_at": "2023-11-19T01:35:28.000000000Z",
"user_id": 8767225,
"blurb": null,
"position": 2
},
{
"game": {
"still_cover_url": "https://img.itch.zone/aW1hZ2UvMTA2NTk5LzU4NjAxMi5naWY=/315x250%23cm/PKts8V.gif",
"id": 106599,
"traits": [
"p_windows",
"p_linux",
"p_osx",
"can_be_bought",
"in_press_system"
],
"short_text": "Will you write the way into her heart?",
"url": "https://teamsalvato.itch.io/ddlc",
"title": "Doki Doki Literature Club!",
"published_at": "2017-09-22T16:53:10.000000000Z",
"created_at": "2016-12-17T15:34:50.000000000Z",
"type": "default",
"classification": "game",
"cover_url": "https://img.itch.zone/aW1hZ2UvMTA2NTk5LzU4NjAxMi5naWY=/315x250%23c/ZFe38m.gif",
"min_price": 0
},
"created_at": "2023-09-04T14:55:32.000000000Z",
"user_id": 8767225,
"blurb": null,
"position": 1
}
]
}
```
If you compare this json with the above screenshot, you may notice that "hi no homo" is not shown in the screenshot. This is because there aren't any supported platforms for that game.
</details>
Things still to do (i think):
- [x] Testing
- [x] no collections
- [x] only one collection
- [x] multiple collections, none with the title `"lutris"`
- [x] multiple collections, one with the title `"lutris"`
- [x] mutliple collections with the title `"lutris"` (which collection is chosen is kinda random, maybe we should sort the result by some metric before choosing one)
- [x] combination of collections and bought games
- I don't know what will happen if games are bought and in a collection, will they be shown multiple times?
- maybe its necessary to remove duplicates (prefering games with `download_key_id`s)
- [x] installation of non-buyable (free as in price/gratis) game
- [x] installation of buyable game that costs 0
- [x] installation of unbought game in collection ⇾ it asks for the installation file
- [x] find out why reloading works magically ~~(this might be a bug)~~
Also, is it ok that I committed the `flake.nix` I created for development?
You might not want the repository clutter, but it may help other contributors that also use Nix.