From b1af141b3257b319771649498d4347cc0dd0c769 Mon Sep 17 00:00:00 2001 From: Slashbunny Date: Sat, 12 Oct 2019 09:08:48 -0400 Subject: [PATCH] Version 0.0.3 The number of plugins is already a little too much for my tastes and will probably only get worse as time goes on. To mitigate the problem for now, I split the plugins into different files and will provide 3 different .exe files: Stores, Single Games, and Emulators. This way, if people aren't interested in the latter two options, they can simply not run those programs. --- README.md | 75 +++++++++++++++++++++++++++++++++------------------ build-win.bat | 4 +++ download.py | 30 ++++++++++++++++----- 3 files changed, 76 insertions(+), 33 deletions(-) create mode 100644 build-win.bat diff --git a/README.md b/README.md index 5f5961c..19a9db8 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,11 @@ request it be added to that project _first_. * Download the latest release from the [Releases](https://github.com/Slashbunny/gog-galaxy-plugin-downloader/releases) page. * Extract the zip file anywhere on your PC. -* Double click on `gog-plugins-downloader.exe` to run the program to download or -update your plugins. -* Run regularly to keep your plugins up to date +* Within the zip file, there are 3 programs: + * `gog-plugins-downloader`: Downloads and installs plugins for game stores- Steam, Origin, Uplay, Epic, PSN, BattleNet, and more. + * `gog-plugins-downloader-games`: Downloads and installs plugins for single game launchers- Minecraft, Final Fantasy XIV, Path of Exile, Guild Wars 2, and more. + * `gog-plugins-downloader-emulators`: Downloads and installs plugins for emulators- bSNES, RetroArch, Cemu, Dolphin, Citra, mGBA, and more. +* Run the programs of your choice regularly to keep your plugins up to date This will only work for Windows. If you are using another OS, you will need to follow the Advanced instructions below. @@ -22,71 +24,92 @@ follow the Advanced instructions below. ## Requirements -Install Python 3 on your OS. Clone or [download](https://github.com/Slashbunny/gog-galaxy-plugin-downloader/archive/master.zip), then extract this repository into a directory of your choice. +Install Python 3 on your OS. Clone or [download](https://github.com/Slashbunny/gog-galaxy-plugin-downloader/archive/master.zip), +then extract this repository into a directory of your choice. ## Running the Program Open a command line terminal and navigate to the directory where you downloaded -or cloned this repository. +or cloned this repository. In this example, it was extracted to a folder on the +Desktop. ``` cd Desktop\gog-galaxy-plugin-downloader-master ``` -Install dependencies +Next, install python dependencies: ``` pip install -r requirements.txt ``` -Download plugins to Galaxy's "installed" directory on Windows (`%localappdata\GOG.com\Galaxy\plugins\installed`): +To download Store plugins to Galaxy's "installed" directory on Windows (`%localappdata\GOG.com\Galaxy\plugins\installed`): ``` python download.py ``` -You can also download to a custom directory (Required on non-Windows systems): +### Install Single Game Launcher Plugins ``` -python download.py -d output-folder +python download.py -c https://raw.githubusercontent.com/Slashbunny/gog-galaxy-plugin-downloader/master/plugins-games.yaml ``` -## Custom Plugins +or: -By default the list of plugins comes from the YAML file in this repository. You -can use your own local plugins YAML file like this: +``` +python download.py -c plugins-games.yaml +``` + +### Install Emulator Plugins ``` -python download.py -d output-directory -c plugins.yaml +python download.py -c https://raw.githubusercontent.com/Slashbunny/gog-galaxy-plugin-downloader/master/plugins-emulators.yaml ``` -Or use your own remote plugins YAML file hosted at any URL: +or + +``` +python download.py -c plugins-emulators.yaml +``` + +## Custom Parameters + +### Custom Output Directory + +You can download to a custom directory (This is required on non-Windows systems): ``` -python download.py -d output-directory -c https://www.mydomain.com/gog-plugins.yaml +python download.py -d output-folder ``` -## Building the Executable +For example, on MacOS, to install Store plugins to the default Galaxy plugins folder: -If you want to build the Windows executable, you must follow these steps on -Windows. +``` +python download.py -d "${HOME}/Library/Application Support/GOG.com/Galaxy/plugins/installed/" +``` -First, install pyinstaller: +### Custom Plugins + +You can use your own local plugins YAML file like this: ``` -pip install pyinstaller +python download.py -c plugins.yaml ``` -Then build the executable as follows: +Or use your own remote plugins YAML file hosted at any URL: ``` -pyinstaller download.py -n gog-plugins-downloader --onefile +python download.py -c https://www.mydomain.com/gog-plugins.yaml ``` -`gog-plugins-downloader.exe` will be in the `dist/` subfolder. +## Building the Executables -# Contribute +If you want to build the Windows executables, you can run the following batch +files on a Windows PC: -Open a Merge Request with updates to plugins in `plugins.yaml` so everyone -can benefit +``` +build-win.bat +``` +The `.exe` files will be in the `dist/` subfolder. diff --git a/build-win.bat b/build-win.bat new file mode 100644 index 0000000..788319f --- /dev/null +++ b/build-win.bat @@ -0,0 +1,4 @@ +pip install pyinstaller +pyinstaller download.py -n gog-plugins-downloader --onefile +copy dist\gog-plugins-downloader.exe dist\gog-plugins-downloader-games.exe +copy dist\gog-plugins-downloader.exe dist\gog-plugins-downloader-emulators.exe diff --git a/download.py b/download.py index 50f7373..08adfe5 100755 --- a/download.py +++ b/download.py @@ -3,6 +3,7 @@ import argparse import os import shutil +import sys import tempfile import yaml import zipfile @@ -11,11 +12,11 @@ from urllib.parse import urlparse from urllib.request import urlopen -__version__ = '0.0.2' +__version__ = '0.0.3' -# URL to the plugins.yaml file if one is not supplied by the user -default_plugins = 'https://raw.githubusercontent.com/Slashbunny' \ - '/gog-galaxy-plugin-downloader/master/plugins.yaml' +# Base URL to plugins +plugin_url = 'https://raw.githubusercontent.com/Slashbunny/' \ + 'gog-galaxy-plugin-downloader/master/' def get_plugin_config(config_uri): @@ -154,16 +155,31 @@ def delete_old_plugins(data, dest): # Define script arguments parser = argparse.ArgumentParser( description='GOG Galaxy Plugin Downloader') - parser.add_argument('-c', '--conf', default=default_plugins, - help='Path or URL to plugin configuration YAML file') - # On Windows, default the destination directory argument if os.name == "nt": + # Windows Defaults + + # Plugin config default: Depends on which .exe is being run + if sys.argv[0].endswith('-emulators.exe'): + plugins_file = 'plugins-emulators.yaml' + elif sys.argv[0].endswith('-games.exe'): + plugins_file = 'plugins-games.yaml' + else: + plugins_file = 'plugins.yaml' + + parser.add_argument('-c', '--conf', default=plugin_url + plugins_file, + help='Path/URL to plugin configuration YAML file') + + # Destination default: %LOCALAPPDATA%\GOG.com\Galaxy\plugins\installed\ plugins_dir = os.path.join(os.environ['localappdata'], 'GOG.com', 'Galaxy', 'plugins', 'installed') + parser.add_argument('-d', '--dest', default=plugins_dir, help='Destination directory for plugins') else: + # Non-Windows Defaults + parser.add_argument('-c', '--conf', default=plugin_url + 'plugins.yml', + help='Path/URL to plugin configuration YAML file') parser.add_argument('-d', '--dest', required=True, help='Destination directory for plugins')