Add fuzzy and text-classification light model #1
2 changed files with 14 additions and 12 deletions
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue