mpd: Add mount/unmount/listmounts/listneighbors command skeletons

This commit is contained in:
Stein Magnus Jodal 2015-07-21 14:50:51 +02:00
parent 21a3b74e9b
commit 2135b1372a
5 changed files with 116 additions and 3 deletions

View File

@ -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
------------

View File

@ -71,6 +71,14 @@ Current playlist
:members:
Mounts and neighbors
--------------------
.. automodule:: mopidy.mpd.protocol.mount
:synopsis: MPD protocol: mounts and neighbors
:members:
Music database
--------------

View File

@ -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

View File

@ -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

View File

@ -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')