Musik ersetzt Audiostream wenn neues Genre gefragt wird
This commit is contained in:
Binary file not shown.
7
main.py
7
main.py
@@ -19,8 +19,6 @@ music_should_resume = False
|
|||||||
music_was_playing = False
|
music_was_playing = False
|
||||||
|
|
||||||
|
|
||||||
#test
|
|
||||||
|
|
||||||
# =========================
|
# =========================
|
||||||
# KONFIGURATION
|
# KONFIGURATION
|
||||||
# =========================
|
# =========================
|
||||||
@@ -318,14 +316,15 @@ def status_wecker_skill(slots):
|
|||||||
return f"Es ist kein Wecker gestellt"
|
return f"Es ist kein Wecker gestellt"
|
||||||
|
|
||||||
def play_music_skill(slots):
|
def play_music_skill(slots):
|
||||||
|
|
||||||
genre = slots["genre"]
|
genre = slots["genre"]
|
||||||
|
|
||||||
if not music_player.load_genre(genre):
|
if not music_player.load_genre(genre):
|
||||||
return f"Keine Musik im Genre {genre} gefunden"
|
return f"Keine Musik im Genre {genre} gefunden"
|
||||||
|
|
||||||
|
speak(f"{genre} Musik wird abgespielt")
|
||||||
|
|
||||||
music_player.play()
|
music_player.play()
|
||||||
return f"{genre} Musik wird abgespielt"
|
return ""
|
||||||
|
|
||||||
def pause_music_skill(slots):
|
def pause_music_skill(slots):
|
||||||
music_player.pause()
|
music_player.pause()
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ class MusicPlayer:
|
|||||||
if not os.path.isdir(folder):
|
if not os.path.isdir(folder):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if self.playing or self.paused:
|
||||||
|
self.player.stop()
|
||||||
|
self.playing = False
|
||||||
|
self.paused = False
|
||||||
|
|
||||||
|
|
||||||
self.files = [
|
self.files = [
|
||||||
os.path.join(folder, f)
|
os.path.join(folder, f)
|
||||||
for f in os.listdir(folder)
|
for f in os.listdir(folder)
|
||||||
|
|||||||
Reference in New Issue
Block a user