mpd: Add mount/unmount/listmounts/listneighbors command skeletons
This commit is contained in:
parent
21a3b74e9b
commit
2135b1372a
@ -57,12 +57,16 @@ MPD frontend
|
|||||||
instead of "A, B". This is a part of updating our protocol implementation to
|
instead of "A, B". This is a part of updating our protocol implementation to
|
||||||
match MPD 0.19. (PR: :issue:`1213`)
|
match MPD 0.19. (PR: :issue:`1213`)
|
||||||
|
|
||||||
- Add skeletons of new or otherwise missing MPD commands that return a "not
|
- Add "not implemented" skeletons of new commands in the MPD protocol version
|
||||||
implemented" error:
|
0.19:
|
||||||
|
|
||||||
- ``rangeid``
|
- ``rangeid``
|
||||||
- ``addtagid``
|
- ``addtagid``
|
||||||
- ``cleartagid``
|
- ``cleartagid``
|
||||||
|
- ``mount``
|
||||||
|
- ``unmount``
|
||||||
|
- ``listmounts``
|
||||||
|
- ``listneighbors``
|
||||||
|
|
||||||
File backend
|
File backend
|
||||||
------------
|
------------
|
||||||
|
|||||||
@ -71,6 +71,14 @@ Current playlist
|
|||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
|
||||||
|
Mounts and neighbors
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
.. automodule:: mopidy.mpd.protocol.mount
|
||||||
|
:synopsis: MPD protocol: mounts and neighbors
|
||||||
|
:members:
|
||||||
|
|
||||||
|
|
||||||
Music database
|
Music database
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,8 @@ def load_protocol_modules():
|
|||||||
"""
|
"""
|
||||||
from . import ( # noqa
|
from . import ( # noqa
|
||||||
audio_output, channels, command_list, connection, current_playlist,
|
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
|
def INT(value): # noqa: N802
|
||||||
|
|||||||
78
mopidy/mpd/protocol/mount.py
Normal file
78
mopidy/mpd/protocol/mount.py
Normal 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
|
||||||
22
tests/mpd/protocol/test_mount.py
Normal file
22
tests/mpd/protocol/test_mount.py
Normal 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')
|
||||||
Loading…
Reference in New Issue
Block a user