Beta-1.0:

- added new option to show song titles
This commit is contained in:
janis
2022-03-11 17:59:14 +01:00
parent 014640466c
commit 92350fc5aa
6 changed files with 61 additions and 19 deletions

View File

@@ -136,23 +136,25 @@ RootScreen:
FloatLayout: FloatLayout:
Label: Label:
text: "Currently Playing" text: "Currently Playing"
pos_hint: {"y": 0.4} pos_hint: {"y": 0.35}
font_size: 35 font_size: 45
color: app.theme_cls.primary_color color: app.theme_cls.primary_color
MDProgressBar: MDProgressBar:
orientation: "horizontal" orientation: "horizontal"
value: 100 value: 100
pos_hint: {"y": 0.35} pos_hint: {"y": 0.3}
color: app.theme_cls.primary_dark color: app.theme_cls.primary_dark
Label: Label:
id: current_song id: current_song
text: "Currently playing Song will appear here" text: "Currently playing Song will appear here"
pos_hint: {"y": 0.25} pos_hint: {"y": 0.22}
font_size: 30 font_size: 30
color: app.theme_cls.primary_color color: app.theme_cls.primary_color
shorten: False
Label: Label:
text: "upcoming" text: "upcoming"
font_size: 25 font_size: 25
pos_hint: {"y": -0.05}
color: app.theme_cls.primary_color color: app.theme_cls.primary_color
Label: Label:
id: upcoming_songs id: upcoming_songs
@@ -160,6 +162,7 @@ RootScreen:
pos_hint: {"y": -0.25} pos_hint: {"y": -0.25}
font_size: 20 font_size: 20
color: app.theme_cls.primary_color color: app.theme_cls.primary_color
shorten: False
Button: Button:
text: "back" text: "back"
font_size: 10 font_size: 10

View File

@@ -7,11 +7,26 @@ cvw = bin.csv_parsers.CsvWrite()
class InfoHandler: class InfoHandler:
def __init__(self): def __init__(self):
pass self.path = ""
self.__infos = ""
self.__style = ""
self.__outp1 = ""
self.__output = []
def infohandler(self, infos, path): def infohandler(self, listname, path):
print(path, "path") self.path = f"{path}/{listname}"
self.path = f"{path}/songlist.csv"
self.__info_doc = cvr.importing(self.path) self.__info_doc = cvr.importing(self.path)
print(self.__info_doc) self.__outp1 = ""
print(infos) self.__output = []
for self.item in self.__info_doc:
self.__outp1 = []
self.__infos = ""
self.__infos = self.item
self.__outp1 = f"{self.__infos.pop(0)} - {self.__infos.pop(0)}"
try:
self.__style = self.__infos.pop(0)
self.__outp1 += f" | {self.__style}"
except:
pass
self.__output.append(self.__outp1)
cvw.app_str("./data/songtemp.csv", self.__output)

View File

@@ -43,11 +43,14 @@ class Player:
self.transmission = [] self.transmission = []
cvw.write_str("./data/songtemp.csv", [self.current_playing_pos]) cvw.write_str("./data/songtemp.csv", [self.current_playing_pos])
self.__config = cvr.importing("./data/config.csv").pop(0) self.__config = cvr.importing("./data/config.csv").pop(0)
self.listinfo = self.__config.pop(1)
if self.__config == ["1"]: if self.__config == ["1"]:
cvw.app_str("./data/songtemp.csv", self.information) cvw.app_str("./data/songtemp.csv", self.information)
else: else:
print(self.path, "path") try:
bin.info_handler.InfoHandler().infohandler(self.information, self.pathtr) bin.info_handler.InfoHandler().infohandler(self.listinfo, self.pathtr)
except FileNotFoundError:
cvw.app_str("./data/songtemp.csv", self.information)
def musicmanager(self, inst, other): def musicmanager(self, inst, other):
self.start_playing() self.start_playing()
@@ -101,4 +104,3 @@ class Player:
self.infoupdater() self.infoupdater()
else: else:
pass pass

