diff options
author | Anton Khirnov <wyskas@gmail.com> | 2009-09-30 06:36:40 +0200 |
---|---|---|
committer | Anton Khirnov <wyskas@gmail.com> | 2009-09-30 06:36:40 +0200 |
commit | 78815da4d1982cbed928ea9c149d62146ec628b8 (patch) | |
tree | 035b832609ae411b8e7f92cc3f9fb4e910537136 | |
parent | 9e8127f5fe0b0efe994f29380f65e79f25a694cf (diff) |
mpclient: in add() put only command_list_end under try/except
-rw-r--r-- | nephilim/mpclient.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/nephilim/mpclient.py b/nephilim/mpclient.py index 4d59185..66d1aa1 100644 --- a/nephilim/mpclient.py +++ b/nephilim/mpclient.py @@ -280,14 +280,14 @@ class MPClient(QtCore.QObject): return ret = None self._client.command_list_ok_begin() + for path in paths: + self.logger.info('Adding %s to playlist'%path) + if pos < 0: + self._client.addid(path.encode('utf-8')) + else: + self._client.addid(path.encode('utf-8'), pos) + pos += 1 try: - for path in paths: - self.logger.info('Adding %s to playlist'%path) - if pos < 0: - self._client.addid(path.encode('utf-8')) - else: - self._client.addid(path.encode('utf-8'), pos) - pos += 1 ret = list(self._client.command_list_end()) except mpd.CommandError, e: self.logger.error('Error adding files: %s.'%e) |