Remove stored_playlists.rename() (#217)

This commit is contained in:
Stein Magnus Jodal 2012-10-31 15:25:39 +01:00
parent 06bcad2db9
commit f9f6f9394d
5 changed files with 3 additions and 44 deletions

View File

@ -67,6 +67,9 @@ backends:
playlist. The returned playlist may differ from the saved playlist, and
should thus be used instead of the playlist passed to ``save()``.
- :meth:`mopidy.core.StoredPlaylistsController.rename` has been removed,
since renaming can be done with ``save()``.
**Changes**
- Made the :mod:`NAD mixer <mopidy.audio.mixers.nad>` responsive to interrupts

View File

@ -204,14 +204,6 @@ class BaseStoredPlaylistsProvider(object):
"""
raise NotImplementedError
def rename(self, playlist, new_name):
"""
See :meth:`mopidy.core.StoredPlaylistsController.rename`.
*MUST be implemented by subclass.*
"""
raise NotImplementedError
def save(self, playlist):
"""
See :meth:`mopidy.core.StoredPlaylistsController.save`.

View File

@ -64,19 +64,6 @@ class LocalStoredPlaylistsProvider(base.BaseStoredPlaylistsProvider):
self.playlists = playlists
def rename(self, playlist, name):
if playlist not in self._playlists:
return
src = os.path.join(self._folder, playlist.name + '.m3u')
dst = os.path.join(self._folder, name + '.m3u')
renamed = playlist.copy(name=name)
index = self._playlists.index(playlist)
self._playlists[index] = renamed
shutil.move(src, dst)
def save(self, playlist):
assert playlist.uri, 'Cannot save playlist without URI'

View File

@ -119,19 +119,6 @@ class StoredPlaylistsController(object):
backend = self.backends.by_uri_scheme[uri_scheme]
backend.stored_playlists.refresh().get()
def rename(self, playlist, new_name):
"""
Rename playlist.
:param playlist: the playlist
:type playlist: :class:`mopidy.models.Playlist`
:param new_name: the new name
:type new_name: string
"""
# TODO Support multiple backends
return self.backends[0].stored_playlists.rename(
playlist, new_name).get()
def save(self, playlist):
"""
Save the playlist to the set of stored playlists.

View File

@ -103,16 +103,6 @@ class StoredPlaylistsControllerTest(object):
def test_refresh(self):
pass
def test_rename(self):
playlist = self.stored.create('test')
self.stored.rename(playlist, 'test2')
self.stored.get(name='test2')
def test_rename_unknown_playlist(self):
self.stored.rename(Playlist(), 'test2')
test = lambda: self.stored.get(name='test2')
self.assertRaises(LookupError, test)
def test_save_replaces_stored_playlist_with_updated_playlist(self):
playlist1 = self.stored.create('test1')
self.assertIn(playlist1, self.stored.playlists)