Add fuzzy and text-classification light model #1
2 changed files with 6 additions and 6 deletions
4
main.py
4
main.py
|
@ -18,12 +18,12 @@ logging.basicConfig(
|
||||||
format="%(asctime)s %(filename)s:%(lineno)s %(levelname)s %(message)s"
|
format="%(asctime)s %(filename)s:%(lineno)s %(levelname)s %(message)s"
|
||||||
)
|
)
|
||||||
|
|
||||||
IP = "10.10.10.11"
|
IP = "10.10.10.8"
|
||||||
PORT = 5555
|
PORT = 5555
|
||||||
|
|
||||||
walle = Hass(config.hass_url, config.hass_token)
|
walle = Hass(config.hass_url, config.hass_token)
|
||||||
yoda = None # Rhasspy(config.rhasspy_url)
|
yoda = None # Rhasspy(config.rhasspy_url)
|
||||||
# mopidy = Mpd('10.10.10.10', yoda)
|
mopidy = Mpd('10.10.10.8')
|
||||||
ratatouille = Ratatouille(yoda, walle, mopidy, schedule)
|
ratatouille = Ratatouille(yoda, walle, mopidy, schedule)
|
||||||
# alexa = AlexaIntent() # we are not doing any request to the evil amazon but we are using one of its dataset
|
# alexa = AlexaIntent() # we are not doing any request to the evil amazon but we are using one of its dataset
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,13 @@ from mpd import MPDClient
|
||||||
|
|
||||||
class Mpd():
|
class Mpd():
|
||||||
|
|
||||||
def __init__(self, ip, yoda):
|
def __init__(self, ip):
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
self.port = 6600
|
self.port = 6600
|
||||||
self.client = MPDClient() # create client object
|
self.client = MPDClient() # create client object
|
||||||
# network timeout in seconds (floats allowed), default: None
|
# network timeout in seconds (floats allowed), default: None
|
||||||
self.client.timeout = 10
|
self.client.timeout = 10
|
||||||
self.client.idletimeout = None
|
self.client.idletimeout = None
|
||||||
self.yoda = yoda
|
|
||||||
|
|
||||||
self.client.connect(ip, self.port)
|
self.client.connect(ip, self.port)
|
||||||
logging.debug(self.client.mpd_version)
|
logging.debug(self.client.mpd_version)
|
||||||
|
@ -45,15 +44,16 @@ class Mpd():
|
||||||
if (list_album):
|
if (list_album):
|
||||||
random_album = random.choice(list_album)["directory"]
|
random_album = random.choice(list_album)["directory"]
|
||||||
self.play_album(random_album)
|
self.play_album(random_album)
|
||||||
|
return "C'est parti !"
|
||||||
else:
|
else:
|
||||||
self.yoda.say("Je n\'ai rien trouvé")
|
return "Je n\'ai rien trouvé."
|
||||||
|
|
||||||
self.client.close()
|
self.client.close()
|
||||||
self.client.disconnect()
|
self.client.disconnect()
|
||||||
|
|
||||||
def play_album(self, directory):
|
def play_album(self, directory):
|
||||||
self.client.stop()
|
self.client.stop()
|
||||||
self.yoda.say("Lancement de "+directory.split('/')[-1])
|
# self.yoda.say("Lancement de "+directory.split('/')[-1])
|
||||||
logging.debug('Playing '+directory)
|
logging.debug('Playing '+directory)
|
||||||
self.client.clear()
|
self.client.clear()
|
||||||
self.client.add(directory)
|
self.client.add(directory)
|
||||||
|
|
Loading…
Add table
Reference in a new issue