summaryrefslogtreecommitdiff
path: root/nephilim/mpclient.py
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-09-12 20:15:06 +0200
committerAnton Khirnov <wyskas@gmail.com>2009-09-12 20:15:06 +0200
commit530265c9aeb58f8b0120675a90d8ee94638e775c (patch)
tree4c955692a5288abf8128e108f41b0b096fde88d2 /nephilim/mpclient.py
parentbe7260ad246f033479b0a5e4a84bc94ac2dba604 (diff)
Playlist: allow dropping items from library.
Diffstat (limited to 'nephilim/mpclient.py')
-rw-r--r--nephilim/mpclient.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/nephilim/mpclient.py b/nephilim/mpclient.py
index b2e2116..328394f 100644
--- a/nephilim/mpclient.py
+++ b/nephilim/mpclient.py
@@ -319,7 +319,7 @@ class MPClient(QtCore.QObject):
if not self.__check_command_ok('clear'):
return
self._client.clear()
- def add(self, paths):
+ def add(self, paths, pos = -1):
"""Add all files in paths to the current playlist."""
if not self.__check_command_ok('addid'):
return
@@ -328,7 +328,11 @@ class MPClient(QtCore.QObject):
try:
for path in paths:
self.logger.info('Adding %s to playlist'%path)
- self._client.addid(path.encode('utf-8'))
+ 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)