Merge branch 'develop' into feature/simplify-outputs

Conflicts:
	docs/changes.rst
This commit is contained in:
Thomas Adamcik 2012-08-26 12:44:48 +02:00
commit d112dc668b
3 changed files with 9 additions and 4 deletions

View File

@ -14,6 +14,10 @@ v0.8 (in development)
and various client support. Requires gevent, which currently is not a and various client support. Requires gevent, which currently is not a
dependency of Mopidy. dependency of Mopidy.
- Fixed bug when the MPD command `playlistinfo` is used with a track position.
Track position and CPID was intermixed, so it would cause a crash if a CPID
matching the track position didn't exist. (Fixes: :issue:`162`)
- Removed most traces of multiple outputs support. Having this feature - Removed most traces of multiple outputs support. Having this feature
currently seems to be more trouble than what it is worth. currently seems to be more trouble than what it is worth.
:attr:`mopidy.settings.OUTPUTS` setting is no longer supported, and has been :attr:`mopidy.settings.OUTPUTS` setting is no longer supported, and has been

View File

@ -55,8 +55,7 @@ def addid(context, uri, songpos=None):
track = context.backend.library.lookup(uri).get() track = context.backend.library.lookup(uri).get()
if track is None: if track is None:
raise MpdNoExistError(u'No such song', command=u'addid') raise MpdNoExistError(u'No such song', command=u'addid')
if songpos and songpos > len( if songpos and songpos > context.backend.current_playlist.length.get():
context.backend.current_playlist.tracks.get()):
raise MpdArgError(u'Bad song index', command=u'addid') raise MpdArgError(u'Bad song index', command=u'addid')
cp_track = context.backend.current_playlist.add(track, cp_track = context.backend.current_playlist.add(track,
at_position=songpos).get() at_position=songpos).get()
@ -132,7 +131,7 @@ def move_range(context, start, to, end=None):
``TO`` in the playlist. ``TO`` in the playlist.
""" """
if end is None: if end is None:
end = len(context.backend.current_playlist.tracks.get()) end = context.backend.current_playlist.length.get()
start = int(start) start = int(start)
end = int(end) end = int(end)
to = int(to) to = int(to)
@ -244,7 +243,7 @@ def playlistinfo(context, songpos=None,
""" """
if songpos is not None: if songpos is not None:
songpos = int(songpos) songpos = int(songpos)
cp_track = context.backend.current_playlist.get(cpid=songpos).get() cp_track = context.backend.current_playlist.cp_tracks.get()[songpos]
return track_to_mpd_format(cp_track, position=songpos) return track_to_mpd_format(cp_track, position=songpos)
else: else:
if start is None: if start is None:

View File

@ -285,6 +285,8 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase):
self.assertInResponse(u'OK') self.assertInResponse(u'OK')
def test_playlistinfo_with_songpos(self): def test_playlistinfo_with_songpos(self):
# Make the track's CPID not match the playlist position
self.backend.current_playlist.cp_id = 17
self.backend.current_playlist.append([ self.backend.current_playlist.append([
Track(name='a'), Track(name='b'), Track(name='c'), Track(name='a'), Track(name='b'), Track(name='c'),
Track(name='d'), Track(name='e'), Track(name='f'), Track(name='d'), Track(name='e'), Track(name='f'),