Skip to content

Commit

Permalink
.thunder files!
Browse files Browse the repository at this point in the history
  • Loading branch information
hadcl4 committed May 20, 2022
1 parent 6bd5b3f commit 795c339
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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:

Expand Down
39 changes: 39 additions & 0 deletions read.py
Original file line number Diff line number Diff line change
@@ -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")
10 changes: 9 additions & 1 deletion thunder-cli
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -263,3 +268,6 @@ fi
if [[ "$1" == "--clear-cache" ]]; then
--clear-cache
fi
if [[ "$1" == "--run" ]]; then
--run "$@"
fi
4 changes: 4 additions & 0 deletions updater
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 795c339

Please sign in to comment.