From 48a0a0132c18a69be36b50bd35a05455e2c19acb Mon Sep 17 00:00:00 2001 From: Kaliko Jack Date: Fri, 7 Nov 2014 12:08:38 +0100 Subject: [PATCH] Add mounts and neighbors commands (MPD 0.19) --- CHANGES.txt | 2 ++ doc/commands.txt | 7 +++++++ musicpd.py | 13 ++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 921e0f6..a82e7ca 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,8 @@ Changes in 0.4.2 UNRELEASED ---------------- * Add unittest (requires mock) +* Add mounts and neighbors commands (mount, unmount, listmounts and + listneighbors) Changes in 0.4.1 ---------------- diff --git a/doc/commands.txt b/doc/commands.txt index 1ec938c..0e169c3 100644 --- a/doc/commands.txt +++ b/doc/commands.txt @@ -74,6 +74,13 @@ update [] -> fetch_item rescan [] -> fetch_item readcomments -> fetch_object +== Mounts and neighbors == + +mount -> self._fetch_nothing +unmount -> self._fetch_nothing +listmounts -> self._fetch_mounts +listneighbors -> self._fetch_neighbors + == Sticker Commands sticker get -> fetch_item sticker set -> fetch_nothing diff --git a/musicpd.py b/musicpd.py index 0fe3b67..8358ddc 100644 --- a/musicpd.py +++ b/musicpd.py @@ -1,6 +1,6 @@ # python-musicpd: Python MPD client library # Copyright (C) 2008-2010 J. Alexander Treuman -# Copyright (C) 2012-2013 Kaliko Jack +# Copyright (C) 2012-2014 Kaliko Jack # # python-musicpd is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -159,6 +159,11 @@ class MPDClient: "update": self._fetch_item, "rescan": self._fetch_item, "readcomments": self._fetch_object, + # Mounts and neighbors + "mount": self._fetch_nothing, + "unmount": self._fetch_nothing, + "listmounts": self._fetch_mounts, + "listneighbors": self._fetch_neighbors, # Sticker Commands "sticker get": self._fetch_item, "sticker set": self._fetch_nothing, @@ -405,6 +410,12 @@ class MPDClient: def _fetch_messages(self): return self._fetch_objects(["channel"]) + def _fetch_mounts(self): + return self._fetch_objects(["mount"]) + + def _fetch_neighbors(self): + return self._fetch_objects(["neighbor"]) + def _fetch_command_list(self): return self._wrap_iterator(self._read_command_list()) -- 2.39.2