Magnitus- / gogcli

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

[Question] Remove other language if prefered exists #27

Open jerry1333 opened 1 month ago

jerry1333 commented 1 month ago

Hello, is there a way to remove downloads from manifest for other languages than preferred?

I'm using gogcli manifest generate --lang=polish --lang=english --os=windows but some games have both languages available and i'm interested in only one (Polish in this example). Can I somehow filter other languages out?

Example for The Witcher 3: Wild Hunt - Complete Edition

D:\gogcli>gogcli manifest search --title="The Witcher 3: Wild Hunt - Complete Edition"
{
  "Games": [
    {
      "Id": 1495134320,
      "Slug": "the_witcher_3_wild_hunt_game_of_the_year_edition_game",
      "Title": "The Witcher 3: Wild Hunt - Complete Edition",
      "CdKey": "",
      "Tags": [],
      "Installers": [
...
  ],
  "EstimatedSize": "185.26 GB",
  "VerifiedSize": 196994462426,
  "Filter": {
    "Titles": [
      "The Witcher 3: Wild Hunt - Complete Edition"
    ],
    "Oses": [
      "windows"
    ],
    "Languages": [
      "polish",
      "english"
    ],
    "Tags": [],
    "Installers": true,
    "Extras": true,
    "ExtraTypes": [],
    "SkipUrls": [
      "^/downloads/the_witcher_3_wild_hunt_game_of_the_year_edition_game/[a-z]{2,2}[0-9]patch[0-9]$"
    ],
    "HasUrls": [],
    "Intersections": []
  },
  "ProtectedFiles": null
}

This would allow to limit download time and size.

Thanks for any tips!

Magnitus- commented 1 month ago

Currently, there is no such feature, though it feels like it wouldn't be too complicated to implement.

However, if the number of games you need this for is relatively small (ie, only a handful of very large games), a feasible workaround would be to add individual installers to the "SkipUrls" field.

If I take the fallout classic entry for example, I have this:

      "Installers": [
        {
          "Languages": [
            "english"
          ],
          "Os": "windows",
          "Url": "/downloads/fallout_classic/en1installer0",
          "Title": "Fallout Classic",
          "Name": "setup_fallout_2.1.0.18.exe",
          "Version": "",
          "Date": "",
          "EstimatedSize": "502 MB",
          "VerifiedSize": 514057080,
          "Checksum": "47b7b3c059d92c0fd6db5881635277ea"
        },
        {
          "Languages": [
            "french"
          ],
          "Os": "windows",
          "Url": "/downloads/fallout_classic/fr1installer1",
          "Title": "Fallout Classic",
          "Name": "setup_fallout_french_2.1.0.18.exe",
          "Version": "",
          "Date": "",
          "EstimatedSize": "500 MB",
          "VerifiedSize": 513017720,
          "Checksum": "12ba5bb0489b5bafb777c8d07717b020"
        },
        {
          "Languages": [
            "spanish"
          ],
          "Os": "windows",
          "Url": "/downloads/fallout_classic/es1installer1",
          "Title": "Fallout Classic",
          "Name": "setup_fallout_spanish_2.1.0.18.exe",
          "Version": "",
          "Date": "",
          "EstimatedSize": "499 MB",
          "VerifiedSize": 511395528,
          "Checksum": "72c07bd7e7ae73cedebdc303aa3a104c"
        }
      ],

Say that I only wanted to keep the French installer and filter out both the English and Spanish installers, then my skip url field would look like that:

"SkipUrls": [
    ...,
    "^/downloads/fallout_classic/en1installer0$",
    "^/downloads/fallout_classic/es1installer1$"
],

I guess currently, those entries would have to be manually added to the manifest as the only existing gogcli command that add entries in the "SkipUrls" field is to skip patches, but adding a separate command to skip a set of languages should be trivial to implement.

Give me a couple of days and I'll do that (add a command to add languages to "SkipUrls") and push a release. I think I've done a couple of improvements on the main branch now that are not in any release tag.

Magnitus- commented 1 month ago

@jerry1333 fyi, using the last release, you can trim languages for a specific game in your manifest like so:

gogcli manifest trim-languages --id <id of your game> --lang french --lang polish ...
jerry1333 commented 1 month ago

Cool, I'll test it soon on next library update. Thanks!