summaryrefslogtreecommitdiff
path: root/client/conversation.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-05-26 15:33:22 -0400
committerschneefux <schneefux+commit@schneefux.xyz>2014-05-26 15:33:22 -0400
commiteb5941d74b806653f519bac25f9efe0436749892 (patch)
tree4d330e1e8c74db2f170f828da88573f9148e4c82 /client/conversation.py
parentcb090a02a9c168abfb9d5b4c01111893bc5a7304 (diff)
downloadjasper-client-eb5941d74b806653f519bac25f9efe0436749892.tar.gz
jasper-client-eb5941d74b806653f519bac25f9efe0436749892.zip
spotify error handling
Diffstat (limited to 'client/conversation.py')
-rwxr-xr-xclient/conversation.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/client/conversation.py b/client/conversation.py
index 6e994a2..29a8e89 100755
--- a/client/conversation.py
+++ b/client/conversation.py
@@ -1,7 +1,7 @@
from notifier import Notifier
from musicmode import *
from brain import Brain
-
+from mpd import MPDClient
class Conversation(object):
@@ -17,6 +17,16 @@ class Conversation(object):
# check if input is meant to start the music module
if any(x in text.upper() for x in ["SPOTIFY","MUSIC"]):
+ # check if mpd client is running
+ try:
+ client = MPDClient()
+ client.timeout = None
+ client.idletimeout = None
+ client.connect("localhost", 6600)
+ except:
+ self.mic.say("I'm sorry. It seems that Spotify is not enabled. Please read the documentation to learn how to configure Spotify.")
+ return
+
self.mic.say("Please give me a moment, I'm loading your Spotify playlists.")
music_mode = MusicMode(self.persona, self.mic)
music_mode.handleForever()