From 530265c9aeb58f8b0120675a90d8ee94638e775c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 12 Sep 2009 20:15:06 +0200 Subject: Playlist: allow dropping items from library. --- nephilim/mpclient.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'nephilim/mpclient.py') 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) -- cgit v1.2.3