View File

@@ -1 +1 @@
0 0,songlist.csv
1 0 songlist.csv

View File

@@ -1 +1,2 @@
0 0
Tennessee Waltz - New 101 Strings Orchestra | Slow Walz,Morning has broken - Cat Stevens | Walzer,Magia - Alvaro Soler | Flashmob,Say So - Doja Cat | Discofox,Save Your Tears (Remix) - The Weeknd & Ariana Grande | Discofox,Shivers - Ed Sheeran | Jive/ Rocknroll,I feel good - Ray Charles | Jive/Rocknroll,Muevelo - Rey Ruiz | Cha ch cha,suelta la cintura - Ruben leon | Cha ch cha,Como Volver a Ser Feliz - Luis Enrique | Salsa,Mas que nada - black eyed peas | Salsa/Discofox,Moon River - Henry Mancini | Slow Walz,Dancing Queen - ABBA | Discofox,Don't Call Me Up - Mabel | Discofox,Magia - Alvaro Soler | Flashmob,Lets have a Party - Wanda Jackson | Jive,Crazy Little Thing Called Love - Queen | Jive / Rocknroll,El Diablo Anda Suelto - Rey Ruiz | Cha ch cha,Lets get loud - jennifer Lopez | Cha ch cha,Enamorame - Somos del Barrio | Salsa,Something Stupid (feat. Reese Witherspoon) - Michael Bublé | Rumba/cha cha cha,When a man loves a woman - Percy Sledge | Slow,Scharlachrot - Patent Ochsner | Walzer,ily (i love you baby) [feat. Emilee] - Surf Mesa | Discofox,Like a sex machine - James Brown | Discofox,Uptown Funk (feat. Bruno Mars) - Discofox | Discofox,Tutti Frutti - Little Richard | Jive/ Rocknroll,Jailhouse Rock - Elvis Presley | Jive/ Rocknroll,Are you lonesome - Elvis Presley | walzer/slow,Ay Mujer - Rey Ruiz | Cha ch cha,Rico Vacilon - Pedro Garcia & His Del Prado Orchestra | Cha ch cha,Jeepers creepers - Benny Goodmann | Foxtrott,An der schönen blauen Donau - New 101 Strings Orchestra | Wiener Walzer,The Last Waltz - Engelbert Humperdinck | Walzer,Stand by me - Sam Brown | Cha ch cha,Staiin' Alive - Begees | Discofox,Easy On Me - Adele | Slow,Magia - Alvaro Soler | Flashmob,Friday (feat. Mufasa & Hypeman) [Dopamine Re-Edit] - Riton & Nightcrawlers | Party,YMCA - Village People | Party,Cotton eyed Joe (Hennustall zermatt mix) - Rednex,Gangnam style - PSY | Party,Take On Me - a-ha | Jive,Rock Around the Clock - Bill Haley & His Comets | Jive/Rocknroll,Satisfaction - Rolling Stones | Party,"Un, dos, tres - Ricky Martin | Party",Party Rock anthem - LFMBQ | Party,I don't care - Icona Pop | Party,Love tonight - Shouse&David Guetta | Party,Insomnia - Faithless | Party,Angels - Robbie Williams | Slow,Nothing compares to you - Sinead O'Connor | Slow
1 0
2 Tennessee Waltz - New 101 Strings Orchestra | Slow Walz

View File

