background music
This commit is contained in:
parent
2bc2f05f64
commit
4eed527e50
2 changed files with 20 additions and 3 deletions
|
@ -4,11 +4,17 @@
|
||||||
|
|
||||||
A launcher for a space themed game
|
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
|
# Dependencies
|
||||||
|
|
||||||
* python
|
* python
|
||||||
* GTK 3
|
* GTK 3
|
||||||
* VTE 3
|
* VTE 3
|
||||||
|
* Pygame for music playback
|
||||||
|
* wget for updater
|
||||||
|
|
||||||
# Build dependencies
|
# Build dependencies
|
||||||
* Meson
|
* Meson
|
||||||
|
|
17
src/main.py
17
src/main.py
|
@ -11,7 +11,8 @@ import subprocess
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import GLib, Gtk, Vte
|
from gi.repository import GLib, Gtk, Vte
|
||||||
import os
|
import os
|
||||||
|
import pygame
|
||||||
|
from os.path import exists
|
||||||
|
|
||||||
class Application(Gtk.Application):
|
class Application(Gtk.Application):
|
||||||
|
|
||||||
|
@ -40,6 +41,14 @@ class Application(Gtk.Application):
|
||||||
hbox.pack_start(button, True, True, 0)
|
hbox.pack_start(button, True, True, 0)
|
||||||
#window.add(label)
|
#window.add(label)
|
||||||
window.show_all()
|
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):
|
def on_install_clicked(self, button):
|
||||||
home = os.path.expanduser("~")
|
home = os.path.expanduser("~")
|
||||||
|
@ -47,7 +56,7 @@ class Application(Gtk.Application):
|
||||||
terminal.spawn_sync(
|
terminal.spawn_sync(
|
||||||
Vte.PtyFlags.DEFAULT,
|
Vte.PtyFlags.DEFAULT,
|
||||||
None,
|
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,
|
None,
|
||||||
GLib.SpawnFlags.DEFAULT,
|
GLib.SpawnFlags.DEFAULT,
|
||||||
)
|
)
|
||||||
|
@ -59,7 +68,9 @@ class Application(Gtk.Application):
|
||||||
|
|
||||||
def on_play_clicked(self, button):
|
def on_play_clicked(self, button):
|
||||||
home = os.path.expanduser("~")
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue