From ef1468d8d6b5d1cdb929ee1ecaf286da2cccde4e Mon Sep 17 00:00:00 2001 From: Thomas Kemmer Date: Sun, 13 Dec 2015 19:02:33 +0100 Subject: [PATCH] core: Add PlaylistsController.get_uri_schemes(). --- docs/api/core.rst | 2 ++ docs/changelog.rst | 3 +++ mopidy/core/playlists.py | 10 ++++++++++ tests/core/test_playlists.py | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/docs/api/core.rst b/docs/api/core.rst index ead6d651..aaa692d2 100644 --- a/docs/api/core.rst +++ b/docs/api/core.rst @@ -161,6 +161,8 @@ Playlists controller .. class:: mopidy.core.PlaylistsController +.. automethod:: mopidy.core.PlaylistsController.get_uri_schemes + Fetching -------- diff --git a/docs/changelog.rst b/docs/changelog.rst index 49b7f263..1fdd2af3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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 ------ diff --git a/mopidy/core/playlists.py b/mopidy/core/playlists.py index e3e2ac20..87790c25 100644 --- a/mopidy/core/playlists.py +++ b/mopidy/core/playlists.py @@ -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. diff --git a/tests/core/test_playlists.py b/tests/core/test_playlists.py index 029254a8..c908af6a 100644 --- a/tests/core/test_playlists.py +++ b/tests/core/test_playlists.py @@ -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):