diff --git a/CLI.md b/CLI.md index 3365f58..0d24210 100644 --- a/CLI.md +++ b/CLI.md @@ -22,6 +22,8 @@ This will list off all of `thunder-cli`'s functions. In this section we'll go ov > --addgame +> --run + ### `--gui` Launch Thunder's graphical user interface (X11 or Wayland required). ### `--setup` @@ -36,6 +38,8 @@ Get a list of commands to use with `thunder-cli`. View Thunder's version. ### `--addgame` Add a game to Thunder's library (only affects gui). +### `--run` +Run a `.thunder` file. A `.thunder` file is basically an entry to the configuration file used in `thunder-cli --addgame`, however only one game can be stored in a `.thunder` file. The main difference is that, instead of a section being referred to by a number (like `[15]`), `.thunder` files begin with `[Game]`. Other than that, everything else is the same. ## Advanced Features This section will go over more advanced features: diff --git a/read.py b/read.py new file mode 100644 index 0000000..b1d107a --- /dev/null +++ b/read.py @@ -0,0 +1,39 @@ +import sys +import configparser +from guizero import * +import subprocess +from PIL import Image + +argv = sys.argv +argc = len(sys.argv) + +if argc == 2: + configur = configparser.ConfigParser() + configur.read(argv[1]) + name = configur.get("Game","NM") + exec = configur.get("Game","ID") + icon = configur.get("Game","CV") + runner = configur.get("Game","RN") + def gamerun(): + if runner == "linux": + command = f''+exec + if runner == "wine": + command = f'wine '+exec + if runner == "steam": + command = f'steam steam://rungameid/'+exec + if runner == "browser": + command = f'x-www-browser '+exec + if runner == "flatpak": + command = f'flatpak run '+exec + if runner == "mednafen": + command = f'mednafen '+exec + process = subprocess.Popen(command, stderr=True, stdout=True, shell=True) + app = App(title="Thunder - "+name, width=600,bg="white") + app.icon = icon + PushButton(app,text="Run Game...",command=gamerun,align="bottom") + cover = Image.open(icon) + cover_pic = Picture(app, image=cover, align="top", height=308, width=220) + Text(app, text=name) + Text(app, text="Platform: "+runner) + app.display() + print("\n") diff --git a/thunder-cli b/thunder-cli index 07c6e0c..9b86646 100755 --- a/thunder-cli +++ b/thunder-cli @@ -22,10 +22,11 @@ function --help { echo "thunder-cli --update | Update Thunder (both GUI and CLI)" echo "thunder-cli --dev | Enter devmode" echo "thunder-cli --clear-cache | Clear web browser cache" + echo "thunder-cli --run | Run a .thunder file" } function --version { - echo "STABLE v1.1.1" + echo "STABLE v1.1.2" } function --gui { @@ -206,6 +207,10 @@ function --clear-cache { rm -rf ${HOME}/.cache/viewdoc } +function --run { + python3 ${HOME}/Thunder/read.py $2 +} + if [[ "$1" == "--help" ]] ;then --help fi @@ -263,3 +268,6 @@ fi if [[ "$1" == "--clear-cache" ]]; then --clear-cache fi +if [[ "$1" == "--run" ]]; then + --run "$@" +fi diff --git a/updater b/updater index 6419b67..f496064 100644 --- a/updater +++ b/updater @@ -55,5 +55,9 @@ if [[ $thunderversion == "STABLE v1.1.0" ]]; then echo "Updating thunder-cli..." sudo cp thunder-cli /usr/local/bin/thunder-cli fi +if [[ $thunderversion == "STABLE v1.1.1" ]]; then +echo "Updating thunder-cli..." +sudo cp thunder-cli /usr/local/bin/thunder-cli +fi echo "Closing in 10 seconds. Please reopen Thunder for changes to take effect." sleep 10s