summaryrefslogtreecommitdiff
path: root/nephilim/mpd.py
diff options
context:
space:
mode:
Diffstat (limited to 'nephilim/mpd.py')
-rw-r--r--nephilim/mpd.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/nephilim/mpd.py b/nephilim/mpd.py
index bcdf3ac..560a225 100644
--- a/nephilim/mpd.py
+++ b/nephilim/mpd.py
@@ -157,15 +157,16 @@ class MPDClient(QtCore.QObject):
return retval
self._commandlist.append(retval)
- def _writeline(self, line):
- self._wfile.write("%s\n" % line)
- self._wfile.flush()
-
def _writecommand(self, command, args=[]):
parts = [command]
for arg in args:
parts.append('"%s"' % escape(str(arg)))
- self._writeline(" ".join(parts))
+ try:
+ self._wfile.write(' '.join(parts).encode('utf-8') + '\n')
+ self._wfile.flush()
+ except socket.error, e:
+ self.logger.error('Error sending command: %s.'%e)
+ self.disconnect_mpd()
def _readline(self):
line = self._rfile.readline()