diff --git a/docs/changelog.rst b/docs/changelog.rst index d63ce7b8..5dc90c17 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -26,7 +26,8 @@ v1.0.0 (UNRELEASED) the Python API with the WebSocket/JavaScript API. (Fixes: :issue:`952`) - Add :class:`mopidy.core.HistoryController` which keeps track of what tracks - have been played. (Fixes: :issue:`423`, PR: :issue:`803`) + have been played. (Fixes: :issue:`423`, :issue:`1056`, PR: :issue:`803`, + :issue:`1063`) - Add :class:`mopidy.core.MixerController` which keeps track of volume and mute. (Fixes: :issue:`962`) diff --git a/mopidy/core/history.py b/mopidy/core/history.py index 9d7cf59f..f0d5e9d4 100644 --- a/mopidy/core/history.py +++ b/mopidy/core/history.py @@ -15,9 +15,11 @@ class HistoryController(object): def __init__(self): self._history = [] - def add(self, track): + def _add_track(self, track): """Add track to the playback history. + Internal method for :class:`mopidy.core.PlaybackController`. + :param track: track to add :type track: :class:`mopidy.models.Track` """ diff --git a/mopidy/core/playback.py b/mopidy/core/playback.py index c00f86fd..0b714598 100644 --- a/mopidy/core/playback.py +++ b/mopidy/core/playback.py @@ -312,7 +312,7 @@ class PlaybackController(object): if success: self.core.tracklist._mark_playing(tl_track) - self.core.history.add(tl_track.track) + self.core.history._add_track(tl_track.track) # TODO: replace with stream-changed self._trigger_track_playback_started() else: diff --git a/tests/core/test_history.py b/tests/core/test_history.py index 42922e52..48062aaf 100644 --- a/tests/core/test_history.py +++ b/tests/core/test_history.py @@ -18,24 +18,24 @@ class PlaybackHistoryTest(unittest.TestCase): self.history = HistoryController() def test_add_track(self): - self.history.add(self.tracks[0]) + self.history._add_track(self.tracks[0]) self.assertEqual(self.history.get_length(), 1) - self.history.add(self.tracks[1]) + self.history._add_track(self.tracks[1]) self.assertEqual(self.history.get_length(), 2) - self.history.add(self.tracks[2]) + self.history._add_track(self.tracks[2]) self.assertEqual(self.history.get_length(), 3) def test_non_tracks_are_rejected(self): with self.assertRaises(TypeError): - self.history.add(object()) + self.history._add_track(object()) self.assertEqual(self.history.get_length(), 0) def test_history_entry_contents(self): track = self.tracks[0] - self.history.add(track) + self.history._add_track(track) result = self.history.get_history() (timestamp, ref) = result[0]