Add fuzzy and text-classification light model #1

Merged
Tjiho merged 18 commits from fuzzy into master 2025-02-01 01:35:11 +01:00
2 changed files with 14 additions and 12 deletions
Showing only changes of commit 8ef51b2967 - Show all commits

View file

@ -32,14 +32,14 @@ class Mpd():
self.client.disconnect()
def play_genre(self, genre):
res = ""
self.client.connect(self.ip, self.port)
logging.debug('Listing '+self.normalize_genre(genre))
list_album = []
try:
# todo: select only one album instead of the artist
list_album = self.client.lsinfo(
"Subsonic/Genre/"+self.normalize_genre(genre))
except:
list_album = []
if (list_album):
random_album = random.choice(list_album)["directory"]
@ -47,9 +47,12 @@ class Mpd():
res = "C'est parti !"
else:
res = "Je n\'ai rien trouvé."
except:
res = "Il y a eu une erreur durant le lancement de la musique"
finally:
self.client.close()
self.client.disconnect()
return res
def play_album(self, directory):

View file

@ -69,8 +69,7 @@ class Ratatouille():
elif command == "LightOff":
return self.light_off_single(payload['intentArg'][0])
elif command == "PlayMusicGenre":
self.play_genre(payload['intentArg'][0])
return 'Lancement de la musique...'
return self.mopidy.play_genre(payload['intentArg'][0])
return '42'
def weather_query(self, entities):