Add fuzzy and text-classification light model #1
					 2 changed files with 6 additions and 6 deletions
				
			
		Fix mpd
				commit
				
					
					
						faadd1f4e0
					
				
			
		
							
								
								
									
										4
									
								
								main.py
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								main.py
									
										
									
									
									
								
							|  | @ -18,12 +18,12 @@ logging.basicConfig( | |||
|     format="%(asctime)s %(filename)s:%(lineno)s %(levelname)s %(message)s" | ||||
| ) | ||||
| 
 | ||||
| IP = "10.10.10.11" | ||||
| IP = "10.10.10.8" | ||||
| PORT = 5555 | ||||
| 
 | ||||
| walle = Hass(config.hass_url, config.hass_token) | ||||
| 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) | ||||
| # 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(): | ||||
| 
 | ||||
|     def __init__(self, ip, yoda): | ||||
|     def __init__(self, ip): | ||||
|         self.ip = ip | ||||
|         self.port = 6600 | ||||
|         self.client = MPDClient()               # create client object | ||||
|         # network timeout in seconds (floats allowed), default: None | ||||
|         self.client.timeout = 10 | ||||
|         self.client.idletimeout = None | ||||
|         self.yoda = yoda | ||||
| 
 | ||||
|         self.client.connect(ip, self.port) | ||||
|         logging.debug(self.client.mpd_version) | ||||
|  | @ -45,15 +44,16 @@ class Mpd(): | |||
|         if (list_album): | ||||
|             random_album = random.choice(list_album)["directory"] | ||||
|             self.play_album(random_album) | ||||
|             return "C'est parti !" | ||||
|         else: | ||||
|             self.yoda.say("Je n\'ai rien trouvé") | ||||
|             return "Je n\'ai rien trouvé." | ||||
| 
 | ||||
|         self.client.close() | ||||
|         self.client.disconnect() | ||||
| 
 | ||||
|     def play_album(self, directory): | ||||
|         self.client.stop() | ||||
|         self.yoda.say("Lancement de "+directory.split('/')[-1]) | ||||
|         # self.yoda.say("Lancement de "+directory.split('/')[-1]) | ||||
|         logging.debug('Playing '+directory) | ||||
|         self.client.clear() | ||||
|         self.client.add(directory) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue