core: Add PlaylistsController.get_uri_schemes().

This commit is contained in:
Thomas Kemmer 2015-12-13 19:02:33 +01:00
parent ede5b8abff
commit ef1468d8d6
4 changed files with 19 additions and 0 deletions

View File

@ -161,6 +161,8 @@ Playlists controller
.. class:: mopidy.core.PlaylistsController
.. automethod:: mopidy.core.PlaylistsController.get_uri_schemes
Fetching
--------

View File

@ -20,6 +20,9 @@ Core API
seek target while a seek is in progress. This gives better results than just
failing the position query. (Fixes: :issue:`312` PR: :issue:`1346`)
- Add :meth:`mopidy.core.PlaylistsController.get_uri_schemes`. (PR:
:issue:`1362`)
Models
------

View File

@ -33,6 +33,16 @@ class PlaylistsController(object):
self.backends = backends
self.core = core
def get_uri_schemes(self):
"""
Get the list of URI schemes that support playlists.
:rtype: list of string
.. versionadded:: 1.2
"""
return list(sorted(self.backends.with_playlists.keys()))
def as_list(self):
"""
Get a list of the currently available playlists.

View File

@ -248,6 +248,10 @@ class PlaylistTest(BasePlaylistsTest):
self.assertFalse(self.sp1.save.called)
self.assertFalse(self.sp2.save.called)
def test_get_uri_schemes(self):
result = self.core.playlists.get_uri_schemes()
self.assertEquals(result, ['dummy1', 'dummy2'])
class DeprecatedFilterPlaylistsTest(BasePlaylistsTest):