background music

This commit is contained in:
Page Asgardius 2024-01-25 19:03:17 -07:00
parent 2bc2f05f64
commit 4eed527e50
2 changed files with 20 additions and 3 deletions

View file

@ -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

View file

@ -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__":