diff --git a/docs/changelog.rst b/docs/changelog.rst index bbf03bfb..60fcafbd 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -57,12 +57,16 @@ MPD frontend instead of "A, B". This is a part of updating our protocol implementation to match MPD 0.19. (PR: :issue:`1213`) -- Add skeletons of new or otherwise missing MPD commands that return a "not - implemented" error: +- Add "not implemented" skeletons of new commands in the MPD protocol version + 0.19: - ``rangeid`` - ``addtagid`` - ``cleartagid`` + - ``mount`` + - ``unmount`` + - ``listmounts`` + - ``listneighbors`` File backend ------------ diff --git a/docs/modules/mpd.rst b/docs/modules/mpd.rst index 83650c39..7beadfdd 100644 --- a/docs/modules/mpd.rst +++ b/docs/modules/mpd.rst @@ -71,6 +71,14 @@ Current playlist :members: +Mounts and neighbors +-------------------- + +.. automodule:: mopidy.mpd.protocol.mount + :synopsis: MPD protocol: mounts and neighbors + :members: + + Music database -------------- diff --git a/mopidy/mpd/protocol/__init__.py b/mopidy/mpd/protocol/__init__.py index b69d5a2a..99294f4d 100644 --- a/mopidy/mpd/protocol/__init__.py +++ b/mopidy/mpd/protocol/__init__.py @@ -33,7 +33,8 @@ def load_protocol_modules(): """ from . import ( # noqa audio_output, channels, command_list, connection, current_playlist, - music_db, playback, reflection, status, stickers, stored_playlists) + mount, music_db, playback, reflection, status, stickers, + stored_playlists) def INT(value): # noqa: N802 diff --git a/mopidy/mpd/protocol/mount.py b/mopidy/mpd/protocol/mount.py new file mode 100644 index 00000000..bb9e7ed6 --- /dev/null +++ b/mopidy/mpd/protocol/mount.py @@ -0,0 +1,78 @@ +from __future__ import absolute_import, unicode_literals + +from mopidy.mpd import exceptions, protocol + + +@protocol.commands.add('mount') +def mount(context, path, uri): + """ + *musicpd.org, mounts and neighbors section:* + + ``mount {PATH} {URI}`` + + Mount the specified remote storage URI at the given path. Example:: + + mount foo nfs://192.168.1.4/export/mp3 + + .. versionadded:: MPD protocol 0.19 + """ + raise exceptions.MpdNotImplemented # TODO + + +@protocol.commands.add('unmount') +def unmount(context, path): + """ + *musicpd.org, mounts and neighbors section:* + + ``unmount {PATH}`` + + Unmounts the specified path. Example:: + + unmount foo + + .. versionadded:: MPD protocol 0.19 + """ + raise exceptions.MpdNotImplemented # TODO + + +@protocol.commands.add('listmounts') +def listmounts(context): + """ + *musicpd.org, mounts and neighbors section:* + + ``listmounts`` + + Queries a list of all mounts. By default, this contains just the + configured music_directory. Example:: + + listmounts + mount: + storage: /home/foo/music + mount: foo + storage: nfs://192.168.1.4/export/mp3 + OK + + .. versionadded:: MPD protocol 0.19 + """ + raise exceptions.MpdNotImplemented # TODO + + +@protocol.commands.add('listneighbors') +def listneighbors(context): + """ + *musicpd.org, mounts and neighbors section:* + + ``listneighbors`` + + Queries a list of "neighbors" (e.g. accessible file servers on the + local net). Items on that list may be used with the mount command. + Example:: + + listneighbors + neighbor: smb://FOO + name: FOO (Samba 4.1.11-Debian) + OK + + .. versionadded:: MPD protocol 0.19 + """ + raise exceptions.MpdNotImplemented # TODO diff --git a/tests/mpd/protocol/test_mount.py b/tests/mpd/protocol/test_mount.py new file mode 100644 index 00000000..c599ff46 --- /dev/null +++ b/tests/mpd/protocol/test_mount.py @@ -0,0 +1,22 @@ +from __future__ import absolute_import, unicode_literals + +from tests.mpd import protocol + + +class MountTest(protocol.BaseTestCase): + + def test_mount(self): + self.send_request('mount my_disk /dev/sda') + self.assertEqualResponse('ACK [0@0] {mount} Not implemented') + + def test_unmount(self): + self.send_request('unmount my_disk') + self.assertEqualResponse('ACK [0@0] {unmount} Not implemented') + + def test_listmounts(self): + self.send_request('listmounts') + self.assertEqualResponse('ACK [0@0] {listmounts} Not implemented') + + def test_listneighbors(self): + self.send_request('listneighbors') + self.assertEqualResponse('ACK [0@0] {listneighbors} Not implemented')