Skip to content

Commit

Permalink
Release v1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jodal committed Jun 25, 2015
2 parents 2ae56ed + f60ffdf commit 167184d
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 6 deletions.
13 changes: 13 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ Changelog
This changelog is used to track all major changes to Mopidy.


v1.0.6 (2015-06-25)
===================

Bug fix release.

- Core/MPD/Local: Add support for ``title`` in
:meth:`mopidy.core.LibraryController.get_distinct`. (Fixes: :issue:`1181`,
PR: :issue:`1183`)

- Core: Make sure track changes make it to audio while paused.
(Fixes: :issue:`1177`, PR: :issue:`1185`)


v1.0.5 (2015-05-19)
===================

Expand Down
2 changes: 1 addition & 1 deletion mopidy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
warnings.filterwarnings('ignore', 'could not open display')


__version__ = '1.0.5'
__version__ = '1.0.6'
3 changes: 3 additions & 0 deletions mopidy/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def get_distinct(self, field, query=None):
*MAY be implemented by subclass.*
Default implementation will simply return an empty set.
Note that backends should always return an empty set for unexpected
field types.
"""
return set()

Expand Down
4 changes: 2 additions & 2 deletions mopidy/core/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def get_distinct(self, field, query=None):
protocol supports in a more sane fashion. Other frontends are not
recommended to use this method.
:param string field: One of ``artist``, ``albumartist``, ``album``,
``composer``, ``performer``, ``date``or ``genre``.
:param string field: One of ``track``, ``artist``, ``albumartist``,
``album``, ``composer``, ``performer``, ``date``or ``genre``.
:param dict query: Query to use for limiting results, see
:meth:`search` for details about the query format.
:rtype: set of values corresponding to the requested field type.
Expand Down
6 changes: 6 additions & 0 deletions mopidy/core/playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ def _change_track(self, tl_track, on_error_step=1):
if old_state == PlaybackState.PLAYING:
self._play(on_error_step=on_error_step)
elif old_state == PlaybackState.PAUSED:
# NOTE: this is just a quick hack to fix #1177 as this code has
# already been killed in the gapless branch.
backend = self._get_backend()
if backend:
backend.playback.prepare_change()
backend.playback.change_track(tl_track.track).get()
self.pause()

# TODO: this is not really end of track, this is on_need_next_track
Expand Down
5 changes: 4 additions & 1 deletion mopidy/local/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ def lookup(self, uri):
return []

def get_distinct(self, field, query=None):
if field == 'artist':
if field == 'track':
def distinct(track):
return {track.name}
elif field == 'artist':
def distinct(track):
return {a.name for a in track.artists}
elif field == 'albumartist':
Expand Down
2 changes: 2 additions & 0 deletions mopidy/mpd/protocol/music_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'track': 'track_no'}

_LIST_MAPPING = {
'title': 'track',
'album': 'album',
'albumartist': 'albumartist',
'artist': 'artist',
Expand All @@ -31,6 +32,7 @@
'performer': 'performer'}

_LIST_NAME_MAPPING = {
'title': 'Title',
'album': 'Album',
'albumartist': 'AlbumArtist',
'artist': 'Artist',
Expand Down
24 changes: 24 additions & 0 deletions tests/core/test_playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,3 +668,27 @@ def test_type_error_from_old_backend_does_not_crash_core(self):
c = core.Core(mixer=None, backends=[b])
c.tracklist.add([Track(uri='dummy1:a', length=40000)])
c.playback.play() # No TypeError == test passed.
b.playback.play.assert_called_once_with()


class Bug1177RegressionTest(unittest.TestCase):
def test(self):
b = mock.Mock()
b.uri_schemes.get.return_value = ['dummy']
b.playback = mock.Mock(spec=backend.PlaybackProvider)
b.playback.change_track.return_value.get.return_value = True
b.playback.play.return_value.get.return_value = True

track1 = Track(uri='dummy:a', length=40000)
track2 = Track(uri='dummy:b', length=40000)

c = core.Core(mixer=None, backends=[b])
c.tracklist.add([track1, track2])

c.playback.play()
b.playback.change_track.assert_called_once_with(track1)
b.playback.change_track.reset_mock()

c.playback.pause()
c.playback.next()
b.playback.change_track.assert_called_once_with(track2)
5 changes: 5 additions & 0 deletions tests/mpd/protocol/test_music_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,11 @@ def test_list_foo_returns_ack(self):
self.send_request('list "foo"')
self.assertEqualResponse('ACK [2@0] {list} incorrect arguments')

# Track title
def test_list_title(self):
self.send_request('list "title"')
self.assertInResponse('OK')

# Artist

def test_list_artist_with_quotes(self):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ def test_versions_can_be_strictly_ordered(self):
self.assertVersionLess('1.0.1', '1.0.2')
self.assertVersionLess('1.0.2', '1.0.3')
self.assertVersionLess('1.0.3', '1.0.4')
self.assertVersionLess('1.0.4', __version__)
self.assertVersionLess(__version__, '1.0.6')
self.assertVersionLess('1.0.4', '1.0.5')
self.assertVersionLess('1.0.5', __version__)
self.assertVersionLess(__version__, '1.0.7')

0 comments on commit 167184d

Please sign in to comment.