diff --git a/mopidy/core/playback.py b/mopidy/core/playback.py index 2e79827a..8b33140a 100644 --- a/mopidy/core/playback.py +++ b/mopidy/core/playback.py @@ -24,8 +24,6 @@ class PlaybackController(object): self.core = core self._state = PlaybackState.STOPPED - self._shuffled = [] - self._first_shuffle = True self._volume = None def _get_backend(self): @@ -37,22 +35,6 @@ class PlaybackController(object): ### Properties - def get_consume(self): - return getattr(self, '_consume', False) - - def set_consume(self, value): - if self.get_consume() != value: - self._trigger_options_changed() - return setattr(self, '_consume', value) - - consume = property(get_consume, set_consume) - """ - :class:`True` - Tracks are removed from the playlist when they have been played. - :class:`False` - Tracks are not removed from the playlist. - """ - def get_current_tl_track(self): return self.current_tl_track @@ -72,56 +54,6 @@ class PlaybackController(object): Read-only. Extracted from :attr:`current_tl_track` for convenience. """ - def get_random(self): - return getattr(self, '_random', False) - - def set_random(self, value): - if self.get_random() != value: - self._trigger_options_changed() - return setattr(self, '_random', value) - - random = property(get_random, set_random) - """ - :class:`True` - Tracks are selected at random from the playlist. - :class:`False` - Tracks are played in the order of the playlist. - """ - - def get_repeat(self): - return getattr(self, '_repeat', False) - - def set_repeat(self, value): - if self.get_repeat() != value: - self._trigger_options_changed() - return setattr(self, '_repeat', value) - - repeat = property(get_repeat, set_repeat) - """ - :class:`True` - The current playlist is played repeatedly. To repeat a single track, - select both :attr:`repeat` and :attr:`single`. - :class:`False` - The current playlist is played once. - """ - - def get_single(self): - return getattr(self, '_single', False) - - def set_single(self, value): - if self.get_single() != value: - self._trigger_options_changed() - return setattr(self, '_single', value) - - single = property(get_single, set_single) - """ - :class:`True` - Playback is stopped after current song, unless in :attr:`repeat` - mode. - :class:`False` - Playback continues after current song. - """ - def get_state(self): return self._state @@ -159,122 +91,6 @@ class PlaybackController(object): time_position = property(get_time_position) """Time position in milliseconds.""" - def get_tracklist_position(self): - if self.current_tl_track is None: - return None - try: - return self.core.tracklist.tl_tracks.index(self.current_tl_track) - except ValueError: - return None - - tracklist_position = property(get_tracklist_position) - """ - The position of the current track in the tracklist. - - Read-only. - """ - - def get_tl_track_at_eot(self): - # pylint: disable = R0911 - # Too many return statements - - tl_tracks = self.core.tracklist.tl_tracks - - if not tl_tracks: - return None - - if self.random and not self._shuffled: - if self.repeat or self._first_shuffle: - logger.debug('Shuffling tracks') - self._shuffled = tl_tracks - random.shuffle(self._shuffled) - self._first_shuffle = False - - if self.random and self._shuffled: - return self._shuffled[0] - - if self.current_tl_track is None: - return tl_tracks[0] - - if self.repeat and self.single: - return tl_tracks[self.tracklist_position] - - if self.repeat and not self.single: - return tl_tracks[(self.tracklist_position + 1) % len(tl_tracks)] - - try: - return tl_tracks[self.tracklist_position + 1] - except IndexError: - return None - - tl_track_at_eot = property(get_tl_track_at_eot) - """ - The track that will be played at the end of the current track. - - Read-only. A :class:`mopidy.models.TlTrack`. - - Not necessarily the same track as :attr:`tl_track_at_next`. - """ - - def get_tl_track_at_next(self): - tl_tracks = self.core.tracklist.tl_tracks - - if not tl_tracks: - return None - - if self.random and not self._shuffled: - if self.repeat or self._first_shuffle: - logger.debug('Shuffling tracks') - self._shuffled = tl_tracks - random.shuffle(self._shuffled) - self._first_shuffle = False - - if self.random and self._shuffled: - return self._shuffled[0] - - if self.current_tl_track is None: - return tl_tracks[0] - - if self.repeat: - return tl_tracks[(self.tracklist_position + 1) % len(tl_tracks)] - - try: - return tl_tracks[self.tracklist_position + 1] - except IndexError: - return None - - tl_track_at_next = property(get_tl_track_at_next) - """ - The track that will be played if calling :meth:`next()`. - - Read-only. A :class:`mopidy.models.TlTrack`. - - For normal playback this is the next track in the playlist. If repeat - is enabled the next track can loop around the playlist. When random is - enabled this should be a random track, all tracks should be played once - before the list repeats. - """ - - def get_tl_track_at_previous(self): - if self.repeat or self.consume or self.random: - return self.current_tl_track - - if self.tracklist_position in (None, 0): - return None - - return self.core.tracklist.tl_tracks[self.tracklist_position - 1] - - tl_track_at_previous = property(get_tl_track_at_previous) - """ - The track that will be played if calling :meth:`previous()`. - - A :class:`mopidy.models.TlTrack`. - - For normal playback this is the previous track in the playlist. If - random and/or consume is enabled it should return the current track - instead. - """ - def get_volume(self): if self.audio: return self.audio.get_volume().get() @@ -325,13 +141,13 @@ class PlaybackController(object): original_tl_track = self.current_tl_track - if self.tl_track_at_eot: + if self.core.tracklist.tl_track_at_eot: self._trigger_track_playback_ended() - self.play(self.tl_track_at_eot) + self.play(self.core.tracklist.tl_track_at_eot) else: self.stop(clear_current_track=True) - if self.consume: + if self.core.tracklist.consume: self.core.tracklist.remove(tlid=original_tl_track.tlid) def on_tracklist_change(self): @@ -340,8 +156,6 @@ class PlaybackController(object): Used by :class:`mopidy.core.TracklistController`. """ - self._first_shuffle = True - self._shuffled = [] if (not self.core.tracklist.tl_tracks or self.current_tl_track not in @@ -355,9 +169,9 @@ class PlaybackController(object): The current playback state will be kept. If it was playing, playing will continue. If it was paused, it will still be paused, etc. """ - if self.tl_track_at_next: + if self.core.tracklist.tl_track_at_next: self._trigger_track_playback_ended() - self.change_track(self.tl_track_at_next) + self.change_track(self.core.tracklist.tl_track_at_next) else: self.stop(clear_current_track=True) @@ -388,9 +202,9 @@ class PlaybackController(object): elif self.current_tl_track is not None: tl_track = self.current_tl_track elif self.current_tl_track is None and on_error_step == 1: - tl_track = self.tl_track_at_next + tl_track = self.core.tracklist.tl_track_at_next elif self.current_tl_track is None and on_error_step == -1: - tl_track = self.tl_track_at_previous + tl_track = self.core.tracklist.tl_track_at_previous if tl_track is not None: self.current_tl_track = tl_track @@ -398,16 +212,16 @@ class PlaybackController(object): backend = self._get_backend() if not backend or not backend.playback.play(tl_track.track).get(): logger.warning('Track is not playable: %s', tl_track.track.uri) - if self.random and self._shuffled: - self._shuffled.remove(tl_track) + if self.core.tracklist.random and self.core.tracklist._shuffled: + self.core.tracklist._shuffled.remove(tl_track) if on_error_step == 1: self.next() elif on_error_step == -1: self.previous() return - if self.random and self.current_tl_track in self._shuffled: - self._shuffled.remove(self.current_tl_track) + if self.core.tracklist.random and self.current_tl_track in self.core.tracklist._shuffled: + self.core.tracklist._shuffled.remove(self.current_tl_track) self._trigger_track_playback_started() @@ -419,7 +233,7 @@ class PlaybackController(object): will continue. If it was paused, it will still be paused, etc. """ self._trigger_track_playback_ended() - self.change_track(self.tl_track_at_previous, on_error_step=-1) + self.change_track(self.core.tracklist.tl_track_at_previous, on_error_step=-1) def resume(self): """If paused, resume playing the current track.""" diff --git a/mopidy/core/tracklist.py b/mopidy/core/tracklist.py index 1c8f437f..33bebdee 100644 --- a/mopidy/core/tracklist.py +++ b/mopidy/core/tracklist.py @@ -15,11 +15,16 @@ class TracklistController(object): pykka_traversable = True def __init__(self, core): - self._core = core + self.core = core self._next_tlid = 0 self._tl_tracks = [] self._version = 0 + self._shuffled = [] + self._first_shuffle = True + + ### Properties + def get_tl_tracks(self): return self._tl_tracks[:] @@ -51,7 +56,7 @@ class TracklistController(object): def _increase_version(self): self._version += 1 - self._core.playback.on_tracklist_change() + self.core.playback.on_tracklist_change() self._trigger_tracklist_changed() version = property(get_version) @@ -62,6 +67,188 @@ class TracklistController(object): Is not reset before Mopidy is restarted. """ + def get_consume(self): + return getattr(self, '_consume', False) + + def set_consume(self, value): + if self.get_consume() != value: + self.core.playback._trigger_options_changed() + return setattr(self, '_consume', value) + + consume = property(get_consume, set_consume) + """ + :class:`True` + Tracks are removed from the playlist when they have been played. + :class:`False` + Tracks are not removed from the playlist. + """ + + def get_random(self): + return getattr(self, '_random', False) + + def set_random(self, value): + if self.get_random() != value: + self.core.playback._trigger_options_changed() + return setattr(self, '_random', value) + + random = property(get_random, set_random) + """ + :class:`True` + Tracks are selected at random from the playlist. + :class:`False` + Tracks are played in the order of the playlist. + """ + + def get_repeat(self): + return getattr(self, '_repeat', False) + + def set_repeat(self, value): + if self.get_repeat() != value: + self.core.playback._trigger_options_changed() + return setattr(self, '_repeat', value) + + repeat = property(get_repeat, set_repeat) + """ + :class:`True` + The current playlist is played repeatedly. To repeat a single track, + select both :attr:`repeat` and :attr:`single`. + :class:`False` + The current playlist is played once. + """ + + def get_single(self): + return getattr(self, '_single', False) + + def set_single(self, value): + if self.get_single() != value: + self.core.playback._trigger_options_changed() + return setattr(self, '_single', value) + + single = property(get_single, set_single) + """ + :class:`True` + Playback is stopped after current song, unless in :attr:`repeat` + mode. + :class:`False` + Playback continues after current song. + """ + + def get_tracklist_position(self): + if self.core.playback.current_tl_track is None: + return None + try: + return self.core.tracklist.tl_tracks.index(self.core.playback.current_tl_track) + except ValueError: + return None + + tracklist_position = property(get_tracklist_position) + """ + The position of the current track in the tracklist. + + Read-only. + """ + + def get_tl_track_at_eot(self): + # pylint: disable = R0911 + # Too many return statements + + tl_tracks = self.core.tracklist.tl_tracks + + if not tl_tracks: + return None + + if self.random and not self._shuffled: + if self.repeat or self._first_shuffle: + logger.debug('Shuffling tracks') + self._shuffled = tl_tracks + random.shuffle(self._shuffled) + self._first_shuffle = False + + if self.random and self._shuffled: + return self._shuffled[0] + + if self.core.playback.current_tl_track is None: + return tl_tracks[0] + + if self.repeat and self.single: + return tl_tracks[self.tracklist_position] + + if self.repeat and not self.single: + return tl_tracks[(self.tracklist_position + 1) % len(tl_tracks)] + + try: + return tl_tracks[self.tracklist_position + 1] + except IndexError: + return None + + tl_track_at_eot = property(get_tl_track_at_eot) + """ + The track that will be played at the end of the current track. + + Read-only. A :class:`mopidy.models.TlTrack`. + + Not necessarily the same track as :attr:`tl_track_at_next`. + """ + + def get_tl_track_at_next(self): + tl_tracks = self.core.tracklist.tl_tracks + + if not tl_tracks: + return None + + if self.random and not self._shuffled: + if self.repeat or self._first_shuffle: + logger.debug('Shuffling tracks') + self._shuffled = tl_tracks + random.shuffle(self._shuffled) + self._first_shuffle = False + + if self.random and self._shuffled: + return self._shuffled[0] + + if self.core.playback.current_tl_track is None: + return tl_tracks[0] + + if self.repeat: + return tl_tracks[(self.tracklist_position + 1) % len(tl_tracks)] + + try: + return tl_tracks[self.tracklist_position + 1] + except IndexError: + return None + + tl_track_at_next = property(get_tl_track_at_next) + """ + The track that will be played if calling :meth:`next()`. + + Read-only. A :class:`mopidy.models.TlTrack`. + + For normal playback this is the next track in the playlist. If repeat + is enabled the next track can loop around the playlist. When random is + enabled this should be a random track, all tracks should be played once + before the list repeats. + """ + + def get_tl_track_at_previous(self): + if self.repeat or self.core.tracklist.consume or self.random: + return self.core.playback.current_tl_track + + if self.tracklist_position in (None, 0): + return None + + return self.core.tracklist.tl_tracks[self.tracklist_position - 1] + + tl_track_at_previous = property(get_tl_track_at_previous) + """ + The track that will be played if calling :meth:`previous()`. + + A :class:`mopidy.models.TlTrack`. + + For normal playback this is the previous track in the playlist. If + random and/or consume is enabled it should return the current track + instead. + """ + def add(self, tracks=None, at_position=None, uri=None): """ Add the track or list of tracks to the tracklist. @@ -87,7 +274,7 @@ class TracklistController(object): 'tracks or uri must be provided' if tracks is None and uri is not None: - tracks = self._core.library.lookup(uri) + tracks = self.core.library.lookup(uri) tl_tracks = [] @@ -260,5 +447,7 @@ class TracklistController(object): return self._tl_tracks[start:end] def _trigger_tracklist_changed(self): + self._first_shuffle = True + self._shuffled = [] logger.debug('Triggering event: tracklist_changed()') listener.CoreListener.send('tracklist_changed') diff --git a/mopidy/frontends/mpd/protocol/playback.py b/mopidy/frontends/mpd/protocol/playback.py index 8e08585f..fcc465aa 100644 --- a/mopidy/frontends/mpd/protocol/playback.py +++ b/mopidy/frontends/mpd/protocol/playback.py @@ -19,9 +19,9 @@ def consume(context, state): playlist. """ if int(state): - context.core.playback.consume = True + context.core.tracklist.consume = True else: - context.core.playback.consume = False + context.core.tracklist.consume = False @handle_request(r'^crossfade "(?P\d+)"$') @@ -263,9 +263,9 @@ def random(context, state): Sets random state to ``STATE``, ``STATE`` should be 0 or 1. """ if int(state): - context.core.playback.random = True + context.core.tracklist.random = True else: - context.core.playback.random = False + context.core.tracklist.random = False @handle_request(r'^repeat (?P[01])$') @@ -279,9 +279,9 @@ def repeat(context, state): Sets repeat state to ``STATE``, ``STATE`` should be 0 or 1. """ if int(state): - context.core.playback.repeat = True + context.core.tracklist.repeat = True else: - context.core.playback.repeat = False + context.core.tracklist.repeat = False @handle_request(r'^replay_gain_mode "(?P(off|track|album))"$') @@ -329,7 +329,7 @@ def seek(context, songpos, seconds): - issues ``seek 1 120`` without quotes around the arguments. """ - if context.core.playback.tracklist_position.get() != int(songpos): + if context.core.tracklist.tracklist_position.get() != int(songpos): playpos(context, songpos) context.core.playback.seek(int(seconds) * 1000).get() @@ -404,9 +404,9 @@ def single(context, state): song is repeated if the ``repeat`` mode is enabled. """ if int(state): - context.core.playback.single = True + context.core.tracklist.single = True else: - context.core.playback.single = False + context.core.tracklist.single = False @handle_request(r'^stop$') diff --git a/mopidy/frontends/mpd/protocol/status.py b/mopidy/frontends/mpd/protocol/status.py index 34e2fa64..f42b3531 100644 --- a/mopidy/frontends/mpd/protocol/status.py +++ b/mopidy/frontends/mpd/protocol/status.py @@ -38,7 +38,7 @@ def currentsong(context): """ current_tl_track = context.core.playback.current_tl_track.get() if current_tl_track is not None: - position = context.core.playback.tracklist_position.get() + position = context.core.tracklist.tracklist_position.get() return track_to_mpd_format(current_tl_track, position=position) @@ -178,14 +178,14 @@ def status(context): 'tracklist.length': context.core.tracklist.length, 'tracklist.version': context.core.tracklist.version, 'playback.volume': context.core.playback.volume, - 'playback.consume': context.core.playback.consume, - 'playback.random': context.core.playback.random, - 'playback.repeat': context.core.playback.repeat, - 'playback.single': context.core.playback.single, + 'tracklist.consume': context.core.tracklist.consume, + 'tracklist.random': context.core.tracklist.random, + 'tracklist.repeat': context.core.tracklist.repeat, + 'tracklist.single': context.core.tracklist.single, 'playback.state': context.core.playback.state, 'playback.current_tl_track': context.core.playback.current_tl_track, - 'playback.tracklist_position': ( - context.core.playback.tracklist_position), + 'tracklist.tracklist_position': ( + context.core.tracklist.tracklist_position), 'playback.time_position': context.core.playback.time_position, } pykka.get_all(futures.values()) @@ -218,7 +218,7 @@ def _status_bitrate(futures): def _status_consume(futures): - if futures['playback.consume'].get(): + if futures['tracklist.consume'].get(): return 1 else: return 0 @@ -233,15 +233,15 @@ def _status_playlist_version(futures): def _status_random(futures): - return int(futures['playback.random'].get()) + return int(futures['tracklist.random'].get()) def _status_repeat(futures): - return int(futures['playback.repeat'].get()) + return int(futures['tracklist.repeat'].get()) def _status_single(futures): - return int(futures['playback.single'].get()) + return int(futures['tracklist.single'].get()) def _status_songid(futures): @@ -253,7 +253,7 @@ def _status_songid(futures): def _status_songpos(futures): - return futures['playback.tracklist_position'].get() + return futures['tracklist.tracklist_position'].get() def _status_state(futures): diff --git a/mopidy/frontends/mpris/objects.py b/mopidy/frontends/mpris/objects.py index 15be1eea..d4f28a83 100644 --- a/mopidy/frontends/mpris/objects.py +++ b/mopidy/frontends/mpris/objects.py @@ -301,8 +301,8 @@ class MprisObject(dbus.service.Object): return 'Stopped' def get_LoopStatus(self): - repeat = self.core.playback.repeat.get() - single = self.core.playback.single.get() + repeat = self.core.tracklist.repeat.get() + single = self.core.tracklist.single.get() if not repeat: return 'None' else: @@ -316,14 +316,14 @@ class MprisObject(dbus.service.Object): logger.debug('Setting %s.LoopStatus not allowed', PLAYER_IFACE) return if value == 'None': - self.core.playback.repeat = False - self.core.playback.single = False + self.core.tracklist.repeat = False + self.core.tracklist.single = False elif value == 'Track': - self.core.playback.repeat = True - self.core.playback.single = True + self.core.tracklist.repeat = True + self.core.tracklist.single = True elif value == 'Playlist': - self.core.playback.repeat = True - self.core.playback.single = False + self.core.tracklist.repeat = True + self.core.tracklist.single = False def set_Rate(self, value): if not self.get_CanControl(): @@ -335,16 +335,16 @@ class MprisObject(dbus.service.Object): self.Pause() def get_Shuffle(self): - return self.core.playback.random.get() + return self.core.tracklist.random.get() def set_Shuffle(self, value): if not self.get_CanControl(): logger.debug('Setting %s.Shuffle not allowed', PLAYER_IFACE) return if value: - self.core.playback.random = True + self.core.tracklist.random = True else: - self.core.playback.random = False + self.core.tracklist.random = False def get_Metadata(self): current_tl_track = self.core.playback.current_tl_track.get() @@ -407,14 +407,14 @@ class MprisObject(dbus.service.Object): if not self.get_CanControl(): return False return ( - self.core.playback.tl_track_at_next.get() != + self.core.tracklist.tl_track_at_next.get() != self.core.playback.current_tl_track.get()) def get_CanGoPrevious(self): if not self.get_CanControl(): return False return ( - self.core.playback.tl_track_at_previous.get() != + self.core.tracklist.tl_track_at_previous.get() != self.core.playback.current_tl_track.get()) def get_CanPlay(self): @@ -422,7 +422,7 @@ class MprisObject(dbus.service.Object): return False return ( self.core.playback.current_tl_track.get() is not None or - self.core.playback.tl_track_at_next.get() is not None) + self.core.tracklist.tl_track_at_next.get() is not None) def get_CanPause(self): if not self.get_CanControl(): diff --git a/tests/backends/base/playback.py b/tests/backends/base/playback.py index 44ae40f9..11e21628 100644 --- a/tests/backends/base/playback.py +++ b/tests/backends/base/playback.py @@ -179,13 +179,13 @@ class PlaybackControllerTest(object): def test_next(self): self.playback.play() - old_position = self.playback.tracklist_position + old_position = self.tracklist.tracklist_position old_uri = self.playback.current_track.uri self.playback.next() self.assertEqual( - self.playback.tracklist_position, old_position + 1) + self.tracklist.tracklist_position, old_position + 1) self.assertNotEqual(self.playback.current_track.uri, old_uri) @populate_tracklist @@ -205,7 +205,7 @@ class PlaybackControllerTest(object): for i, track in enumerate(self.tracks): self.assertEqual(self.playback.state, PlaybackState.PLAYING) self.assertEqual(self.playback.current_track, track) - self.assertEqual(self.playback.tracklist_position, i) + self.assertEqual(self.tracklist.tracklist_position, i) self.playback.next() @@ -241,55 +241,55 @@ class PlaybackControllerTest(object): @populate_tracklist def test_next_track_before_play(self): - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[0]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[0]) @populate_tracklist def test_next_track_during_play(self): self.playback.play() - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[1]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[1]) @populate_tracklist def test_next_track_after_previous(self): self.playback.play() self.playback.next() self.playback.previous() - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[1]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[1]) def test_next_track_empty_playlist(self): - self.assertEqual(self.playback.tl_track_at_next, None) + self.assertEqual(self.tracklist.tl_track_at_next, None) @populate_tracklist def test_next_track_at_end_of_playlist(self): self.playback.play() for _ in self.tracklist.tl_tracks[1:]: self.playback.next() - self.assertEqual(self.playback.tl_track_at_next, None) + self.assertEqual(self.tracklist.tl_track_at_next, None) @populate_tracklist def test_next_track_at_end_of_playlist_with_repeat(self): - self.playback.repeat = True + self.tracklist.repeat = True self.playback.play() for _ in self.tracks[1:]: self.playback.next() - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[0]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[0]) @populate_tracklist def test_next_track_with_random(self): random.seed(1) - self.playback.random = True - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[2]) + self.tracklist.random = True + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[2]) @populate_tracklist def test_next_with_consume(self): - self.playback.consume = True + self.tracklist.consume = True self.playback.play() self.playback.next() self.assertIn(self.tracks[0], self.tracklist.tracks) @populate_tracklist def test_next_with_single_and_repeat(self): - self.playback.single = True - self.playback.repeat = True + self.tracklist.single = True + self.tracklist.repeat = True self.playback.play() self.playback.next() self.assertEqual(self.playback.current_track, self.tracks[1]) @@ -298,7 +298,7 @@ class PlaybackControllerTest(object): def test_next_with_random(self): # FIXME feels very fragile random.seed(1) - self.playback.random = True + self.tracklist.random = True self.playback.play() self.playback.next() self.assertEqual(self.playback.current_track, self.tracks[1]) @@ -306,22 +306,22 @@ class PlaybackControllerTest(object): @populate_tracklist def test_next_track_with_random_after_append_playlist(self): random.seed(1) - self.playback.random = True - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[2]) + self.tracklist.random = True + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[2]) self.tracklist.add(self.tracks[:1]) - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[1]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[1]) @populate_tracklist def test_end_of_track(self): self.playback.play() - old_position = self.playback.tracklist_position + old_position = self.tracklist.tracklist_position old_uri = self.playback.current_track.uri self.playback.on_end_of_track() self.assertEqual( - self.playback.tracklist_position, old_position + 1) + self.tracklist.tracklist_position, old_position + 1) self.assertNotEqual(self.playback.current_track.uri, old_uri) @populate_tracklist @@ -341,7 +341,7 @@ class PlaybackControllerTest(object): for i, track in enumerate(self.tracks): self.assertEqual(self.playback.state, PlaybackState.PLAYING) self.assertEqual(self.playback.current_track, track) - self.assertEqual(self.playback.tracklist_position, i) + self.assertEqual(self.tracklist.tracklist_position, i) self.playback.on_end_of_track() @@ -377,47 +377,47 @@ class PlaybackControllerTest(object): @populate_tracklist def test_end_of_track_track_before_play(self): - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[0]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[0]) @populate_tracklist def test_end_of_track_track_during_play(self): self.playback.play() - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[1]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[1]) @populate_tracklist def test_end_of_track_track_after_previous(self): self.playback.play() self.playback.on_end_of_track() self.playback.previous() - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[1]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[1]) def test_end_of_track_track_empty_playlist(self): - self.assertEqual(self.playback.tl_track_at_next, None) + self.assertEqual(self.tracklist.tl_track_at_next, None) @populate_tracklist def test_end_of_track_track_at_end_of_playlist(self): self.playback.play() for _ in self.tracklist.tl_tracks[1:]: self.playback.on_end_of_track() - self.assertEqual(self.playback.tl_track_at_next, None) + self.assertEqual(self.tracklist.tl_track_at_next, None) @populate_tracklist def test_end_of_track_track_at_end_of_playlist_with_repeat(self): - self.playback.repeat = True + self.tracklist.repeat = True self.playback.play() for _ in self.tracks[1:]: self.playback.on_end_of_track() - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[0]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[0]) @populate_tracklist def test_end_of_track_track_with_random(self): random.seed(1) - self.playback.random = True - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[2]) + self.tracklist.random = True + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[2]) @populate_tracklist def test_end_of_track_with_consume(self): - self.playback.consume = True + self.tracklist.consume = True self.playback.play() self.playback.on_end_of_track() self.assertNotIn(self.tracks[0], self.tracklist.tracks) @@ -426,7 +426,7 @@ class PlaybackControllerTest(object): def test_end_of_track_with_random(self): # FIXME feels very fragile random.seed(1) - self.playback.random = True + self.tracklist.random = True self.playback.play() self.playback.on_end_of_track() self.assertEqual(self.playback.current_track, self.tracks[1]) @@ -434,25 +434,25 @@ class PlaybackControllerTest(object): @populate_tracklist def test_end_of_track_track_with_random_after_append_playlist(self): random.seed(1) - self.playback.random = True - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[2]) + self.tracklist.random = True + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[2]) self.tracklist.add(self.tracks[:1]) - self.assertEqual(self.playback.tl_track_at_next, self.tl_tracks[1]) + self.assertEqual(self.tracklist.tl_track_at_next, self.tl_tracks[1]) @populate_tracklist def test_previous_track_before_play(self): - self.assertEqual(self.playback.tl_track_at_previous, None) + self.assertEqual(self.tracklist.tl_track_at_previous, None) @populate_tracklist def test_previous_track_after_play(self): self.playback.play() - self.assertEqual(self.playback.tl_track_at_previous, None) + self.assertEqual(self.tracklist.tl_track_at_previous, None) @populate_tracklist def test_previous_track_after_next(self): self.playback.play() self.playback.next() - self.assertEqual(self.playback.tl_track_at_previous, self.tl_tracks[0]) + self.assertEqual(self.tracklist.tl_track_at_previous, self.tl_tracks[0]) @populate_tracklist def test_previous_track_after_previous(self): @@ -460,27 +460,27 @@ class PlaybackControllerTest(object): self.playback.next() # At track 1 self.playback.next() # At track 2 self.playback.previous() # At track 1 - self.assertEqual(self.playback.tl_track_at_previous, self.tl_tracks[0]) + self.assertEqual(self.tracklist.tl_track_at_previous, self.tl_tracks[0]) def test_previous_track_empty_playlist(self): - self.assertEqual(self.playback.tl_track_at_previous, None) + self.assertEqual(self.tracklist.tl_track_at_previous, None) @populate_tracklist def test_previous_track_with_consume(self): - self.playback.consume = True + self.tracklist.consume = True for _ in self.tracks: self.playback.next() self.assertEqual( - self.playback.tl_track_at_previous, + self.tracklist.tl_track_at_previous, self.playback.current_tl_track) @populate_tracklist def test_previous_track_with_random(self): - self.playback.random = True + self.tracklist.random = True for _ in self.tracks: self.playback.next() self.assertEqual( - self.playback.tl_track_at_previous, + self.tracklist.tl_track_at_previous, self.playback.current_tl_track) @populate_tracklist @@ -500,24 +500,24 @@ class PlaybackControllerTest(object): @populate_tracklist def test_initial_tracklist_position(self): - self.assertEqual(self.playback.tracklist_position, None) + self.assertEqual(self.tracklist.tracklist_position, None) @populate_tracklist def test_tracklist_position_during_play(self): self.playback.play() - self.assertEqual(self.playback.tracklist_position, 0) + self.assertEqual(self.tracklist.tracklist_position, 0) @populate_tracklist def test_tracklist_position_after_next(self): self.playback.play() self.playback.next() - self.assertEqual(self.playback.tracklist_position, 1) + self.assertEqual(self.tracklist.tracklist_position, 1) @populate_tracklist def test_tracklist_position_at_end_of_playlist(self): self.playback.play(self.tracklist.tl_tracks[-1]) self.playback.on_end_of_track() - self.assertEqual(self.playback.tracklist_position, None) + self.assertEqual(self.tracklist.tracklist_position, None) def test_on_tracklist_change_gets_called(self): callback = self.playback.on_tracklist_change @@ -775,13 +775,13 @@ class PlaybackControllerTest(object): @populate_tracklist def test_play_with_consume(self): - self.playback.consume = True + self.tracklist.consume = True self.playback.play() self.assertEqual(self.playback.current_track, self.tracks[0]) @populate_tracklist def test_playlist_is_empty_after_all_tracks_are_played_with_consume(self): - self.playback.consume = True + self.tracklist.consume = True self.playback.play() for _ in range(len(self.tracklist.tracks)): self.playback.on_end_of_track() @@ -790,14 +790,14 @@ class PlaybackControllerTest(object): @populate_tracklist def test_play_with_random(self): random.seed(1) - self.playback.random = True + self.tracklist.random = True self.playback.play() self.assertEqual(self.playback.current_track, self.tracks[2]) @populate_tracklist def test_previous_with_random(self): random.seed(1) - self.playback.random = True + self.tracklist.random = True self.playback.play() self.playback.next() current_track = self.playback.current_track @@ -812,8 +812,8 @@ class PlaybackControllerTest(object): @populate_tracklist def test_end_of_song_with_single_and_repeat_starts_same(self): - self.playback.single = True - self.playback.repeat = True + self.tracklist.single = True + self.tracklist.repeat = True self.playback.play() self.playback.on_end_of_track() self.assertEqual(self.playback.current_track, self.tracks[0]) @@ -825,44 +825,44 @@ class PlaybackControllerTest(object): self.assertEqual(self.playback.state, PlaybackState.STOPPED) def test_repeat_off_by_default(self): - self.assertEqual(self.playback.repeat, False) + self.assertEqual(self.tracklist.repeat, False) def test_random_off_by_default(self): - self.assertEqual(self.playback.random, False) + self.assertEqual(self.tracklist.random, False) def test_consume_off_by_default(self): - self.assertEqual(self.playback.consume, False) + self.assertEqual(self.tracklist.consume, False) @populate_tracklist def test_random_until_end_of_playlist(self): - self.playback.random = True + self.tracklist.random = True self.playback.play() for _ in self.tracks[1:]: self.playback.next() - self.assertEqual(self.playback.tl_track_at_next, None) + self.assertEqual(self.tracklist.tl_track_at_next, None) @populate_tracklist def test_random_until_end_of_playlist_and_play_from_start(self): - self.playback.repeat = True + self.tracklist.repeat = True for _ in self.tracks: self.playback.next() - self.assertNotEqual(self.playback.tl_track_at_next, None) + self.assertNotEqual(self.tracklist.tl_track_at_next, None) self.assertEqual(self.playback.state, PlaybackState.STOPPED) self.playback.play() self.assertEqual(self.playback.state, PlaybackState.PLAYING) @populate_tracklist def test_random_until_end_of_playlist_with_repeat(self): - self.playback.repeat = True - self.playback.random = True + self.tracklist.repeat = True + self.tracklist.random = True self.playback.play() for _ in self.tracks: self.playback.next() - self.assertNotEqual(self.playback.tl_track_at_next, None) + self.assertNotEqual(self.tracklist.tl_track_at_next, None) @populate_tracklist def test_played_track_during_random_not_played_again(self): - self.playback.random = True + self.tracklist.random = True self.playback.play() played = [] for _ in self.tracks: diff --git a/tests/frontends/mpd/protocol/playback_test.py b/tests/frontends/mpd/protocol/playback_test.py index 2cfc1b98..fc91c09c 100644 --- a/tests/frontends/mpd/protocol/playback_test.py +++ b/tests/frontends/mpd/protocol/playback_test.py @@ -16,22 +16,22 @@ STOPPED = PlaybackState.STOPPED class PlaybackOptionsHandlerTest(protocol.BaseTestCase): def test_consume_off(self): self.sendRequest('consume "0"') - self.assertFalse(self.core.playback.consume.get()) + self.assertFalse(self.core.tracklist.consume.get()) self.assertInResponse('OK') def test_consume_off_without_quotes(self): self.sendRequest('consume 0') - self.assertFalse(self.core.playback.consume.get()) + self.assertFalse(self.core.tracklist.consume.get()) self.assertInResponse('OK') def test_consume_on(self): self.sendRequest('consume "1"') - self.assertTrue(self.core.playback.consume.get()) + self.assertTrue(self.core.tracklist.consume.get()) self.assertInResponse('OK') def test_consume_on_without_quotes(self): self.sendRequest('consume 1') - self.assertTrue(self.core.playback.consume.get()) + self.assertTrue(self.core.tracklist.consume.get()) self.assertInResponse('OK') def test_crossfade(self): @@ -40,42 +40,42 @@ class PlaybackOptionsHandlerTest(protocol.BaseTestCase): def test_random_off(self): self.sendRequest('random "0"') - self.assertFalse(self.core.playback.random.get()) + self.assertFalse(self.core.tracklist.random.get()) self.assertInResponse('OK') def test_random_off_without_quotes(self): self.sendRequest('random 0') - self.assertFalse(self.core.playback.random.get()) + self.assertFalse(self.core.tracklist.random.get()) self.assertInResponse('OK') def test_random_on(self): self.sendRequest('random "1"') - self.assertTrue(self.core.playback.random.get()) + self.assertTrue(self.core.tracklist.random.get()) self.assertInResponse('OK') def test_random_on_without_quotes(self): self.sendRequest('random 1') - self.assertTrue(self.core.playback.random.get()) + self.assertTrue(self.core.tracklist.random.get()) self.assertInResponse('OK') def test_repeat_off(self): self.sendRequest('repeat "0"') - self.assertFalse(self.core.playback.repeat.get()) + self.assertFalse(self.core.tracklist.repeat.get()) self.assertInResponse('OK') def test_repeat_off_without_quotes(self): self.sendRequest('repeat 0') - self.assertFalse(self.core.playback.repeat.get()) + self.assertFalse(self.core.tracklist.repeat.get()) self.assertInResponse('OK') def test_repeat_on(self): self.sendRequest('repeat "1"') - self.assertTrue(self.core.playback.repeat.get()) + self.assertTrue(self.core.tracklist.repeat.get()) self.assertInResponse('OK') def test_repeat_on_without_quotes(self): self.sendRequest('repeat 1') - self.assertTrue(self.core.playback.repeat.get()) + self.assertTrue(self.core.tracklist.repeat.get()) self.assertInResponse('OK') def test_setvol_below_min(self): @@ -115,22 +115,22 @@ class PlaybackOptionsHandlerTest(protocol.BaseTestCase): def test_single_off(self): self.sendRequest('single "0"') - self.assertFalse(self.core.playback.single.get()) + self.assertFalse(self.core.tracklist.single.get()) self.assertInResponse('OK') def test_single_off_without_quotes(self): self.sendRequest('single 0') - self.assertFalse(self.core.playback.single.get()) + self.assertFalse(self.core.tracklist.single.get()) self.assertInResponse('OK') def test_single_on(self): self.sendRequest('single "1"') - self.assertTrue(self.core.playback.single.get()) + self.assertTrue(self.core.tracklist.single.get()) self.assertInResponse('OK') def test_single_on_without_quotes(self): self.sendRequest('single 1') - self.assertTrue(self.core.playback.single.get()) + self.assertTrue(self.core.tracklist.single.get()) self.assertInResponse('OK') def test_replay_gain_mode_off(self): diff --git a/tests/frontends/mpd/status_test.py b/tests/frontends/mpd/status_test.py index ded0c3b2..d86f7dcd 100644 --- a/tests/frontends/mpd/status_test.py +++ b/tests/frontends/mpd/status_test.py @@ -64,7 +64,7 @@ class StatusHandlerTest(unittest.TestCase): self.assertEqual(int(result['repeat']), 0) def test_status_method_contains_repeat_is_1(self): - self.core.playback.repeat = 1 + self.core.tracklist.repeat = 1 result = dict(status.status(self.context)) self.assertIn('repeat', result) self.assertEqual(int(result['repeat']), 1) @@ -75,7 +75,7 @@ class StatusHandlerTest(unittest.TestCase): self.assertEqual(int(result['random']), 0) def test_status_method_contains_random_is_1(self): - self.core.playback.random = 1 + self.core.tracklist.random = 1 result = dict(status.status(self.context)) self.assertIn('random', result) self.assertEqual(int(result['random']), 1) @@ -91,7 +91,7 @@ class StatusHandlerTest(unittest.TestCase): self.assertEqual(int(result['consume']), 0) def test_status_method_contains_consume_is_1(self): - self.core.playback.consume = 1 + self.core.tracklist.consume = 1 result = dict(status.status(self.context)) self.assertIn('consume', result) self.assertEqual(int(result['consume']), 1) diff --git a/tests/frontends/mpris/player_interface_test.py b/tests/frontends/mpris/player_interface_test.py index 52cd964b..4cd903e6 100644 --- a/tests/frontends/mpris/player_interface_test.py +++ b/tests/frontends/mpris/player_interface_test.py @@ -50,45 +50,45 @@ class PlayerInterfaceTest(unittest.TestCase): self.assertEqual('Stopped', result) def test_get_loop_status_is_none_when_not_looping(self): - self.core.playback.repeat = False - self.core.playback.single = False + self.core.tracklist.repeat = False + self.core.tracklist.single = False result = self.mpris.Get(objects.PLAYER_IFACE, 'LoopStatus') self.assertEqual('None', result) def test_get_loop_status_is_track_when_looping_a_single_track(self): - self.core.playback.repeat = True - self.core.playback.single = True + self.core.tracklist.repeat = True + self.core.tracklist.single = True result = self.mpris.Get(objects.PLAYER_IFACE, 'LoopStatus') self.assertEqual('Track', result) def test_get_loop_status_is_playlist_when_looping_tracklist(self): - self.core.playback.repeat = True - self.core.playback.single = False + self.core.tracklist.repeat = True + self.core.tracklist.single = False result = self.mpris.Get(objects.PLAYER_IFACE, 'LoopStatus') self.assertEqual('Playlist', result) def test_set_loop_status_is_ignored_if_can_control_is_false(self): self.mpris.get_CanControl = lambda *_: False - self.core.playback.repeat = True - self.core.playback.single = True + self.core.tracklist.repeat = True + self.core.tracklist.single = True self.mpris.Set(objects.PLAYER_IFACE, 'LoopStatus', 'None') - self.assertEqual(self.core.playback.repeat.get(), True) - self.assertEqual(self.core.playback.single.get(), True) + self.assertEqual(self.core.tracklist.repeat.get(), True) + self.assertEqual(self.core.tracklist.single.get(), True) def test_set_loop_status_to_none_unsets_repeat_and_single(self): self.mpris.Set(objects.PLAYER_IFACE, 'LoopStatus', 'None') - self.assertEqual(self.core.playback.repeat.get(), False) - self.assertEqual(self.core.playback.single.get(), False) + self.assertEqual(self.core.tracklist.repeat.get(), False) + self.assertEqual(self.core.tracklist.single.get(), False) def test_set_loop_status_to_track_sets_repeat_and_single(self): self.mpris.Set(objects.PLAYER_IFACE, 'LoopStatus', 'Track') - self.assertEqual(self.core.playback.repeat.get(), True) - self.assertEqual(self.core.playback.single.get(), True) + self.assertEqual(self.core.tracklist.repeat.get(), True) + self.assertEqual(self.core.tracklist.single.get(), True) def test_set_loop_status_to_playlists_sets_repeat_and_not_single(self): self.mpris.Set(objects.PLAYER_IFACE, 'LoopStatus', 'Playlist') - self.assertEqual(self.core.playback.repeat.get(), True) - self.assertEqual(self.core.playback.single.get(), False) + self.assertEqual(self.core.tracklist.repeat.get(), True) + self.assertEqual(self.core.tracklist.single.get(), False) def test_get_rate_is_greater_or_equal_than_minimum_rate(self): rate = self.mpris.Get(objects.PLAYER_IFACE, 'Rate') @@ -116,32 +116,32 @@ class PlayerInterfaceTest(unittest.TestCase): self.assertEqual(self.core.playback.state.get(), PAUSED) def test_get_shuffle_returns_true_if_random_is_active(self): - self.core.playback.random = True + self.core.tracklist.random = True result = self.mpris.Get(objects.PLAYER_IFACE, 'Shuffle') self.assertTrue(result) def test_get_shuffle_returns_false_if_random_is_inactive(self): - self.core.playback.random = False + self.core.tracklist.random = False result = self.mpris.Get(objects.PLAYER_IFACE, 'Shuffle') self.assertFalse(result) def test_set_shuffle_is_ignored_if_can_control_is_false(self): self.mpris.get_CanControl = lambda *_: False - self.core.playback.random = False + self.core.tracklist.random = False self.mpris.Set(objects.PLAYER_IFACE, 'Shuffle', True) - self.assertFalse(self.core.playback.random.get()) + self.assertFalse(self.core.tracklist.random.get()) def test_set_shuffle_to_true_activates_random_mode(self): - self.core.playback.random = False - self.assertFalse(self.core.playback.random.get()) + self.core.tracklist.random = False + self.assertFalse(self.core.tracklist.random.get()) self.mpris.Set(objects.PLAYER_IFACE, 'Shuffle', True) - self.assertTrue(self.core.playback.random.get()) + self.assertTrue(self.core.tracklist.random.get()) def test_set_shuffle_to_false_deactivates_random_mode(self): - self.core.playback.random = True - self.assertTrue(self.core.playback.random.get()) + self.core.tracklist.random = True + self.assertTrue(self.core.tracklist.random.get()) self.mpris.Set(objects.PLAYER_IFACE, 'Shuffle', False) - self.assertFalse(self.core.playback.random.get()) + self.assertFalse(self.core.tracklist.random.get()) def test_get_metadata_has_trackid_even_when_no_current_track(self): result = self.mpris.Get(objects.PLAYER_IFACE, 'Metadata') @@ -308,7 +308,7 @@ class PlayerInterfaceTest(unittest.TestCase): def test_can_go_next_is_false_if_next_track_is_the_same(self): self.mpris.get_CanControl = lambda *_: True self.core.tracklist.add([Track(uri='dummy:a')]) - self.core.playback.repeat = True + self.core.tracklist.repeat = True self.core.playback.play() result = self.mpris.Get(objects.PLAYER_IFACE, 'CanGoNext') self.assertFalse(result) @@ -331,7 +331,7 @@ class PlayerInterfaceTest(unittest.TestCase): def test_can_go_previous_is_false_if_previous_track_is_the_same(self): self.mpris.get_CanControl = lambda *_: True self.core.tracklist.add([Track(uri='dummy:a')]) - self.core.playback.repeat = True + self.core.tracklist.repeat = True self.core.playback.play() result = self.mpris.Get(objects.PLAYER_IFACE, 'CanGoPrevious') self.assertFalse(result) diff --git a/tests/utils/jsonrpc_test.py b/tests/utils/jsonrpc_test.py index 5dccbe05..a0709ebc 100644 --- a/tests/utils/jsonrpc_test.py +++ b/tests/utils/jsonrpc_test.py @@ -266,12 +266,12 @@ class JsonRpcSingleNotificationTest(JsonRpcTestBase): class JsonRpcBatchTest(JsonRpcTestBase): def test_batch_of_only_commands_returns_all(self): - self.core.playback.set_random(True).get() + self.core.tracklist.set_random(True).get() request = [ - {'jsonrpc': '2.0', 'method': 'core.playback.get_repeat', 'id': 1}, - {'jsonrpc': '2.0', 'method': 'core.playback.get_random', 'id': 2}, - {'jsonrpc': '2.0', 'method': 'core.playback.get_single', 'id': 3}, + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_repeat', 'id': 1}, + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_random', 'id': 2}, + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_single', 'id': 3}, ] response = self.jrw.handle_data(request) @@ -283,12 +283,12 @@ class JsonRpcBatchTest(JsonRpcTestBase): self.assertEqual(response[3]['result'], False) def test_batch_of_commands_and_notifications_returns_some(self): - self.core.playback.set_random(True).get() + self.core.tracklist.set_random(True).get() request = [ - {'jsonrpc': '2.0', 'method': 'core.playback.get_repeat'}, - {'jsonrpc': '2.0', 'method': 'core.playback.get_random', 'id': 2}, - {'jsonrpc': '2.0', 'method': 'core.playback.get_single', 'id': 3}, + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_repeat'}, + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_random', 'id': 2}, + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_single', 'id': 3}, ] response = self.jrw.handle_data(request) @@ -300,12 +300,12 @@ class JsonRpcBatchTest(JsonRpcTestBase): self.assertEqual(response[3]['result'], False) def test_batch_of_only_notifications_returns_nothing(self): - self.core.playback.set_random(True).get() + self.core.tracklist.set_random(True).get() request = [ - {'jsonrpc': '2.0', 'method': 'core.playback.get_repeat'}, - {'jsonrpc': '2.0', 'method': 'core.playback.get_random'}, - {'jsonrpc': '2.0', 'method': 'core.playback.get_single'}, + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_repeat'}, + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_random'}, + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_single'}, ] response = self.jrw.handle_data(request) @@ -522,10 +522,10 @@ class JsonRpcBatchErrorTest(JsonRpcTestBase): {'jsonrpc': '2.0', 'method': 'core.playback.set_volume', 'params': [47], 'id': '1'}, # Notification - {'jsonrpc': '2.0', 'method': 'core.playback.set_consume', + {'jsonrpc': '2.0', 'method': 'core.tracklist.set_consume', 'params': [True]}, # Call with positional params - {'jsonrpc': '2.0', 'method': 'core.playback.set_repeat', + {'jsonrpc': '2.0', 'method': 'core.tracklist.set_repeat', 'params': [False], 'id': '2'}, # Invalid request {'foo': 'boo'}, @@ -533,7 +533,7 @@ class JsonRpcBatchErrorTest(JsonRpcTestBase): {'jsonrpc': '2.0', 'method': 'foo.get', 'params': {'name': 'myself'}, 'id': '5'}, # Call without params - {'jsonrpc': '2.0', 'method': 'core.playback.get_random', + {'jsonrpc': '2.0', 'method': 'core.tracklist.get_random', 'id': '9'}, ] response = self.jrw.handle_data(request)