[Pkg-mpd-commits] [python-mpd] 144/262: Imported Upstream version 0.4.3

Simon McVittie smcv at debian.org
Sun May 22 18:16:39 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch upstream
in repository python-mpd.

commit 5613a84f26fcda64b4ad0279b832d7d277f489e0
Author: kaliko <efrim at azylum.org>
Date:   Sat Jul 21 16:58:11 2012 +0200

    Imported Upstream version 0.4.3
---
 CHANGES.txt      |  7 +++++++
 README.md        | 11 +++++++++--
 doc/commands.txt |  7 +++++--
 mpd.py           |  7 ++++++-
 test.py          |  5 +++++
 5 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 2244ecb..33e92cd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,13 @@
 python-mpd2 Changes List
 ========================
 
+Changes in 0.4.3
+----------------
+
+* add searchadd and searchaddpl command
+* fix commands without a callback function
+* transform MPDClient to new style class
+
 Changes in 0.4.2
 ----------------
 
diff --git a/README.md b/README.md
index b2ad025..360f9e1 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,8 @@ Current features list:
 
  - python3 support (python2.6 is minimum python version required)
  - support for the upcoming client-to-client protocol
- - adding new commands of mpd v0.17 (seekcur, prio, prioid, config)
+ - adding new commands of mpd v0.17 (seekcur, prio, prioid, config, searchadd,
+   searchaddpl)
  - remove of deprecated commands (volume)
  - declare mpd commands explicit as method, so they are shown in ipython
  - add unit tests
@@ -147,7 +148,7 @@ To quote the mpd protocol documentation:
 
 In python3 unicode strings are default string type. So just pass these strings as arguments for mpd commands.
 
-For backward compatibility with python-mpd the python2 version accept both unicode strings (ex. u"♥") and unicoded encoded 8-bit strings (ex. "♥").
+For backward compatibility with python-mpd the python2 version accept both unicode strings (ex. u"♥") and unicode encoded 8-bit strings (ex. "♥").
 It returns unicode encoded strings by default for the same reason.
 
 Using unicode strings should be prefered as it makes the transition to python3 easier.
@@ -183,6 +184,12 @@ self.client.add_command("get_cover", fetch_cover)
 self.client.remove_command("get_cover")
 ```
 
+Known Issues
+------------
+
+Currently python-mpd is **NOT** thread-safe. If you need to access the library from multiple threads, you have to either use [locks](http://docs.python.org/library/threading.html#lock-objects) or use one mpd client per thread.
+
+
 Contacting the author
 ---------------------
 
diff --git a/doc/commands.txt b/doc/commands.txt
index 8da8101..97dcea7 100644
--- a/doc/commands.txt
+++ b/doc/commands.txt
@@ -44,8 +44,8 @@ playlistinfo       [<int>]                 -> fetch_songs
 playlistsearch     <locate>                -> fetch_songs
 plchanges          <int>                   -> fetch_songs
 plchangesposid     <int>                   -> fetch_changes
-prior              <int> <str>             -> fetch_nothing
-priorid            <int> <id>              -> fetch_nothing
+prio               <int> <str>             -> fetch_nothing
+prioid             <int> <id>              -> fetch_nothing
 shuffle            [<str>]                 -> fetch_nothing
 swap               <int> <int>             -> fetch_nothing
 swapid             <int> <int>             -> fetch_nothing
@@ -72,6 +72,8 @@ listall            [<str>]                 -> fetch_database
 listallinfo        [<str>]                 -> fetch_database
 lsinfo             [<str>]                 -> fetch_database
 search             <locate>                -> fetch_songs
+searchadd          <locate>                -> fetch_songs
+searchaddpl        <str> <locate>          -> fetch_songs
 update             [<str>]                 -> fetch_item
 rescan             [<str>]                 -> fetch_item
 
@@ -94,6 +96,7 @@ enableoutput       <int>                   -> fetch_nothing
 outputs                                    -> fetch_outputs
 
 == Reflection Commands
+config                                     -> fetch_item
 commands                                   -> fetch_list
 notcommands                                -> fetch_list
 tagtypes                                   -> fetch_list
diff --git a/mpd.py b/mpd.py
index 617a3c5..de73609 100644
--- a/mpd.py
+++ b/mpd.py
@@ -131,6 +131,8 @@ _commands = {
     "listallinfo":        "_fetch_database",
     "lsinfo":             "_fetch_database",
     "search":             "_fetch_songs",
+    "searchadd":          "_fetch_nothing",
+    "searchaddpl":        "_fetch_nothing",
     "update":             "_fetch_item",
     "rescan":             "_fetch_item",
     # Sticker Commands
@@ -163,7 +165,7 @@ _commands = {
     "sendmessage":        "_fetch_nothing",
 }
 
-class MPDClient():
+class MPDClient(object):
     def __init__(self, use_unicode=False):
         self.iterate = False
         self.use_unicode = use_unicode
@@ -482,6 +484,9 @@ class MPDClient():
 
 def bound_decorator(self, function):
     """ bind decorator to self """
+    if not isinstance(function, Callable):
+        return None
+
     def decorator(*args, **kwargs):
         return function(self, *args, **kwargs)
     return decorator
diff --git a/test.py b/test.py
index ad3bc3c..c1f0866 100755
--- a/test.py
+++ b/test.py
@@ -197,6 +197,11 @@ class TestMPDClient(unittest.TestCase):
     def test_numbers_as_command_args(self):
         res = self.client.find("file", 1)
 
+    def test_empty_callbacks(self):
+        self.client.close()
+        self.client._reset()
+        self.client.connect(TEST_MPD_HOST, TEST_MPD_PORT)
+
     def test_timeout(self):
         self.client.disconnect()
         self.client.connect(TEST_MPD_HOST, TEST_MPD_PORT, timeout=5)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git



More information about the Pkg-mpd-commits mailing list