Stable-V.1.0.1
- added a progressbar for the song
This commit is contained in:
@@ -50,7 +50,7 @@ class CsvWrite:
|
|||||||
|
|
||||||
|
|
||||||
def chg_str(self, path, row, pos, new_value):
|
def chg_str(self, path, row, pos, new_value):
|
||||||
"""Opens the csv-file in write mode to change a value, e.g. if a recipes is changed."""
|
"""Opens the csv-file in write mode to change a value, e.g. if a recipe is changed."""
|
||||||
self.__imp = open(path)
|
self.__imp = open(path)
|
||||||
self.__raw = csv.reader(self.__imp, delimiter=',')
|
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||||
self.__impl = list(self.__raw)
|
self.__impl = list(self.__raw)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ RootScreen:
|
|||||||
|
|
||||||
<Home>:
|
<Home>:
|
||||||
name: "Home"
|
name: "Home"
|
||||||
md_bg_color: app.theme_cls.accent_color
|
md_bg_color: app.theme_cls.accent_dark
|
||||||
GridLayout:
|
GridLayout:
|
||||||
cols: 1
|
cols: 1
|
||||||
Label:
|
Label:
|
||||||
@@ -100,7 +100,7 @@ RootScreen:
|
|||||||
<Main>:
|
<Main>:
|
||||||
on_pre_enter: root.initialize()
|
on_pre_enter: root.initialize()
|
||||||
name: "Main"
|
name: "Main"
|
||||||
md_bg_color: app.theme_cls.accent_color
|
md_bg_color: app.theme_cls.accent_dark
|
||||||
GridLayout:
|
GridLayout:
|
||||||
cols: 1
|
cols: 1
|
||||||
GridLayout:
|
GridLayout:
|
||||||
@@ -163,33 +163,45 @@ RootScreen:
|
|||||||
FloatLayout:
|
FloatLayout:
|
||||||
Label:
|
Label:
|
||||||
text: "Currently Playing"
|
text: "Currently Playing"
|
||||||
|
bold: True
|
||||||
|
italic: True
|
||||||
pos_hint: {"y": 0.35}
|
pos_hint: {"y": 0.35}
|
||||||
font_size: 45
|
font_size: 60
|
||||||
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.3}
|
pos_hint: {"y": 0.3}
|
||||||
|
color: (1, 1, 1, 0.5)
|
||||||
|
MDProgressBar:
|
||||||
|
id: progressbars
|
||||||
|
orientation: "horizontal"
|
||||||
|
value: 0
|
||||||
|
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.22}
|
pos_hint: {"y": 0.22}
|
||||||
font_size: 30
|
font_size: 45
|
||||||
color: app.theme_cls.primary_color
|
color: app.theme_cls.primary_color
|
||||||
shorten: False
|
shorten: False
|
||||||
|
halign: "center"
|
||||||
Label:
|
Label:
|
||||||
text: "upcoming"
|
text: "upcoming"
|
||||||
font_size: 25
|
bold: True
|
||||||
|
italic: True
|
||||||
|
font_size: 35
|
||||||
pos_hint: {"y": -0.05}
|
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
|
||||||
text: "Upcoming Songs will appear here"
|
text: "Upcoming Songs will appear here"
|
||||||
pos_hint: {"y": -0.25}
|
pos_hint: {"y": -0.25}
|
||||||
font_size: 20
|
font_size: 30
|
||||||
color: app.theme_cls.primary_color
|
color: app.theme_cls.primary_color
|
||||||
shorten: False
|
shorten: False
|
||||||
|
halign: "center"
|
||||||
Button:
|
Button:
|
||||||
text: "back"
|
text: "back"
|
||||||
font_size: 10
|
font_size: 10
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class Player:
|
|||||||
self.__imports = []
|
self.__imports = []
|
||||||
self.information = []
|
self.information = []
|
||||||
self.current_playing_pos = 0
|
self.current_playing_pos = 0
|
||||||
|
self.__songlength = 0
|
||||||
|
|
||||||
def start_playing(self):
|
def start_playing(self):
|
||||||
# initialize playing
|
# initialize playing
|
||||||
@@ -40,6 +41,7 @@ class Player:
|
|||||||
mx.music.pause()
|
mx.music.pause()
|
||||||
|
|
||||||
def infoupdater(self):
|
def infoupdater(self):
|
||||||
|
self.__songlength = mx.Sound(self.current_playing).get_length()
|
||||||
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)
|
||||||
@@ -50,12 +52,15 @@ class Player:
|
|||||||
try:
|
try:
|
||||||
bin.info_handler.InfoHandler().infohandler(self.listinfo, self.pathtr)
|
bin.info_handler.InfoHandler().infohandler(self.listinfo, self.pathtr)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
cvw.chg_str("./data/config.csv", 0, 0, "1")
|
||||||
cvw.app_str("./data/songtemp.csv", self.information)
|
cvw.app_str("./data/songtemp.csv", self.information)
|
||||||
|
cvw.app_str("./data/songtemp.csv", [self.__songlength])
|
||||||
|
|
||||||
def musicmanager(self, inst, other):
|
def musicmanager(self, inst, other, backfeed):
|
||||||
self.start_playing()
|
self.start_playing()
|
||||||
self.infoupdater()
|
self.infoupdater()
|
||||||
while self.__running == 1:
|
while self.__running == 1:
|
||||||
|
backfeed.value = mx.music.get_pos() / 1000
|
||||||
if self.__recent_change < 1:
|
if self.__recent_change < 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@@ -77,7 +82,9 @@ class Player:
|
|||||||
self.infoupdater()
|
self.infoupdater()
|
||||||
|
|
||||||
elif other.value == 2:
|
elif other.value == 2:
|
||||||
mx.music.rewind()
|
mx.music.unload()
|
||||||
|
mx.music.load(self.current_playing)
|
||||||
|
mx.music.play()
|
||||||
other.value = 0
|
other.value = 0
|
||||||
|
|
||||||
elif other.value == 3:
|
elif other.value == 3:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0,songlist.csv
|
0,songlist.csv
|
||||||
|
|||||||
|
@@ -1,2 +1,3 @@
|
|||||||
9
|
2
|
||||||
Tennessee Waltz - New 101 Strings Orchestra | Slow Walz (lansam),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 (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 | walzer/slow (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),Staiin' Alive - Begees | Discofox (Mittel),Easy On Me - Adele | Langsam (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)
|
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)
|
||||||
|
191.33242797851562
|
||||||
|
|||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
|
# os.environ["KIVY_NO_CONSOLELOG"] = "1"
|
||||||
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
|
||||||
@@ -12,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 math
|
||||||
|
|
||||||
|
|
||||||
pl = bin.player.Player()
|
pl = bin.player.Player()
|
||||||
@@ -87,6 +88,7 @@ class Main(MDScreen):
|
|||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.instructions = multiprocessing.Value('i', 0)
|
self.instructions = multiprocessing.Value('i', 0)
|
||||||
self.others = multiprocessing.Value('i', 0)
|
self.others = multiprocessing.Value('i', 0)
|
||||||
|
self.backfeed = multiprocessing.Value('f', 0)
|
||||||
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
|
||||||
@@ -123,14 +125,18 @@ class Main(MDScreen):
|
|||||||
if self.mplayer.is_alive() is True:
|
if self.mplayer.is_alive() is True:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
cvw.chg_str("./data/config.csv", 0, 0, "0")
|
||||||
self.instructions = multiprocessing.Value('i', 0)
|
self.instructions = multiprocessing.Value('i', 0)
|
||||||
self.others = multiprocessing.Value('i', 0)
|
self.others = multiprocessing.Value('i', 0)
|
||||||
self.mplayer = multiprocessing.Process(name="player", target=pl.musicmanager, args=(self.instructions, self.others,))
|
self.backfeed = multiprocessing.Value('f', 0)
|
||||||
|
self.mplayer = multiprocessing.Process(name="player", target=pl.musicmanager, args=(self.instructions, self.others, self.backfeed,))
|
||||||
self.mplayer.start()
|
self.mplayer.start()
|
||||||
except:
|
except AttributeError:
|
||||||
|
cvw.chg_str("./data/config.csv", 0, 0, "0")
|
||||||
self.instructions = multiprocessing.Value('i', 0)
|
self.instructions = multiprocessing.Value('i', 0)
|
||||||
self.others = multiprocessing.Value('i', 0)
|
self.others = multiprocessing.Value('i', 0)
|
||||||
self.mplayer = multiprocessing.Process(name="player", target=pl.musicmanager, args=(self.instructions, self.others,))
|
self.backfeed = multiprocessing.Value('f', 0)
|
||||||
|
self.mplayer = multiprocessing.Process(name="player", target=pl.musicmanager, args=(self.instructions, self.others, self.backfeed,))
|
||||||
self.mplayer.start()
|
self.mplayer.start()
|
||||||
|
|
||||||
def playmusic(self):
|
def playmusic(self):
|
||||||
@@ -161,11 +167,22 @@ class Main(MDScreen):
|
|||||||
self.manager.transition.direction = "right"
|
self.manager.transition.direction = "right"
|
||||||
|
|
||||||
def screen_updating(self, waste):
|
def screen_updating(self, waste):
|
||||||
|
self.__windowsize = Window._get_size()
|
||||||
|
self.__windowsize_x = self.__windowsize[0]
|
||||||
|
self.__windowsize_y = self.__windowsize[1]
|
||||||
|
self.__text_size = round(math.sqrt(((self.__windowsize_x + self.__windowsize_y) / 2)), 0)
|
||||||
|
self.manager.get_screen("Showcase").ids.current_song.font_size = self.__text_size + 5
|
||||||
|
self.manager.get_screen("Showcase").ids.upcoming_songs.font_size = self.__text_size - 5
|
||||||
self.__config = cvr.importing("./data/config.csv").pop(0)
|
self.__config = cvr.importing("./data/config.csv").pop(0)
|
||||||
|
self.__config.pop(1)
|
||||||
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.__songlinfo = self.__info.pop(0)
|
||||||
|
self.__songpos = self.backfeed.value
|
||||||
|
self.__songdisplay = int(self.__songpos / float(self.__songlinfo.pop(0)) * 100)
|
||||||
|
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.ids.current_song.text = self.__current[:(len(self.__current) - 4)]
|
||||||
@@ -217,8 +234,8 @@ class MusicPlayer(MDApp):
|
|||||||
def build(self):
|
def build(self):
|
||||||
Window.bind(on_request_close=self.on_request_close)
|
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 = "Blue"
|
||||||
self.theme_cls.accent_palette = "BlueGray"
|
self.theme_cls.accent_palette = "Gray"
|
||||||
# self.icon = "./BiogasControllerAppLogo.png"
|
# self.icon = "./BiogasControllerAppLogo.png"
|
||||||
return Builder.load_file("./bin/gui/gui.kv")
|
return Builder.load_file("./bin/gui/gui.kv")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user