Sude- / lgogdownloader

LGOGDownloader is unofficial downloader to GOG.com for Linux users. It uses the same API as the official GOG Galaxy.
https://sites.google.com/site/gogdownloader/
Do What The F*ck You Want To Public License
715 stars 67 forks source link

[Feature request] Sort downloaded games into folders based on OS #143

Open buhund opened 5 years ago

buhund commented 5 years ago

Much like the downloader currently will create folders based for extras, DLC and patches, I would really love for it to be able to automatically sort downloads into folders for each OS.

Since the downloader can detect and do this for extras, DLC and patches, I assume it would be possible to do so for OS. If it's doable, and not too much of a hassle, I would really love it if you were able to have a look at it :)

E.g.

pillars_of_eternity_ii_deadfire
│
└───linux
│   │   file01.sh
│   │   file02.sh
│   │
│   └───patches / extras / dlc / etc
│       │   file1.sh
│       
└───macos
│   │   file01.pkg
│   │   file02.pkg
│   │
│   └───patches / extras / dlc / etc
│       │   file1.sh
│       
└───windows
    │   file01.exe
    │   file02.bin
    │
    └───patches / extras / dlc / etc
        │   file1.sh      
Sude- commented 5 years ago

You can use various --subdir- options to alter the directory structure. The --subdir- options also allow you to use templates (%platform%, %gamename% and %dlcname%)

--subdir-game "%gamename%/%platform%" should give you a directory structure that is similar to your example.

If a file doesn't have platform set to some value then the downloader will replace %platform% with no_platform. This is a special case of "%gamename%/%platform%" due to some problems it caused previously. This mostly affects extras so the directory structure might become something like this:

pillars_of_eternity_ii_deadfire
│
└───linux
│   │   file01.sh
│   │   file02.sh
│   │
│   └───patches / dlc / etc
│       │   file1.sh
│       
└───mac
│   │   file01.pkg
│   │   file02.pkg
│   │
│   └───patches / dlc / etc
│       │   file1.sh
│       
└───no_platform
│   │   file01_without_platform.ext
│   │   file02_without_platform.ext
│   │
│   └───extras
│       │   file1.ext
│       
└───windows
    │   file01.exe
    │   file02.bin
    │
    └───patches / dlc / etc
        │   file1.sh

For any other case where platform is not set it will just be replaced with empty string.

buhund commented 5 years ago

Oh, nice! I saw the subdir lines in the config and actually wondered if they might be used for this purpose.

So I just changed line 27 of the config from subdir-game = %gamename% to subdir-game = %gamename%/%platform% and set it to run, and so far the downloads seems to sort themselves out as I wanted :)

Great that it pops extras in a directory of its own. Was about to amend a question about sorting those outside platform/ to my post before I saw you'd replied.

Really excellent tool btw, thanks so much for making it.