server almost running - Second display working
This commit is contained in:
Binary file not shown.
BIN
bin/__pycache__/servercoms.cpython-310.pyc
Normal file
BIN
bin/__pycache__/servercoms.cpython-310.pyc
Normal file
Binary file not shown.
@@ -6,8 +6,29 @@ RootScreen:
|
|||||||
###########
|
###########
|
||||||
# POPUPS
|
# POPUPS
|
||||||
###########
|
###########
|
||||||
|
<ConnectPU>:
|
||||||
|
title: "Connect to Server"
|
||||||
|
auto_dismiss: False
|
||||||
|
size_hint: 0.8, 0.8
|
||||||
|
GridLayout:
|
||||||
|
cols: 1
|
||||||
|
Label:
|
||||||
|
text: "Please enter the Server's IP address below!"
|
||||||
|
Label:
|
||||||
|
text: ""
|
||||||
|
id: output
|
||||||
|
TextInput:
|
||||||
|
text: ""
|
||||||
|
id: url
|
||||||
|
hint_text: "Enter Server-IP"
|
||||||
|
Button:
|
||||||
|
text: "Connect"
|
||||||
|
on_release:
|
||||||
|
root.tryconnect()
|
||||||
|
|
||||||
|
|
||||||
<QuitPU>:
|
<QuitPU>:
|
||||||
title: "BiogasControllerApp"
|
title: "MusicPlayer"
|
||||||
font_size: 50
|
font_size: 50
|
||||||
size_hint: 0.5, 0.4
|
size_hint: 0.5, 0.4
|
||||||
auto_dismiss: False
|
auto_dismiss: False
|
||||||
@@ -218,12 +239,17 @@ RootScreen:
|
|||||||
on_release:
|
on_release:
|
||||||
root.playmusic()
|
root.playmusic()
|
||||||
GridLayout:
|
GridLayout:
|
||||||
cols: 2
|
cols: 3
|
||||||
Button:
|
Button:
|
||||||
text: "Back"
|
text: "Back"
|
||||||
background_color: app.theme_cls.accent_dark
|
background_color: app.theme_cls.accent_dark
|
||||||
on_release:
|
on_release:
|
||||||
root.go_back()
|
root.go_back()
|
||||||
|
Button:
|
||||||
|
text: "Connect to Server"
|
||||||
|
background_color: app.theme_cls.accent_dark
|
||||||
|
on_release:
|
||||||
|
root.connectToServer()
|
||||||
Button:
|
Button:
|
||||||
text: "Showcase"
|
text: "Showcase"
|
||||||
background_color: app.theme_cls.accent_dark
|
background_color: app.theme_cls.accent_dark
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import bin.filepathanalysis
|
|||||||
import pygame
|
import pygame
|
||||||
import bin.info_handler
|
import bin.info_handler
|
||||||
import configparser
|
import configparser
|
||||||
|
import time
|
||||||
|
|
||||||
pa = bin.filepathanalysis.PathAnalysis()
|
pa = bin.filepathanalysis.PathAnalysis()
|
||||||
cvr = bin.csv_parsers.CsvRead()
|
cvr = bin.csv_parsers.CsvRead()
|
||||||
@@ -134,3 +135,4 @@ class Player:
|
|||||||
self.infoupdater()
|
self.infoupdater()
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
time.sleep(0.25)
|
||||||
|
|||||||
48
bin/servercoms.py
Normal file
48
bin/servercoms.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
class ServerComs:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def connect(self, url):
|
||||||
|
try:
|
||||||
|
self.x = requests.get(f"{url}/tryconnect")
|
||||||
|
return True
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def postcurrentsong(self, url, data):
|
||||||
|
try:
|
||||||
|
self.x = requests.post(f"{url}/postcurrentsong", {"songname":data})
|
||||||
|
return True
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def postupcomingsongs(self, url, data):
|
||||||
|
try:
|
||||||
|
self.x = requests.post(f"{url}/postupcomingsongs", {"songs":data})
|
||||||
|
return True
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def postplaybackpos(self, url, data):
|
||||||
|
try:
|
||||||
|
self.x = requests.post(f"{url}/postplayback", {"pos":data})
|
||||||
|
return True
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def postsonglength(self, url, data):
|
||||||
|
try:
|
||||||
|
self.x = requests.post(f"{url}/postsonglength", {"length":data})
|
||||||
|
return True
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def postfullscreen(self, url, data):
|
||||||
|
try:
|
||||||
|
self.x = requests.post(f"{url}/postfullscreen", {"fullscreen":data})
|
||||||
|
return True
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
@@ -1 +1 @@
|
|||||||
/mnt/data/Music/
|
/mnt/storage/SORTED/Music/
|
||||||
|
|||||||
|
@@ -25,6 +25,7 @@ import bin.filepathanalysis
|
|||||||
import bin.player
|
import bin.player
|
||||||
import math
|
import math
|
||||||
import bin.autocomplete
|
import bin.autocomplete
|
||||||
|
import bin.servercoms
|
||||||
|
|
||||||
|
|
||||||
returnOk = False
|
returnOk = False
|
||||||
@@ -33,13 +34,40 @@ pa = bin.filepathanalysis.PathAnalysis()
|
|||||||
cvr = bin.csv_parsers.CsvRead()
|
cvr = bin.csv_parsers.CsvRead()
|
||||||
cvw = bin.csv_parsers.CsvWrite()
|
cvw = bin.csv_parsers.CsvWrite()
|
||||||
ac = bin.autocomplete.AutoComplete()
|
ac = bin.autocomplete.AutoComplete()
|
||||||
|
svc = bin.servercoms.ServerComs()
|
||||||
version_app = f"Music Player {config['Info']['version']}{config['Info']['subVersion']}"
|
version_app = f"Music Player {config['Info']['version']}{config['Info']['subVersion']}"
|
||||||
|
|
||||||
|
global address
|
||||||
|
address = ""
|
||||||
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# Popups
|
# Popups
|
||||||
###########
|
###########
|
||||||
|
|
||||||
|
class ConnectPU(Popup):
|
||||||
|
def tryconnect(self):
|
||||||
|
self.url = self.ids.url.text
|
||||||
|
self.containsPort = False
|
||||||
|
for self.letter in self.url:
|
||||||
|
if self.letter == ":":
|
||||||
|
self.containsPort = True
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
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:
|
||||||
|
self.connectionurl = f"http://{self.url[:len(self.url) - 1]}:8000"
|
||||||
|
print(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()
|
||||||
|
else:
|
||||||
|
self.ids.output = "Invalid address, please enter just the IP address!"
|
||||||
|
global address
|
||||||
|
address = self.connectionurl
|
||||||
|
|
||||||
|
|
||||||
class QuitPU(Popup):
|
class QuitPU(Popup):
|
||||||
pass
|
pass
|
||||||
@@ -250,13 +278,13 @@ class Main(MDScreen):
|
|||||||
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"]:
|
||||||
self.ids.current_song.text = self.__current[:(len(self.__current) - 4)]
|
self.__current_output = self.__current[:(len(self.__current) - 4)]
|
||||||
self.manager.get_screen("Showcase").ids.current_song.text = self.__current[:(len(self.__current) - 4)]
|
|
||||||
else:
|
else:
|
||||||
self.ids.current_song.text = self.__current
|
self.__current_output = self.__current
|
||||||
self.manager.get_screen("Showcase").ids.current_song.text = self.__current
|
self.ids.current_song.text = self.__current_output
|
||||||
|
self.manager.get_screen("Showcase").ids.current_song.text = self.__current_output
|
||||||
if len(self.__upcoming) <= self.__currents:
|
if len(self.__upcoming) <= self.__currents:
|
||||||
self.manager.get_screen("Showcase").ids.upcoming_songs.text = "No more songs in Queue"
|
self.__upcoming_output = "No more songs in Queue"
|
||||||
else:
|
else:
|
||||||
self.__upcoming2 = str(self.__upcoming.pop(self.__currents))
|
self.__upcoming2 = str(self.__upcoming.pop(self.__currents))
|
||||||
if self.__config == ["1"]:
|
if self.__config == ["1"]:
|
||||||
@@ -275,17 +303,12 @@ class Main(MDScreen):
|
|||||||
else:
|
else:
|
||||||
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
|
||||||
|
|
||||||
def back_here(self):
|
def back_here(self):
|
||||||
if self.manager.current == "Showcase":
|
if self.manager.current == "Showcase":
|
||||||
if config["Security"]["pwdFSExit"] == "True":
|
self.manager.current = "Main"
|
||||||
self.open_leave_popup()
|
self.manager.transition.direction = "right"
|
||||||
if returnOk:
|
|
||||||
Window.fullscreen = False
|
|
||||||
else:
|
|
||||||
self.manager.current = "Main"
|
|
||||||
self.manager.transition.direction = "right"
|
|
||||||
elif self.manager.current == "Main":
|
elif self.manager.current == "Main":
|
||||||
self.go_back()
|
self.go_back()
|
||||||
else:
|
else:
|
||||||
@@ -294,17 +317,14 @@ class Main(MDScreen):
|
|||||||
def open_leave_popup(self):
|
def open_leave_popup(self):
|
||||||
LeavePU().open()
|
LeavePU().open()
|
||||||
|
|
||||||
|
def connectToServer(self):
|
||||||
|
ConnectPU().open()
|
||||||
|
|
||||||
|
|
||||||
class ShowcaseS(MDScreen):
|
class ShowcaseS(MDScreen):
|
||||||
def leave_screen(self):
|
def leave_screen(self):
|
||||||
if config["Security"]["pwdFSExit"] == "True":
|
self.manager.current = "Main"
|
||||||
self.disablefullscreen()
|
self.manager.transition.direction = "right"
|
||||||
LeavePU().open()
|
|
||||||
if returnOk:
|
|
||||||
self.disablefullscreen()
|
|
||||||
else:
|
|
||||||
self.manager.current = "Main"
|
|
||||||
self.manager.transition.direction = "right"
|
|
||||||
|
|
||||||
def disablefullscreen(self):
|
def disablefullscreen(self):
|
||||||
Window.fullscreen = False
|
Window.fullscreen = False
|
||||||
|
|||||||
@@ -9,8 +9,14 @@ console.log("Use this IP address when connecting to this server from the player
|
|||||||
|
|
||||||
// INITIALIZE VARIABLES
|
// INITIALIZE VARIABLES
|
||||||
var app = express();
|
var app = express();
|
||||||
|
var playbackpos = "1"
|
||||||
|
var upcomingsongs = "Test\nTest2\nTest3"
|
||||||
|
var currentsong = "This is a song"
|
||||||
|
var songmaxlength = "100"
|
||||||
|
var fullscreen = "False"
|
||||||
|
|
||||||
|
|
||||||
|
// CONFIG FOR EXPRESS
|
||||||
app.use(bodyParser.urlencoded({extended : true}))
|
app.use(bodyParser.urlencoded({extended : true}))
|
||||||
|
|
||||||
|
|
||||||
@@ -26,31 +32,50 @@ app.get('/tryconnect', (request, response) => {
|
|||||||
|
|
||||||
// Get data (Interface for Screen)
|
// Get data (Interface for Screen)
|
||||||
app.get('/playbackpos', (request, response) => {
|
app.get('/playbackpos', (request, response) => {
|
||||||
response.send(1)
|
response.send(playbackpos)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/upcomingsongs', (request, response) => {
|
app.get('/upcomingsongs', (request, response) => {
|
||||||
response.send("This is a song")
|
response.send(upcomingsongs)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/songmaxlength', (request, response) => {
|
app.get('/songmaxlength', (request, response) => {
|
||||||
response.send(100)
|
response.send(songmaxlength)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/currentsong', (request, response) => {
|
app.get('/currentsong', (request, response) => {
|
||||||
response.send("Test\nTest2\nTest3")
|
response.send(currentsong)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.get('/fullscreen', (request, response) => {
|
||||||
|
response.send(fullscreen)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// POST data (Interface for Player)
|
// POST data (Interface for Player)
|
||||||
app.post('/posplayback', (request, response) => {
|
app.post('/postplayback', (request, response) => {
|
||||||
|
playbackpos = request.body.pos
|
||||||
|
response.send("ok")
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post('/postupcomingsogns', (request, response) => {
|
app.post('/postupcomingsogns', (request, response) => {
|
||||||
|
upcomingsongs = request.body.songs
|
||||||
|
response.send("ok")
|
||||||
|
})
|
||||||
|
|
||||||
|
app.post('/postcurrentsong', (request, response) => {
|
||||||
|
currentsong = request.body.songname
|
||||||
|
response.send("ok")
|
||||||
|
})
|
||||||
|
|
||||||
|
app.post('/postfullscreen', (request, response) => {
|
||||||
|
fullscreen = request.body.fullscreen
|
||||||
|
response.send("ok")
|
||||||
|
})
|
||||||
|
|
||||||
|
app.post('/postsonglength', (request, response) => {
|
||||||
|
songmaxlength = request.body.length
|
||||||
|
response.send("ok")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
BIN
showcaseScreen/handlers/__pycache__/csv_parsers.cpython-310.pyc
Normal file
BIN
showcaseScreen/handlers/__pycache__/csv_parsers.cpython-310.pyc
Normal file
Binary file not shown.
@@ -6,7 +6,10 @@ class Com:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def connect(self, url):
|
def connect(self, url):
|
||||||
self.x = requests.get(f"{url}/tryconnect")
|
try:
|
||||||
|
self.x = requests.get(f"{url}/tryconnect")
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
print(self.x.text)
|
print(self.x.text)
|
||||||
if self.x.text == "ok":
|
if self.x.text == "ok":
|
||||||
return True
|
return True
|
||||||
@@ -14,13 +17,40 @@ class Com:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def getcurrentsong(self, url):
|
def getcurrentsong(self, url):
|
||||||
return "Testsong"
|
try:
|
||||||
|
self.x = requests.get(f"{url}/currentsong")
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
return "Error"
|
||||||
|
return self.x.text
|
||||||
|
|
||||||
def getsonglength(self, url):
|
def getsonglength(self, url):
|
||||||
return 100
|
try:
|
||||||
|
self.x = requests.get(f"{url}/songmaxlength")
|
||||||
|
except Exception:
|
||||||
|
return 100
|
||||||
|
return int(self.x.text)
|
||||||
|
|
||||||
def getupcomingsongs(self, url):
|
def getupcomingsongs(self, url):
|
||||||
return "Test1\nTest2"
|
try:
|
||||||
|
self.x = requests.get(f"{url}/upcomingsongs")
|
||||||
|
except Exception:
|
||||||
|
return "Error"
|
||||||
|
return self.x.text
|
||||||
|
|
||||||
def getsongpos(self, url):
|
def getsongpos(self, url):
|
||||||
return 2
|
try:
|
||||||
|
self.x = requests.get(f"{url}/playbackpos")
|
||||||
|
except Exception:
|
||||||
|
return 0
|
||||||
|
return int(self.x.text)
|
||||||
|
|
||||||
|
def checkiffullscreen(self, url):
|
||||||
|
try:
|
||||||
|
self.x = requests.get(f"{url}/currentsong")
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
if self.x.text == "True":
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
122
showcaseScreen/handlers/csv_parsers.py
Executable file
122
showcaseScreen/handlers/csv_parsers.py
Executable file
@@ -0,0 +1,122 @@
|
|||||||
|
"""@package docstring
|
||||||
|
This is a simplification of the csv module"""
|
||||||
|
|
||||||
|
import csv
|
||||||
|
|
||||||
|
|
||||||
|
class CsvRead:
|
||||||
|
"""This is a class that reads csv files and depending on the module selected does do different things with it"""
|
||||||
|
def __init__(self):
|
||||||
|
self.__imp = ""
|
||||||
|
self.__raw = ""
|
||||||
|
self.__raw_list = ""
|
||||||
|
|
||||||
|
def importing(self, path):
|
||||||
|
"""Returns a list of the imported csv-file, requires path, either direct system path or relative path"""
|
||||||
|
self.__imp = open(path)
|
||||||
|
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||||
|
self.__raw_list = list(self.__raw)
|
||||||
|
self.__imp.close()
|
||||||
|
return self.__raw_list
|
||||||
|
|
||||||
|
|
||||||
|
class CsvWrite:
|
||||||
|
"""This is a class that modifies csv files"""
|
||||||
|
def __init__(self):
|
||||||
|
self.__impl = []
|
||||||
|
self.__strpop = []
|
||||||
|
self.__removed = []
|
||||||
|
self.__removing = 0
|
||||||
|
self.__change = 0
|
||||||
|
self.__appending = 0
|
||||||
|
self.__imp = []
|
||||||
|
self.__raw = []
|
||||||
|
|
||||||
|
def rem_str(self, path, row):
|
||||||
|
"""Opens the csv-file in write mode which is specified as an argument either as direct or relative path"""
|
||||||
|
self.__imp = open(path)
|
||||||
|
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||||
|
self.__impl = list(self.__raw)
|
||||||
|
self.__removed = self.__impl.pop(row + 1)
|
||||||
|
with open(path, "w") as removedata:
|
||||||
|
self.__removing = csv.writer(removedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__removing.writerow(self.__impl.pop(0))
|
||||||
|
while len(self.__impl) > 0:
|
||||||
|
with open(path, "a") as removedata:
|
||||||
|
self.__removing = csv.writer(removedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__removing.writerow(self.__impl.pop(0))
|
||||||
|
self.__imp.close()
|
||||||
|
removedata.close()
|
||||||
|
|
||||||
|
|
||||||
|
def chg_str(self, path, row, pos, new_value):
|
||||||
|
"""Opens the csv-file in write mode to change a value, e.g. if a recipe is changed."""
|
||||||
|
self.__imp = open(path)
|
||||||
|
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||||
|
self.__impl = list(self.__raw)
|
||||||
|
self.__strpop = self.__impl.pop(row)
|
||||||
|
self.__strpop.pop(pos)
|
||||||
|
self.__strpop.insert(pos, new_value)
|
||||||
|
self.__impl.insert(row, self.__strpop)
|
||||||
|
with open(path, "w") as changedata:
|
||||||
|
self.__change = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__change.writerow(self.__impl.pop(0))
|
||||||
|
while len(self.__impl) > 0:
|
||||||
|
with open(path, "a") as changedata:
|
||||||
|
self.__removing = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__removing.writerow(self.__impl.pop(0))
|
||||||
|
self.__imp.close()
|
||||||
|
changedata.close()
|
||||||
|
|
||||||
|
def chg_str_rem(self, path, row, pos):
|
||||||
|
"""Opens the csv-file in write mode to change a value, e.g. if a recipes is changed."""
|
||||||
|
self.__imp = open(path)
|
||||||
|
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||||
|
self.__impl = list(self.__raw)
|
||||||
|
self.__strpop = self.__impl.pop(row)
|
||||||
|
self.__strpop.pop(pos)
|
||||||
|
self.__strpop.pop(pos)
|
||||||
|
self.__impl.insert(row, self.__strpop)
|
||||||
|
with open(path, "w") as changedata:
|
||||||
|
self.__change = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__change.writerow(self.__impl.pop(0))
|
||||||
|
while len(self.__impl) > 0:
|
||||||
|
with open(path, "a") as changedata:
|
||||||
|
self.__removing = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__removing.writerow(self.__impl.pop(0))
|
||||||
|
self.__imp.close()
|
||||||
|
changedata.close()
|
||||||
|
|
||||||
|
def chg_str_add(self, path, row, new_value1, new_value2):
|
||||||
|
"""Opens the csv-file in write mode to change a value, e.g. if a recipes is changed."""
|
||||||
|
self.__imp = open(path)
|
||||||
|
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||||
|
self.__impl = list(self.__raw)
|
||||||
|
self.__strpop = self.__impl.pop(row)
|
||||||
|
self.__strpop.append(new_value1)
|
||||||
|
self.__strpop.append(new_value2)
|
||||||
|
self.__impl.insert(row, self.__strpop)
|
||||||
|
with open(path, "w") as changedata:
|
||||||
|
self.__change = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__change.writerow(self.__impl.pop(0))
|
||||||
|
while len(self.__impl) > 0:
|
||||||
|
with open(path, "a") as changedata:
|
||||||
|
self.__removing = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__removing.writerow(self.__impl.pop(0))
|
||||||
|
self.__imp.close()
|
||||||
|
changedata.close()
|
||||||
|
|
||||||
|
def app_str(self, path, value):
|
||||||
|
"""Opens the csv-file in append mode and writes given input. CsvWrite.app_str(path, value).
|
||||||
|
Path can be specified both as direct or relative. value is a list. Will return an error if type of value is
|
||||||
|
not a list."""
|
||||||
|
with open(path, "a") as appenddata:
|
||||||
|
self.__appending = csv.writer(appenddata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__appending.writerow(value)
|
||||||
|
appenddata.close()
|
||||||
|
|
||||||
|
def write_str(self, path, value):
|
||||||
|
with open(path, "w") as writedata:
|
||||||
|
self.__change = csv.writer(writedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
self.__change.writerow(value)
|
||||||
|
writedata.close()
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from audioop import add
|
||||||
from kivy.core.window import Window
|
from kivy.core.window import Window
|
||||||
from kivy.uix.screenmanager import ScreenManager
|
from kivy.uix.screenmanager import ScreenManager
|
||||||
from kivymd.uix.screen import MDScreen
|
from kivymd.uix.screen import MDScreen
|
||||||
@@ -7,11 +8,11 @@ from kivy.uix.popup import Popup
|
|||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
import handlers.comHandler
|
import handlers.comHandler
|
||||||
import math
|
import math
|
||||||
import bin.csv_parsers
|
import handlers.csv_parsers
|
||||||
Builder.load_file('./ui/connectionPU.kv')
|
Builder.load_file('./ui/connectionPU.kv')
|
||||||
|
|
||||||
comHandler = handlers.comHandler.Com()
|
comHandler = handlers.comHandler.Com()
|
||||||
cvr = bin.csv_parsers.CsvRead()
|
cvr = handlers.csv_parsers.CsvRead()
|
||||||
|
|
||||||
class ConnectionPU(Popup):
|
class ConnectionPU(Popup):
|
||||||
pass
|
pass
|
||||||
@@ -27,21 +28,30 @@ class LoginWindow(MDScreen):
|
|||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
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:
|
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(comHandler.connect(self.connectionurl))
|
print(comHandler.connect(self.connectionurl))
|
||||||
elif self.url[:8] != "https://" and self.url[:7] != "http://" and self.url[len(self.url) - 1:] != "/" and not self.containsPort:
|
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"
|
self.connectionurl = f"http://{self.url}:8000"
|
||||||
print(comHandler.connect(self.connectionurl))
|
print(comHandler.connect(self.connectionurl))
|
||||||
else:
|
else:
|
||||||
ConnectionPU().open()
|
ConnectionPU().open()
|
||||||
global address
|
global address
|
||||||
address = self.url
|
address = self.connectionurl
|
||||||
|
screen_manager.current = "ShowcaseScreen"
|
||||||
|
|
||||||
|
|
||||||
class ShowcaseScreen(MDScreen):
|
class ShowcaseScreen(MDScreen):
|
||||||
def updateScreen(self):
|
def beginUpdating(self):
|
||||||
|
Clock.schedule_interval(self.updateScreen, 0.5)
|
||||||
|
self.lastsongpos = 200
|
||||||
|
self.__current = comHandler.getcurrentsong(address)
|
||||||
|
self.__upcoming = comHandler.getupcomingsongs(address)
|
||||||
|
self.songlength = comHandler.getsonglength(address)
|
||||||
|
|
||||||
|
def updateScreen(self, dmp):
|
||||||
global address
|
global address
|
||||||
|
Window.fullscreen = comHandler.checkiffullscreen(address)
|
||||||
self.__windowsize = Window._get_size()
|
self.__windowsize = Window._get_size()
|
||||||
self.__windowsize_x = self.__windowsize[0]
|
self.__windowsize_x = self.__windowsize[0]
|
||||||
self.__windowsize_y = self.__windowsize[1]
|
self.__windowsize_y = self.__windowsize[1]
|
||||||
@@ -50,33 +60,18 @@ class ShowcaseScreen(MDScreen):
|
|||||||
self.ids.upcoming_songs.font_size = self.__text_size - 5
|
self.ids.upcoming_songs.font_size = self.__text_size - 5
|
||||||
self.ids.titleinfo.font_size = self.__text_size * 2.2
|
self.ids.titleinfo.font_size = self.__text_size * 2.2
|
||||||
self.ids.upcoming_ind.font_size = self.__text_size + 10
|
self.ids.upcoming_ind.font_size = self.__text_size + 10
|
||||||
self.__current = comHandler.getcurrentsong(address)
|
self.songpos = comHandler.getsongpos(address)
|
||||||
self.__upcoming = comHandler.getupcomingsongs(address)
|
if self.songpos < self.lastsongpos:
|
||||||
self.__songdisplay = int(comHandler.getsonglength(address) / float(comHandler.getsongpos(address)) * 100)
|
self.__current = comHandler.getcurrentsong(address)
|
||||||
|
self.__upcoming = comHandler.getupcomingsongs(address)
|
||||||
|
self.songlength = comHandler.getsonglength(address)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
self.lastsongpos = self.songpos
|
||||||
|
self.__songdisplay = int(self.songpos / float(self.songlength) * 100)
|
||||||
self.ids.progressbars.value = self.__songdisplay
|
self.ids.progressbars.value = self.__songdisplay
|
||||||
if self.__config == ["1"]:
|
self.ids.current_song.text = self.__current
|
||||||
self.ids.current_song.text = self.__current[:(len(self.__current) - 4)]
|
self.ids.upcoming_songs.text = self.__upcoming
|
||||||
else:
|
|
||||||
self.ids.current_song.text = self.__current
|
|
||||||
if len(self.__upcoming) <= self.__currents:
|
|
||||||
self.ids.upcoming_songs.text = "No more songs in Queue"
|
|
||||||
else:
|
|
||||||
if self.__config == ["1"]:
|
|
||||||
self.__upcoming_output = self.__upcoming[:(len(self.__upcoming) - 4)]
|
|
||||||
else:
|
|
||||||
self.__upcoming_output = self.__upcoming
|
|
||||||
|
|
||||||
self.__length_output = 0
|
|
||||||
for i in range(len(self.__upcoming) - self.__currents):
|
|
||||||
if self.__length_output > 5:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if self.__config == ["1"]:
|
|
||||||
self.__upcoming_output += f"\n{self.__upcoming[:(len(self.__upcoming) - 4)]}"
|
|
||||||
else:
|
|
||||||
self.__upcoming_output += f"\n{self.__upcoming}"
|
|
||||||
self.__length_output += 1
|
|
||||||
self.ids.upcoming_songs.text = self.__upcoming_output
|
|
||||||
|
|
||||||
|
|
||||||
class MusicPlayerShowcaseScreen(MDApp):
|
class MusicPlayerShowcaseScreen(MDApp):
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
ShowcaseScreen:
|
ShowcaseScreen:
|
||||||
name: "ShowcaseScreen"
|
name: "ShowcaseScreen"
|
||||||
|
on_pre_enter: root.beginUpdating()
|
||||||
md_bg_color: (0, 0, 0, 1)
|
md_bg_color: (0, 0, 0, 1)
|
||||||
FloatLayout:
|
FloatLayout:
|
||||||
Label:
|
Label:
|
||||||
@@ -45,13 +46,6 @@ ShowcaseScreen:
|
|||||||
color: app.theme_cls.primary_color
|
color: app.theme_cls.primary_color
|
||||||
shorten: False
|
shorten: False
|
||||||
halign: "center"
|
halign: "center"
|
||||||
Button:
|
|
||||||
text: "back"
|
|
||||||
font_size: 10
|
|
||||||
size_hint: 0.05, 0.05
|
|
||||||
background_color: app.theme_cls.accent_light
|
|
||||||
on_release:
|
|
||||||
root.leave_screen()
|
|
||||||
Label:
|
Label:
|
||||||
text: "Designed and developed by Janis Hutz"
|
text: "Designed and developed by Janis Hutz"
|
||||||
font_size: 7
|
font_size: 7
|
||||||
|
|||||||
Reference in New Issue
Block a user