@@ -1,5 +1,7 @@
import multiprocessing import multiprocessing
import os import os
import signal
from kivy.core.window import Window, Config from kivy.core.window import Window, Config
from kivy.uix.screenmanager import ScreenManager from kivy.uix.screenmanager import ScreenManager
from kivymd.uix.screen import MDScreen from kivymd.uix.screen import MDScreen
@@ -10,6 +12,7 @@ from kivy.clock import Clock
import bin.csv_parsers import bin.csv_parsers
import bin.filepathanalysis import bin.filepathanalysis
import bin.player import bin.player
import sys
pl = bin.player.Player() pl = bin.player.Player()
@@ -135,45 +138,63 @@ class Main(MDScreen):
self.manager.current = "Home" self.manager.current = "Home"
self.manager.transition.direction = "right" self.manager.transition.direction = "right"
class ShowcaseS(MDScreen): class ShowcaseS(MDScreen):
def screen_updater_start(self): def screen_updater_start(self):
Clock.schedule_interval(self.screen_updating, 2) Clock.schedule_interval(self.screen_updating, 2)
def screen_updating(self, waste): def screen_updating(self, waste):
self.__config = cvr.importing("./data/config.csv").pop(0)
self.__info = cvr.importing("./data/songtemp.csv") self.__info = cvr.importing("./data/songtemp.csv")
self.__currents_imp = self.__info.pop(0) self.__currents_imp = self.__info.pop(0)
self.__currents = int(self.__currents_imp.pop(0)) self.__currents = int(self.__currents_imp.pop(0))
self.__upcoming = self.__info.pop(0) self.__upcoming = self.__info.pop(0)
self.__upcoming.sort()
self.__current = self.__upcoming.pop(self.__currents) self.__current = self.__upcoming.pop(self.__currents)
if self.__config == ["1"]:
self.ids.current_song.text = self.__current[:(len(self.__current) - 4)] self.ids.current_song.text = self.__current[:(len(self.__current) - 4)]
else:
self.ids.current_song.text = self.__current
if len(self.__upcoming) <= self.__currents: if len(self.__upcoming) <= self.__currents:
self.ids.upcoming_songs.text = "No more songs in Queue" self.ids.upcoming_songs.text = "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"]:
self.__upcoming_output = self.__upcoming2[:(len(self.__upcoming2) - 4)] self.__upcoming_output = self.__upcoming2[:(len(self.__upcoming2) - 4)]
else:
self.__upcoming_output = self.__upcoming2
self.__length_output = 0 self.__length_output = 0
for i in range(len(self.__upcoming) - self.__currents): for i in range(len(self.__upcoming) - self.__currents):
if self.__length_output > 5: if self.__length_output > 5:
pass pass
else: else:
self.__upcoming2 = str(self.__upcoming.pop(self.__currents)) self.__upcoming2 = str(self.__upcoming.pop(self.__currents))
if self.__config == ["1"]:
self.__upcoming_output += f"\n{self.__upcoming2[:(len(self.__upcoming2) - 4)]}" self.__upcoming_output += f"\n{self.__upcoming2[:(len(self.__upcoming2) - 4)]}"
else:
self.__upcoming_output += f"\n{self.__upcoming2}"
self.__length_output += 1 self.__length_output += 1
self.ids.upcoming_songs.text = self.__upcoming_output self.ids.upcoming_songs.text = self.__upcoming_output
class RootScreen(ScreenManager): class RootScreen(ScreenManager):
pass pass
class MusicPlayer(MDApp): class MusicPlayer(MDApp):
def build(self): def build(self):
Window.bind(on_request_close=self.on_request_close)
self.title = "MusicPlayer" self.title = "MusicPlayer"
self.theme_cls.primary_palette = "Yellow" self.theme_cls.primary_palette = "Yellow"
self.theme_cls.accent_palette = "BlueGray" self.theme_cls.accent_palette = "BlueGray"
# self.icon = "./BiogasControllerAppLogo.png" # self.icon = "./BiogasControllerAppLogo.png"
return Builder.load_file("./bin/gui/gui.kv") return Builder.load_file("./bin/gui/gui.kv")
def on_request_close(self, *args):
print("leaving...")
os.killpg(os.getpgid(0), signal.SIGKILL)
if __name__ == "__main__": if __name__ == "__main__":
Config.set('graphics', 'width', '800') Config.set('graphics', 'width', '800')
Config.set('graphics', 'height', '600') Config.set('graphics', 'height', '600')