CurrentPlaylistController.remove() takes criterias
This commit is contained in:
parent
4ba30f80e4
commit
5eabc5a423
@ -31,6 +31,10 @@ We got an updated :doc:`release roadmap <development/roadmap>`!
|
||||
lists of :class:`mopidy.models.Track` instead of
|
||||
:class:`mopidy.models.Playlist`, as none of the other fields on the
|
||||
``Playlist`` model was in use.
|
||||
- :meth:`mopidy.backends.BaseCurrentPlaylistController.remove()`` now takes
|
||||
criterias, just like
|
||||
:meth:`mopidy.backends.BaseCurrentPlaylistController.get()``, instead of
|
||||
the track to remove.
|
||||
|
||||
|
||||
0.1.0a2 (2010-06-02)
|
||||
|
||||
@ -198,17 +198,19 @@ class BaseCurrentPlaylistController(object):
|
||||
to_position += 1
|
||||
self.tracks = new_tracks
|
||||
|
||||
def remove(self, track):
|
||||
def remove(self, **criteria):
|
||||
"""
|
||||
Remove the track from the current playlist.
|
||||
|
||||
:param track: track to remove
|
||||
Uses :meth:`get` to lookup the track to remove.
|
||||
|
||||
:param criteria: on or more criteria to match by
|
||||
:type criteria: dict
|
||||
:type track: :class:`mopidy.models.Track`
|
||||
"""
|
||||
track = self.get(**criteria)
|
||||
tracks = self.tracks
|
||||
|
||||
assert track in tracks, 'track must be in playlist'
|
||||
|
||||
position = tracks.index(track)
|
||||
del tracks[position]
|
||||
self.tracks = tracks
|
||||
|
||||
Loading…
Reference in New Issue
Block a user