luxtorpeda-dev/luxtorpeda

Add configurable user-packages.json

JoshuaFern opened this issue · 2 comments

Is your feature request related to a problem? Please describe.
Sometimes I want to edit packages.json, but every time it updates I lose my changes. I can disable updates but then I have to apply updates manually.

Describe the solution you'd like
An additional "user-packages.json" so that we can make our own changes in addition to having updates enabled on Luxtorpeda's cached packages.json.

I propose the following error handling:
Duplicate AppID conflict? Prefer from user-packages.json
Invalid user-packages.json? Alert user with a zenity popup.

I also propose a new directory ~/.config/luxtorpeda that contains user-packages.json and config.json

Additional context
I often use Luxtorpeda as an easy way to change a game's launch executable, which this would be useful for. It could also allow the user to define games to run under a certain engine, like picking dosbox or scummvm - or as a development tool to test new engines.

May also be related to this discussion as well: #64

Added this in 50a8dc1

Will be in version 25

Below is an example of what the ~/.config/luxtorpeda/user-packages.json looks like. It has the same syntax as the normal packages.json, and you can set a default that'll override what's in the default of the normal one.

When the client runs, it'll check to see if this file exists. If it does and there's an error, it'll stop and display a zenity error. If an app id is found in the user-packages.json file, it'll use that.

{
    "9050": {
        "game_name": "DOOM 3",
        "download": [
            {
                "name": "dhewm3",
                "url": "https://github.com/luxtorpeda-dev/packages/releases/download/dhewm3-38/",
                "file": "dhewm3-common-38.tar.xz",
                "cache_by_name": true
            }
        ],
        "command": "./run-dhewm3.sh",
        "information": {
            "store_link": "https://store.steampowered.com/app/9050/",
            "engine_name": "dhewm3",
            "engine_link": "https://dhewm3.org/",
            "version": "1.5.1",
            "comments": "",
            "author": "d10sfan",
            "author_link": "https://github.com/d10sfan",
            "license": "GPLv3",
            "license_link": "https://github.com/dhewm/dhewm3/blob/master/COPYING.txt"
        }
    },
    "default": {
        "game_name": "Default",
        "download": [
            {
                "name": "scummvm",
                "url": "https://github.com/luxtorpeda-dev/packages/releases/download/scummvm-3/",
                "file": "scummvm-common-3.tar.xz",
                "cache_by_name": true
            },
            {
                "name": "residualvm",
                "url": "https://github.com/luxtorpeda-dev/packages/releases/download/residualvm-2/",
                "file": "residualvm-common-2.tar.xz",
                "cache_by_name": true
            },
            {
                "name": "dosbox-staging",
                "url": "https://github.com/luxtorpeda-dev/packages/releases/download/dosbox-staging-4/",
                "file": "dosbox-staging-common-4.tar.xz",
                "cache_by_name": true
            }
        ],
        "download_config": {
            "scummvm": {
                "extract_location": "./scum"
            }
        },
        "choices": [
            {
                "name": "scummvm",
                "command": "./scum/run-scummvm.sh",
                "download": [
                    "scummvm"
                ]
            }
        ],
        "information": [
            {
                "store_link": "https://store.steampowered.com/curator/35667778/",
                "engine_name": "scummvm",
                "engine_link": "https://github.com/scummvm/scummvm",
                "version": "2.2.0",
                "comments": "",
                "author": "d10sfan",
                "author_link": "https://github.com/d10sfan",
                "license": "GPLv2",
                "license_link": "https://github.com/scummvm/scummvm/blob/master/COPYING"
            }
        ]
    }
}