almost-stable-V2.0
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,6 +6,19 @@ RootScreen:
|
|||||||
###########
|
###########
|
||||||
# POPUPS
|
# POPUPS
|
||||||
###########
|
###########
|
||||||
|
<AppQuitting>:
|
||||||
|
title: "App is quitting"
|
||||||
|
auto_dismiss: False
|
||||||
|
GridLayout:
|
||||||
|
cols: 1
|
||||||
|
Label:
|
||||||
|
text: "App is closing remaining processes..."
|
||||||
|
font_size: 30
|
||||||
|
Label:
|
||||||
|
text: "Please wait..."
|
||||||
|
font_size: 20
|
||||||
|
|
||||||
|
|
||||||
<ConnectPU>:
|
<ConnectPU>:
|
||||||
title: "Connect to Server"
|
title: "Connect to Server"
|
||||||
auto_dismiss: False
|
auto_dismiss: False
|
||||||
@@ -21,10 +34,16 @@ RootScreen:
|
|||||||
text: ""
|
text: ""
|
||||||
id: url
|
id: url
|
||||||
hint_text: "Enter Server-IP"
|
hint_text: "Enter Server-IP"
|
||||||
|
GridLayout:
|
||||||
|
cols: 2
|
||||||
Button:
|
Button:
|
||||||
text: "Connect"
|
text: "Connect"
|
||||||
on_release:
|
on_release:
|
||||||
root.tryconnect()
|
root.tryconnect()
|
||||||
|
Button:
|
||||||
|
text: "Cancel"
|
||||||
|
on_release:
|
||||||
|
root.dismiss()
|
||||||
|
|
||||||
|
|
||||||
<QuitPU>:
|
<QuitPU>:
|
||||||
@@ -43,6 +62,7 @@ RootScreen:
|
|||||||
text: "Yes"
|
text: "Yes"
|
||||||
font_size: 15
|
font_size: 15
|
||||||
on_release:
|
on_release:
|
||||||
|
root.quitapp()
|
||||||
app.stop()
|
app.stop()
|
||||||
Button:
|
Button:
|
||||||
text: "No"
|
text: "No"
|
||||||
@@ -107,6 +127,24 @@ RootScreen:
|
|||||||
on_release:
|
on_release:
|
||||||
root.dismiss()
|
root.dismiss()
|
||||||
|
|
||||||
|
<NotConnected>:
|
||||||
|
title: "NOTICE!"
|
||||||
|
font_size: 50
|
||||||
|
size_hint: 0.5, 0.4
|
||||||
|
auto_dismiss: False
|
||||||
|
GridLayout:
|
||||||
|
cols:1
|
||||||
|
Label:
|
||||||
|
text: "You are not connected to a server!"
|
||||||
|
font_size: 18
|
||||||
|
Label:
|
||||||
|
text: "Therefore this function is not available!"
|
||||||
|
font_size: 15
|
||||||
|
Button:
|
||||||
|
text:"Ok"
|
||||||
|
on_release:
|
||||||
|
root.dismiss()
|
||||||
|
|
||||||
<LeavePU>:
|
<LeavePU>:
|
||||||
title: "DISABLE FULLSCREEN AND LEAVE"
|
title: "DISABLE FULLSCREEN AND LEAVE"
|
||||||
font_size: 50
|
font_size: 50
|
||||||
@@ -161,7 +199,7 @@ RootScreen:
|
|||||||
pos_hint: {"x":0.2, "y":0.5}
|
pos_hint: {"x":0.2, "y":0.5}
|
||||||
size_hint_x: 0.6
|
size_hint_x: 0.6
|
||||||
focus: True
|
focus: True
|
||||||
text: ""
|
text: "/mnt/storage/SORTED/Music"
|
||||||
on_text:
|
on_text:
|
||||||
root.autocomplete()
|
root.autocomplete()
|
||||||
on_text_validate:
|
on_text_validate:
|
||||||
@@ -173,7 +211,7 @@ RootScreen:
|
|||||||
text_size: self.size
|
text_size: self.size
|
||||||
id: cmd_output
|
id: cmd_output
|
||||||
GridLayout:
|
GridLayout:
|
||||||
cols: 2
|
cols: 3
|
||||||
Button:
|
Button:
|
||||||
text: "Start"
|
text: "Start"
|
||||||
color: app.theme_cls.primary_color
|
color: app.theme_cls.primary_color
|
||||||
@@ -182,6 +220,14 @@ RootScreen:
|
|||||||
background_color: app.theme_cls.accent_dark
|
background_color: app.theme_cls.accent_dark
|
||||||
on_release:
|
on_release:
|
||||||
root.change_screen()
|
root.change_screen()
|
||||||
|
Button:
|
||||||
|
text: "Connect to Server"
|
||||||
|
color: app.theme_cls.primary_color
|
||||||
|
font_size: 30
|
||||||
|
bold: True
|
||||||
|
background_color: app.theme_cls.accent_dark
|
||||||
|
on_release:
|
||||||
|
root.connectServer()
|
||||||
Button:
|
Button:
|
||||||
text: "Quit"
|
text: "Quit"
|
||||||
color: app.theme_cls.primary_color
|
color: app.theme_cls.primary_color
|
||||||
@@ -246,16 +292,21 @@ RootScreen:
|
|||||||
on_release:
|
on_release:
|
||||||
root.go_back()
|
root.go_back()
|
||||||
Button:
|
Button:
|
||||||
text: "Connect to Server"
|
text: "Fullscreen on client\n(Only available if connected)"
|
||||||
|
id: fullscreenc
|
||||||
background_color: app.theme_cls.accent_dark
|
background_color: app.theme_cls.accent_dark
|
||||||
on_release:
|
on_release:
|
||||||
root.connectToServer()
|
root.changeServerSettings()
|
||||||
Button:
|
Button:
|
||||||
text: "Showcase"
|
text: "Showcase"
|
||||||
background_color: app.theme_cls.accent_dark
|
background_color: app.theme_cls.accent_dark
|
||||||
on_release:
|
on_release:
|
||||||
app.root.current = "Showcase"
|
app.root.current = "Showcase"
|
||||||
root.manager.transition.direction = "left"
|
root.manager.transition.direction = "left"
|
||||||
|
Label:
|
||||||
|
text: "Test"
|
||||||
|
id: connectstatus
|
||||||
|
pos_hint: {"y": -0.45}
|
||||||
|
|
||||||
<ShowcaseS>:
|
<ShowcaseS>:
|
||||||
on_pre_enter: root.reset()
|
on_pre_enter: root.reset()
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ class Player:
|
|||||||
|
|
||||||
def start_playing(self):
|
def start_playing(self):
|
||||||
# initialize playing
|
# initialize playing
|
||||||
|
print("starting player")
|
||||||
if pygame.get_init() == True:
|
if pygame.get_init() == True:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
pygame.init()
|
|
||||||
self.path = cvr.importing("./data/temp.csv").pop(0)
|
self.path = cvr.importing("./data/temp.csv").pop(0)
|
||||||
self.pathtr = self.path.pop(0)
|
self.pathtr = self.path.pop(0)
|
||||||
self.__imports = pa.validsonglistcreator(self.pathtr)
|
self.__imports = pa.validsonglistcreator(self.pathtr)
|
||||||
@@ -135,4 +135,4 @@ class Player:
|
|||||||
self.infoupdater()
|
self.infoupdater()
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
time.sleep(0.25)
|
time.sleep(0.2)
|
||||||
|
|||||||
@@ -39,10 +39,24 @@ class ServerComs:
|
|||||||
except Exception:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def postfullscreen(self, url, data):
|
def changefullscreen(self, url):
|
||||||
try:
|
try:
|
||||||
self.x = requests.post(f"{url}/postfullscreen", {"fullscreen":data})
|
self.x = requests.get(f"{url}/changefullscreen")
|
||||||
return True
|
return True
|
||||||
except Exception:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def getfullscreeninfo(self, url):
|
||||||
|
try:
|
||||||
|
self.x = requests.get(f"{url}/changefullscreen")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return self.x.text
|
||||||
|
|
||||||
|
def poststatus(self, url, isalive):
|
||||||
|
print("updating status")
|
||||||
|
try:
|
||||||
|
self.x = requests.post(f"{url}/poststatus", {"status":f"{isalive}"})
|
||||||
|
return True
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0,songlist.csv
|
1,songlist.csv
|
||||||
|
|||||||
|
@@ -1,3 +1,3 @@
|
|||||||
9
|
0
|
||||||
Tennessee Waltz - New 101 Strings Orchestra | Slow Walz (Langsam),Morning has broken - Cat Stevens | Walzer (Mittel),Magia - Alvaro Soler | Flashmob (Mittel),Say So - Doja Cat | Discofox (Langsam),Save Your Tears (Remix) - The Weeknd & Ariana Grande | Discofox (Langsam),Shivers - Ed Sheeran | Jive/ Rocknroll (Mittel),I feel good - Ray Charles | Jive/Rocknroll (Mittel),Muevelo - Rey Ruiz | Cha cha cha (Mittel),Suelta la cintura - Ruben leon | Cha cha cha (Mittel),Como Volver a Ser Feliz - Luis Enrique | Salsa (Mittel),Mas que nada - black eyed peas | Salsa/Discofox (Mittel),Moon River - Henry Mancini | Slow Walz (Langsam),Dancing Queen - ABBA | Discofox (Langsam),Don't Call Me Up - Mabel | Discofox (Mittel),Magia - Alvaro Soler | Flashmob (Mittel),Lets have a Party - Wanda Jackson | Jive (mittel),Crazy Little Thing Called Love - Queen | Jive / Rocknroll (Schnell),El Diablo Anda Suelto - Rey Ruiz | Cha cha cha (Mittel),Lets get loud - Jennifer Lopez | Cha cha cha (Schnell),Enamorame - Somos del Barrio | Salsa (Mittel),Something Stupid (feat. Reese Witherspoon) - Michael Bublé | Rumba/cha cha cha (Langsam),When a man loves a woman - Percy Sledge | (Langsam),Scharlachrot - Patent Ochsner | Walzer (Langsam),Ily (i love you baby) [feat. Emilee] - Surf Mesa | Discofox (Mittel),Like a sex machine - James Brown | Discofox (Mittel),Uptown Funk (feat. Bruno Mars) - Discofox | Discofox (Schnell),Tutti Frutti - Little Richard | Jive / Rocknroll (Mittel),Jailhouse Rock - Elvis Presley | Jive / Rocknroll (Schnell),Are you lonesome - Elvis Presley | Slow Walz (Langsam),Ay Mujer - Rey Ruiz | Cha cha cha (Mittel),Rico Vacilon - Pedro Garcia & His Del Prado Orchestra | Cha cha cha (Mittel),Jeepers creepers - Benny Goodmann | Foxtrott (Mittel),An der schönen blauen Donau - New 101 Strings Orchestra | Wiener Walzer (Schnell),The Last Waltz - Engelbert Humperdinck | Walzer (Mittel),Stand by me - Sam Brown | Cha cha cha (Lansam),Stayin' Alive - Bee Gees | Discofox (Mittel),Easy On Me - Adele | (Langsam),Magia - Alvaro Soler | Flashmob (Mittel),Friday (feat. Mufasa & Hypeman) [Dopamine Re-Edit] - Riton & Nightcrawlers | Party (Mittel),YMCA - Village People | Party (Mittel),Cotton eyed Joe (Hennustall zermatt mix) - Rednex | Party (Mittel),Gangnam style - PSY | Party (Mittel),Take On Me - a-ha | Jive (Schnell),Rock Around the Clock - Bill Haley & His Comets | Jive / Rocknroll (Schnell),Satisfaction - Rolling Stones | Party (Mittel),"Un, dos, tres - Ricky Martin | Party (Mittel)",Party Rock anthem - LFMBQ | Party (Mittel),I don't care - Icona Pop | Party (Mittel),Love tonight - Shouse & David Guetta | Party (Mittel),Insomnia - Faithless | Party (Mittel),Angels - Robbie Williams | Slow (Langsam),Nothing compares to you - Sinead O'Connor | Slow (Langsam)
|
Lupus Nocte - Hadouken (Royalty Free Music).mp3,Minecraft OST - Pigstep.mp3,The Day You Went Away.mp3,sha la la.mp3
|
||||||
251.97134399414062
|
163.7987518310547
|
||||||
|
|||||||
|
@@ -1 +1 @@
|
|||||||
/mnt/storage/SORTED/Music/
|
/mnt/storage/SORTED/Music
|
||||||
|
|||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
from audioop import add
|
||||||
import os
|
import os
|
||||||
import configparser
|
import configparser
|
||||||
|
|
||||||
@@ -45,8 +46,13 @@ address = ""
|
|||||||
# Popups
|
# Popups
|
||||||
###########
|
###########
|
||||||
|
|
||||||
|
class AppQuitting(Popup):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConnectPU(Popup):
|
class ConnectPU(Popup):
|
||||||
def tryconnect(self):
|
def tryconnect(self):
|
||||||
|
print("trying to connect")
|
||||||
self.url = self.ids.url.text
|
self.url = self.ids.url.text
|
||||||
self.containsPort = False
|
self.containsPort = False
|
||||||
for self.letter in self.url:
|
for self.letter in self.url:
|
||||||
@@ -57,20 +63,26 @@ class ConnectPU(Popup):
|
|||||||
self.connectionurl = ""
|
self.connectionurl = ""
|
||||||
if self.url[:8] != "https://" and self.url[:7] != "http://" and self.url[len(self.url) - 1:] == "/" and not self.containsPort and len(self.url) > 2:
|
if self.url[:8] != "https://" and self.url[:7] != "http://" and self.url[len(self.url) - 1:] == "/" and not self.containsPort and len(self.url) > 2:
|
||||||
self.connectionurl = f"http://{self.url[:len(self.url) - 1]}:8000"
|
self.connectionurl = f"http://{self.url[:len(self.url) - 1]}:8000"
|
||||||
print(svc.connect(self.connectionurl))
|
if svc.connect(self.connectionurl):
|
||||||
self.dismiss()
|
|
||||||
elif self.url[:8] != "https://" and self.url[:7] != "http://" and self.url[len(self.url) - 1:] != "/" and not self.containsPort and len(self.url) > 2:
|
|
||||||
self.connectionurl = f"http://{self.url}:8000"
|
|
||||||
print(svc.connect(self.connectionurl))
|
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
else:
|
else:
|
||||||
self.ids.output = "Invalid address, please enter just the IP address!"
|
self.ids.output.text = "There was an error in connecting to the server! Please make sure that the ip is correct!"
|
||||||
|
elif self.url[:8] != "https://" and self.url[:7] != "http://" and self.url[len(self.url) - 1:] != "/" and not self.containsPort and len(self.url) > 2:
|
||||||
|
self.connectionurl = f"http://{self.url}:8000"
|
||||||
|
if svc.connect(self.connectionurl):
|
||||||
|
self.dismiss()
|
||||||
|
else:
|
||||||
|
self.ids.output.text = "There was an error in connecting to the server! Please make sure that the ip is correct!"
|
||||||
|
else:
|
||||||
|
self.ids.output.text = "Invalid address, please enter just the IP address!"
|
||||||
global address
|
global address
|
||||||
address = self.connectionurl
|
address = self.connectionurl
|
||||||
|
|
||||||
|
|
||||||
class QuitPU(Popup):
|
class QuitPU(Popup):
|
||||||
pass
|
def quitapp(self):
|
||||||
|
svc.poststatus(address, False)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
class PathMissingPU(Popup):
|
class PathMissingPU(Popup):
|
||||||
@@ -85,6 +97,10 @@ class invalidpathPU(Popup):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class NotConnected(Popup):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class LeavePU(Popup):
|
class LeavePU(Popup):
|
||||||
def check_pwd(self):
|
def check_pwd(self):
|
||||||
if self.ids.passw.text == config["Security"]["pwd"]:
|
if self.ids.passw.text == config["Security"]["pwd"]:
|
||||||
@@ -123,7 +139,6 @@ class Home(MDScreen):
|
|||||||
self.__good_files += 1
|
self.__good_files += 1
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
# self.__good_files = 1
|
|
||||||
if self.__good_files > 0:
|
if self.__good_files > 0:
|
||||||
cvw.write_str("./data/temp.csv", [self.ids.filepath.text])
|
cvw.write_str("./data/temp.csv", [self.ids.filepath.text])
|
||||||
self.manager.current = "Main"
|
self.manager.current = "Main"
|
||||||
@@ -162,6 +177,9 @@ class Home(MDScreen):
|
|||||||
def quitapp(self):
|
def quitapp(self):
|
||||||
QuitPU().open()
|
QuitPU().open()
|
||||||
|
|
||||||
|
def connectServer(self):
|
||||||
|
ConnectPU().open()
|
||||||
|
|
||||||
|
|
||||||
class Main(MDScreen):
|
class Main(MDScreen):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
@@ -172,6 +190,8 @@ class Main(MDScreen):
|
|||||||
self.keyboard = Window.request_keyboard(None, self)
|
self.keyboard = Window.request_keyboard(None, self)
|
||||||
self.keyboard.bind(on_key_down=self.key_pressed)
|
self.keyboard.bind(on_key_down=self.key_pressed)
|
||||||
self.quit_requests = 0
|
self.quit_requests = 0
|
||||||
|
self.__comparepos = 10000
|
||||||
|
global address
|
||||||
|
|
||||||
def key_pressed(self, keyboard, keycode, text, modifiers):
|
def key_pressed(self, keyboard, keycode, text, modifiers):
|
||||||
# print(keycode[1])
|
# print(keycode[1])
|
||||||
@@ -202,11 +222,19 @@ class Main(MDScreen):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
|
if address != "":
|
||||||
|
self.ids.connectstatus.text = f"Connected to: {address}"
|
||||||
|
svc.poststatus(address, True)
|
||||||
|
if svc.getfullscreeninfo == "True":
|
||||||
|
self.ids.fullscreenc.text = "Exit fullscreen on client display"
|
||||||
|
else:
|
||||||
|
self.ids.fullscreenc.text = 'Enter fullscreen on client display'
|
||||||
|
else:
|
||||||
|
self.ids.connectstatus.text = "not connected to any server"
|
||||||
try:
|
try:
|
||||||
self.refreshspeed = int(config["Performance"]["showcaseRefreshRate"])
|
self.refreshspeed = int(config["Performance"]["showcaseRefreshRate"])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.refreshspeed = 1
|
self.refreshspeed = 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Clock.schedule_interval(self.screen_updating, self.refreshspeed)
|
Clock.schedule_interval(self.screen_updating, self.refreshspeed)
|
||||||
except:
|
except:
|
||||||
@@ -253,6 +281,7 @@ class Main(MDScreen):
|
|||||||
self.mplayer.kill()
|
self.mplayer.kill()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
svc.poststatus(address, False)
|
||||||
self.ids.pp_button.text = "Play"
|
self.ids.pp_button.text = "Play"
|
||||||
self.manager.current = "Home"
|
self.manager.current = "Home"
|
||||||
self.manager.transition.direction = "right"
|
self.manager.transition.direction = "right"
|
||||||
@@ -274,7 +303,8 @@ class Main(MDScreen):
|
|||||||
self.__upcoming = self.__info.pop(0)
|
self.__upcoming = self.__info.pop(0)
|
||||||
self.__songlinfo = self.__info.pop(0)
|
self.__songlinfo = self.__info.pop(0)
|
||||||
self.__songpos = self.backfeed.value
|
self.__songpos = self.backfeed.value
|
||||||
self.__songdisplay = int(self.__songpos / float(self.__songlinfo.pop(0)) * 100)
|
self.__songlength = self.__songlinfo.pop(0)
|
||||||
|
self.__songdisplay = int(self.__songpos / float(self.__songlength) * 100)
|
||||||
self.manager.get_screen("Showcase").ids.progressbars.value = self.__songdisplay
|
self.manager.get_screen("Showcase").ids.progressbars.value = self.__songdisplay
|
||||||
self.__current = self.__upcoming.pop(self.__currents)
|
self.__current = self.__upcoming.pop(self.__currents)
|
||||||
if self.__config == ["1"]:
|
if self.__config == ["1"]:
|
||||||
@@ -304,6 +334,18 @@ class Main(MDScreen):
|
|||||||
self.__upcoming_output += f"\n{self.__upcoming2}"
|
self.__upcoming_output += f"\n{self.__upcoming2}"
|
||||||
self.__length_output += 1
|
self.__length_output += 1
|
||||||
self.manager.get_screen("Showcase").ids.upcoming_songs.text = self.__upcoming_output
|
self.manager.get_screen("Showcase").ids.upcoming_songs.text = self.__upcoming_output
|
||||||
|
if address != "":
|
||||||
|
svc.postplaybackpos(address, self.__songpos)
|
||||||
|
if self.__comparepos > self.__songpos:
|
||||||
|
svc.postcurrentsong(address, self.__current_output)
|
||||||
|
svc.postsonglength(address, self.__songlength)
|
||||||
|
svc.postupcomingsongs(address, self.__upcoming_output)
|
||||||
|
# svc.postfullscreen(address, self.__current_output)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
self.__comparepos = self.__songpos
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
def back_here(self):
|
def back_here(self):
|
||||||
if self.manager.current == "Showcase":
|
if self.manager.current == "Showcase":
|
||||||
@@ -317,8 +359,16 @@ class Main(MDScreen):
|
|||||||
def open_leave_popup(self):
|
def open_leave_popup(self):
|
||||||
LeavePU().open()
|
LeavePU().open()
|
||||||
|
|
||||||
def connectToServer(self):
|
def changeServerSettings(self):
|
||||||
ConnectPU().open()
|
if address != "":
|
||||||
|
svc.changefullscreen(address)
|
||||||
|
if svc.getfullscreeninfo == "True":
|
||||||
|
self.ids.fullscreenc.text = "Exit fullscreen on client display"
|
||||||
|
else:
|
||||||
|
self.ids.fullscreenc.text = 'Enter fullscreen on client display'
|
||||||
|
else:
|
||||||
|
NotConnected().open()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ShowcaseS(MDScreen):
|
class ShowcaseS(MDScreen):
|
||||||
@@ -347,7 +397,11 @@ class MusicPlayer(MDApp):
|
|||||||
return Builder.load_file("./bin/gui/gui.kv")
|
return Builder.load_file("./bin/gui/gui.kv")
|
||||||
|
|
||||||
def on_request_close(self, *args):
|
def on_request_close(self, *args):
|
||||||
|
global address
|
||||||
|
AppQuitting().open()
|
||||||
print("leaving...")
|
print("leaving...")
|
||||||
|
svc.poststatus(address, False)
|
||||||
|
time.sleep(1)
|
||||||
os.killpg(os.getpgid(0), signal.SIGKILL)
|
os.killpg(os.getpgid(0), signal.SIGKILL)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ var upcomingsongs = "Test\nTest2\nTest3"
|
|||||||
var currentsong = "This is a song"
|
var currentsong = "This is a song"
|
||||||
var songmaxlength = "100"
|
var songmaxlength = "100"
|
||||||
var fullscreen = "False"
|
var fullscreen = "False"
|
||||||
|
var isrunning = "False"
|
||||||
|
|
||||||
|
|
||||||
// CONFIG FOR EXPRESS
|
// CONFIG FOR EXPRESS
|
||||||
@@ -36,6 +37,7 @@ app.get('/playbackpos', (request, response) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
app.get('/upcomingsongs', (request, response) => {
|
app.get('/upcomingsongs', (request, response) => {
|
||||||
|
console.log("getting upcoming songs")
|
||||||
response.send(upcomingsongs)
|
response.send(upcomingsongs)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -51,6 +53,10 @@ app.get('/fullscreen', (request, response) => {
|
|||||||
response.send(fullscreen)
|
response.send(fullscreen)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.get('/isrunning', (request, response) => {
|
||||||
|
response.send(isrunning)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// POST data (Interface for Player)
|
// POST data (Interface for Player)
|
||||||
app.post('/postplayback', (request, response) => {
|
app.post('/postplayback', (request, response) => {
|
||||||
@@ -58,7 +64,8 @@ app.post('/postplayback', (request, response) => {
|
|||||||
response.send("ok")
|
response.send("ok")
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post('/postupcomingsogns', (request, response) => {
|
app.post('/postupcomingsongs', (request, response) => {
|
||||||
|
console.log("updating upcomingsongs")
|
||||||
upcomingsongs = request.body.songs
|
upcomingsongs = request.body.songs
|
||||||
response.send("ok")
|
response.send("ok")
|
||||||
})
|
})
|
||||||
@@ -68,8 +75,12 @@ app.post('/postcurrentsong', (request, response) => {
|
|||||||
response.send("ok")
|
response.send("ok")
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post('/postfullscreen', (request, response) => {
|
app.post('/changefullscreen', (request, response) => {
|
||||||
fullscreen = request.body.fullscreen
|
if (fullscreen == "True") {
|
||||||
|
fullscreen = "False"
|
||||||
|
} else {
|
||||||
|
fullscreen = "True"
|
||||||
|
}
|
||||||
response.send("ok")
|
response.send("ok")
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -78,6 +89,12 @@ app.post('/postsonglength', (request, response) => {
|
|||||||
response.send("ok")
|
response.send("ok")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.post('/poststatus', (request, response) => {
|
||||||
|
console.log("updating status " + request.body.status)
|
||||||
|
isrunning = request.body.status
|
||||||
|
response.send("ok")
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// Test functions
|
// Test functions
|
||||||
app.post('/testrequest', (request, response) => {
|
app.post('/testrequest', (request, response) => {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -29,7 +29,7 @@ class Com:
|
|||||||
self.x = requests.get(f"{url}/songmaxlength")
|
self.x = requests.get(f"{url}/songmaxlength")
|
||||||
except Exception:
|
except Exception:
|
||||||
return 100
|
return 100
|
||||||
return int(self.x.text)
|
return float(self.x.text)
|
||||||
|
|
||||||
def getupcomingsongs(self, url):
|
def getupcomingsongs(self, url):
|
||||||
try:
|
try:
|
||||||
@@ -43,7 +43,7 @@ class Com:
|
|||||||
self.x = requests.get(f"{url}/playbackpos")
|
self.x = requests.get(f"{url}/playbackpos")
|
||||||
except Exception:
|
except Exception:
|
||||||
return 0
|
return 0
|
||||||
return int(self.x.text)
|
return float(self.x.text)
|
||||||
|
|
||||||
def checkiffullscreen(self, url):
|
def checkiffullscreen(self, url):
|
||||||
try:
|
try:
|
||||||
@@ -54,3 +54,13 @@ class Com:
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def checkgo(self, url):
|
||||||
|
try:
|
||||||
|
self.x = requests.get(f"{url}/isrunning")
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
if self.x.text == "True":
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
@@ -72,6 +72,11 @@ class ShowcaseScreen(MDScreen):
|
|||||||
self.ids.progressbars.value = self.__songdisplay
|
self.ids.progressbars.value = self.__songdisplay
|
||||||
self.ids.current_song.text = self.__current
|
self.ids.current_song.text = self.__current
|
||||||
self.ids.upcoming_songs.text = self.__upcoming
|
self.ids.upcoming_songs.text = self.__upcoming
|
||||||
|
if comHandler.checkgo(address):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
Window.fullscreen = False
|
||||||
|
screen_manager.current = "Login"
|
||||||
|
|
||||||
|
|
||||||
class MusicPlayerShowcaseScreen(MDApp):
|
class MusicPlayerShowcaseScreen(MDApp):
|
||||||
|
|||||||
Reference in New Issue
Block a user