mpd: Refresh mapping when name is not present (Fixes #1348)
This commit is contained in:
parent
98e19e803b
commit
c3393d3d85
@ -71,7 +71,7 @@ class MpdUriMapper(object):
|
||||
"""
|
||||
Helper function to retrieve a playlist URI from its unique MPD name.
|
||||
"""
|
||||
if not self._uri_from_name:
|
||||
if name not in self._uri_from_name:
|
||||
self.refresh_playlists_mapping()
|
||||
return self._uri_from_name.get(name)
|
||||
|
||||
|
||||
@ -233,3 +233,24 @@ class IssueGH1120RegressionTest(protocol.BaseTestCase):
|
||||
|
||||
response2 = self.send_request('lsinfo "/"')
|
||||
self.assertEqual(response1, response2)
|
||||
|
||||
|
||||
class IssueGH1348RegressionTest(protocol.BaseTestCase):
|
||||
|
||||
"""
|
||||
The issue: http://github.com/mopidy/mopidy/issues/1348
|
||||
"""
|
||||
|
||||
def test(self):
|
||||
self.backend.library.dummy_library = [Track(uri='dummy:a')]
|
||||
|
||||
# Create a dummy playlist and trigger population of mapping
|
||||
self.send_request('playlistadd "testing1" "dummy:a"')
|
||||
self.send_request('listplaylists')
|
||||
|
||||
# Create an other playlist which isn't in the map
|
||||
self.send_request('playlistadd "testing2" "dummy:a"')
|
||||
self.assertEqual(['OK'], self.send_request('rm "testing2"'))
|
||||
|
||||
playlists = self.backend.playlists.as_list().get()
|
||||
self.assertEqual(['testing1'], [ref.name for ref in playlists])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user