added first
This commit is contained in:
BIN
bin/__pycache__/autocomplete.cpython-310.pyc
Normal file
BIN
bin/__pycache__/autocomplete.cpython-310.pyc
Normal file
Binary file not shown.
BIN
bin/__pycache__/csv_parsers.cpython-310.pyc
Normal file
BIN
bin/__pycache__/csv_parsers.cpython-310.pyc
Normal file
Binary file not shown.
BIN
bin/__pycache__/filepathanalysis.cpython-310.pyc
Normal file
BIN
bin/__pycache__/filepathanalysis.cpython-310.pyc
Normal file
Binary file not shown.
BIN
bin/__pycache__/info_handler.cpython-310.pyc
Normal file
BIN
bin/__pycache__/info_handler.cpython-310.pyc
Normal file
Binary file not shown.
BIN
bin/__pycache__/player.cpython-310.pyc
Normal file
BIN
bin/__pycache__/player.cpython-310.pyc
Normal file
Binary file not shown.
@@ -99,7 +99,7 @@ RootScreen:
|
||||
TextInput:
|
||||
id: passw
|
||||
multiline: False
|
||||
input_filter: "string"
|
||||
on_text_validate: root.returnToFullscreen()
|
||||
Label:
|
||||
id: output
|
||||
text: ""
|
||||
@@ -232,7 +232,7 @@ RootScreen:
|
||||
root.manager.transition.direction = "left"
|
||||
|
||||
<ShowcaseS>:
|
||||
on_leave: root.disablefullscreen()
|
||||
on_pre_enter: root.reset()
|
||||
name: "Showcase"
|
||||
md_bg_color: (0, 0, 0, 1)
|
||||
FloatLayout:
|
||||
@@ -285,8 +285,7 @@ RootScreen:
|
||||
size_hint: 0.05, 0.05
|
||||
background_color: app.theme_cls.accent_light
|
||||
on_release:
|
||||
app.root.current = "Main"
|
||||
root.manager.transition.direction = "right"
|
||||
root.leave_screen()
|
||||
Label:
|
||||
text: "Designed and developed by Janis Hutz"
|
||||
font_size: 7
|
||||
|
||||
@@ -16,9 +16,9 @@ loopPlayback = 1
|
||||
|
||||
[Security]
|
||||
# Specifies if a password should be used for exiting the fullscreen mode on the showcase screen
|
||||
pwdFSExit = False
|
||||
pwdFSExit = True
|
||||
# Set password here, will not be respected if above is "False"
|
||||
pwd =
|
||||
pwd = 1234
|
||||
|
||||
[Info]
|
||||
# Software version
|
||||
|
||||
@@ -1 +1 @@
|
||||
/mnt/DATA/Music/
|
||||
/mnt/data/Music/
|
||||
|
||||
|
@@ -27,6 +27,7 @@ import math
|
||||
import bin.autocomplete
|
||||
|
||||
|
||||
returnOk = False
|
||||
pl = bin.player.Player()
|
||||
pa = bin.filepathanalysis.PathAnalysis()
|
||||
cvr = bin.csv_parsers.CsvRead()
|
||||
@@ -59,13 +60,15 @@ class invalidpathPU(Popup):
|
||||
class LeavePU(Popup):
|
||||
def check_pwd(self):
|
||||
if self.ids.passw.text == config["Security"]["pwd"]:
|
||||
self.manager.current = "Main"
|
||||
self.manager.transition.direction = "right"
|
||||
returnOk = true
|
||||
self.dismiss()
|
||||
else:
|
||||
time.sleep(2)
|
||||
self.ids.output.text = "Password wrong, please try again!"
|
||||
|
||||
def returnToFullscreen(self):
|
||||
Window.fullscreen = True
|
||||
|
||||
|
||||
###########
|
||||
# SCREENS
|
||||
@@ -278,6 +281,8 @@ class Main(MDScreen):
|
||||
if self.manager.current == "Showcase":
|
||||
if config["Security"]["pwdFSExit"] == "True":
|
||||
self.open_leave_popup()
|
||||
if returnOk:
|
||||
Window.fullscreen = False
|
||||
else:
|
||||
self.manager.current = "Main"
|
||||
self.manager.transition.direction = "right"
|
||||
@@ -291,9 +296,22 @@ class Main(MDScreen):
|
||||
|
||||
|
||||
class ShowcaseS(MDScreen):
|
||||
def leave_screen(self):
|
||||
if config["Security"]["pwdFSExit"] == "True":
|
||||
self.disablefullscreen()
|
||||
LeavePU().open()
|
||||
if returnOk:
|
||||
self.disablefullscreen()
|
||||
else:
|
||||
self.manager.current = "Main"
|
||||
self.manager.transition.direction = "right"
|
||||
|
||||
def disablefullscreen(self):
|
||||
Window.fullscreen = False
|
||||
|
||||
def reset(self):
|
||||
returnOk = False
|
||||
|
||||
|
||||
class RootScreen(ScreenManager):
|
||||
pass
|
||||
|
||||
BIN
showcaseScreen/handlers/__pycache__/server.cpython-310.pyc
Normal file
BIN
showcaseScreen/handlers/__pycache__/server.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
33
showcaseScreen/handlers/server.py
Normal file
33
showcaseScreen/handlers/server.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||
import cgi
|
||||
import os
|
||||
|
||||
|
||||
class MusicPlayerServer(BaseHTTPRequestHandler):
|
||||
def _set_headers(self):
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/html')
|
||||
self.end_headers()
|
||||
|
||||
def do_GET(self):
|
||||
self._set_headers()
|
||||
if self.path == '/reloadstyling':
|
||||
pass
|
||||
else:
|
||||
self.opened_file = open(f".{self.path}").read()
|
||||
self.wfile.write(bytes(self.opened_file, 'utf-8'))
|
||||
|
||||
def do_POST(self):
|
||||
self._set_headers()
|
||||
self.returnsPOST = cgi.FieldStorage(
|
||||
fp=self.rfile,
|
||||
headers=self.headers,
|
||||
environ={ 'REQUEST_METHOD' : 'POST'}
|
||||
)
|
||||
print(self.returnsPOST)
|
||||
|
||||
def run(server_class=HTTPServer, handler_class=MusicPlayerServer, port=8080):
|
||||
server_address = ('', port)
|
||||
httpd = server_class(server_address, handler_class)
|
||||
print(f"Server started on {port}")
|
||||
httpd.serve_forever()
|
||||
29
showcaseScreen/handlers/server_handler.py
Normal file
29
showcaseScreen/handlers/server_handler.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import handlers.server
|
||||
import multiprocessing as mp
|
||||
|
||||
|
||||
class ServerHandler:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def start_server(self):
|
||||
print("starting server")
|
||||
try:
|
||||
if self.mpserver.is_alive():
|
||||
pass
|
||||
else:
|
||||
self.mpserver = mp.Process(name="runserver", target=handlers.server.run,)
|
||||
self.mpserver.start()
|
||||
except AttributeError as e:
|
||||
print(e)
|
||||
self.mpserver = mp.Process(name="runserver", target=handlers.server.run,)
|
||||
self.mpserver.start()
|
||||
|
||||
def stop_server(self):
|
||||
self.mpserver.kill()
|
||||
|
||||
def get_server_status(self):
|
||||
try:
|
||||
return self.mpserver.is_alive()
|
||||
except AttributeError:
|
||||
return False
|
||||
6
showcaseScreen/index.html
Normal file
6
showcaseScreen/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>THIS IS A TEST</h1>
|
||||
</body>
|
||||
</html>
|
||||
39
showcaseScreen/musicplayer_showcase_screen.py
Normal file
39
showcaseScreen/musicplayer_showcase_screen.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from kivy.core.window import Window
|
||||
from kivy.uix.screenmanager import ScreenManager
|
||||
from kivymd.uix.screen import MDScreen
|
||||
from kivymd.app import MDApp
|
||||
from kivy.base import Builder
|
||||
from kivy.uix.popup import Popup
|
||||
from kivy.clock import Clock
|
||||
import handlers.server_handler as shand
|
||||
|
||||
server_manager = shand.ServerHandler()
|
||||
|
||||
|
||||
class LoginWindow(MDScreen):
|
||||
def startserver(self):
|
||||
self.ids.statusbar.text = "Starting server..."
|
||||
server_manager.start_server()
|
||||
Clock.schedule_once(self.getStatus, 4)
|
||||
|
||||
def getStatus(self, dump):
|
||||
print("status update")
|
||||
if server_manager.get_server_status():
|
||||
self.ids.statusbar.text = "Server running on Port 8080"
|
||||
else:
|
||||
self.ids.statusbar.text = "There was an error starting the server or it might take longer than expected to start it."
|
||||
Clock.schedule_once(self.getStatus, 4)
|
||||
|
||||
|
||||
class MusicPlayerShowcaseScreen(MDApp):
|
||||
global screen_manager
|
||||
screen_manager = ScreenManager()
|
||||
|
||||
def build(self):
|
||||
self.title = "MusicPlayer Showcase Screen"
|
||||
self.theme_cls.primary_palette = "Blue"
|
||||
self.theme_cls.accent_palette = "Gray"
|
||||
screen_manager.add_widget(Builder.load_file("./ui/mainui.kv"))
|
||||
return screen_manager
|
||||
|
||||
MusicPlayerShowcaseScreen().run()
|
||||
17
showcaseScreen/ui/mainui.kv
Normal file
17
showcaseScreen/ui/mainui.kv
Normal file
@@ -0,0 +1,17 @@
|
||||
LoginWindow:
|
||||
name: "Login"
|
||||
md_bg_color: app.theme_cls.accent_color
|
||||
GridLayout:
|
||||
cols: 1
|
||||
Label:
|
||||
text: "Welcome to the MusicPlayer Showcase Screen!"
|
||||
font_size: 27
|
||||
color: (0, 0, 0, 1)
|
||||
Label:
|
||||
text: "Server is currently not running! Please start it by clicking start server!"
|
||||
id: statusbar
|
||||
color: (0, 0, 0, 1)
|
||||
Button:
|
||||
text: "Start Server"
|
||||
on_release:
|
||||
root.startserver()
|
||||
Reference in New Issue
Block a user