diff --git a/README.md b/README.md index 130c77a..cc0d578 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,17 @@ A launcher for a space themed game +This launcher download background music track when running for first time + +All content is saved inside ~/.local/share/asgardius + # Dependencies * python * GTK 3 * VTE 3 +* Pygame for music playback +* wget for updater # Build dependencies * Meson diff --git a/src/main.py b/src/main.py index 8a304ab..a5ea9f2 100755 --- a/src/main.py +++ b/src/main.py @@ -11,7 +11,8 @@ import subprocess gi.require_version('Gtk', '3.0') from gi.repository import GLib, Gtk, Vte import os - +import pygame +from os.path import exists class Application(Gtk.Application): @@ -40,6 +41,14 @@ class Application(Gtk.Application): hbox.pack_start(button, True, True, 0) #window.add(label) window.show_all() + pygame.init() + home = os.path.expanduser("~") + if not exists(home+"/.local/share/asgardius/"): + os.system('mkdir -p '+home+"/.local/share/asgardius/") + if not exists(home+"/.local/share/asgardius/asglauncher.wav"): + os.system('wget -O '+home+'/.local/share/asgardius/asglauncher.wav https://git.asgardius.company/asgardius/midori-school/raw/branch/main/music/crammin.wav') + pygame.mixer.music.load(home+"/.local/share/asgardius/asglauncher.wav") + pygame.mixer.music.play(-1) def on_install_clicked(self, button): home = os.path.expanduser("~") @@ -47,7 +56,7 @@ class Application(Gtk.Application): terminal.spawn_sync( Vte.PtyFlags.DEFAULT, None, - ['/bin/bash', '-c', ' wget https://lily.asgardius.company/r3gamedlx64 -O '+home+'/.asgardius.page.spacedemo && chmod +x '+home+'/.asgardius.page.spacedemo && echo \"Game Installed\"'], + ['/bin/bash', '-c', ' wget https://lily.asgardius.company/r3gamedlx64 -O '+home+'/.local/share/asgardius/asgardius.page.spacedemo && chmod +x '+home+'/.local/share/asgardius/asgardius.page.spacedemo && echo \"Game Installed\"'], None, GLib.SpawnFlags.DEFAULT, ) @@ -59,7 +68,9 @@ class Application(Gtk.Application): def on_play_clicked(self, button): home = os.path.expanduser("~") - subprocess.run([home+'/.asgardius.page.spacedemo']) + pygame.mixer.music.stop() + os.system(home+'/.local/share/asgardius/asgardius.page.spacedemo') + pygame.mixer.music.play(-1) if __name__ == "__main__":