From 6e55435aa90fbeb2d4d8e3906c8e56414b03aa9e Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 13 Dec 2014 01:26:41 +0100 Subject: [PATCH 1/5] mpd: Enable browsing of empty dirs This was disabled together with a bunch of other changes without any explanation in commit f24ca36e5a5b72c886d6d8e8df88be79fb094dda. I'm guessing that this wasn't intentional, and no test covered the case. (cherry picked from commit 4e508cd01750bcef9e0e9c7b70798eacd276aef8) --- mopidy/mpd/protocol/music_db.py | 2 -- tests/mpd/protocol/test_music_db.py | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mopidy/mpd/protocol/music_db.py b/mopidy/mpd/protocol/music_db.py index a5757915..5a7f51fb 100644 --- a/mopidy/mpd/protocol/music_db.py +++ b/mopidy/mpd/protocol/music_db.py @@ -421,8 +421,6 @@ def lsinfo(context, uri=None): if uri in (None, '', '/'): result.extend(protocol.stored_playlists.listplaylists(context)) - if not result: - raise exceptions.MpdNoExistError('Not found') return result diff --git a/tests/mpd/protocol/test_music_db.py b/tests/mpd/protocol/test_music_db.py index e6712fef..8efd1dc4 100644 --- a/tests/mpd/protocol/test_music_db.py +++ b/tests/mpd/protocol/test_music_db.py @@ -347,6 +347,13 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.assertInResponse('directory: dummy/foo') self.assertInResponse('OK') + def test_lsinfo_for_empty_dir_returns_nothing(self): + self.backend.library.dummy_browse_result = { + 'dummy:/': []} + + self.sendRequest('lsinfo "/dummy"') + self.assertInResponse('OK') + def test_lsinfo_for_dir_does_not_recurse(self): self.backend.library.dummy_library = [ Track(uri='dummy:/a', name='a'), From b365d2494bceb84c328c2f6888bb139ba3b43376 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sun, 14 Dec 2014 14:16:37 +0100 Subject: [PATCH 2/5] mpd: Remove "Comment" tag type from translator output. Newer versions of the protocol have removed this tag, so we should as well. This also works around the issue of #881 which was breaking things with newlines in comment fields. The readcomments command seems to replace this, but it seems to only care about specific extra tagtypes, not the general comment tag we normally collect when scanning things. (cherry picked from commit 08a8d5c43be271a41af74ce0c7df9d871cf2b532) --- mopidy/mpd/translator.py | 3 --- tests/mpd/test_translator.py | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/mopidy/mpd/translator.py b/mopidy/mpd/translator.py index f3264a46..8a43f929 100644 --- a/mopidy/mpd/translator.py +++ b/mopidy/mpd/translator.py @@ -81,9 +81,6 @@ def track_to_mpd_format(track, position=None): if track.disc_no: result.append(('Disc', track.disc_no)) - if track.comment: - result.append(('Comment', track.comment)) - if track.musicbrainz_id is not None: result.append(('MUSICBRAINZ_TRACKID', track.musicbrainz_id)) return result diff --git a/tests/mpd/test_translator.py b/tests/mpd/test_translator.py index 2bd6cff6..05a0d187 100644 --- a/tests/mpd/test_translator.py +++ b/tests/mpd/test_translator.py @@ -73,10 +73,10 @@ class TrackMpdFormatTest(unittest.TestCase): self.assertIn(('Track', '7/13'), result) self.assertIn(('Date', datetime.date(1977, 1, 1)), result) self.assertIn(('Disc', '1'), result) - self.assertIn(('Comment', 'a comment'), result) self.assertIn(('Pos', 9), result) self.assertIn(('Id', 122), result) - self.assertEqual(len(result), 15) + self.assertNotIn(('Comment', 'a comment'), result) + self.assertEqual(len(result), 14) def test_track_to_mpd_format_musicbrainz_trackid(self): track = self.track.copy(musicbrainz_id='foo') From d2bf3f6d830fb5d4f929af324052f1699c82fcb7 Mon Sep 17 00:00:00 2001 From: Thomas Amland Date: Thu, 11 Dec 2014 14:41:37 +0100 Subject: [PATCH 3/5] [local] fix modified files not being updated (cherry picked from commit dfd897832a952c4a7da655f504dc0c162433c539) --- mopidy/local/commands.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mopidy/local/commands.py b/mopidy/local/commands.py index 1e7839a5..a0dc23d1 100644 --- a/mopidy/local/commands.py +++ b/mopidy/local/commands.py @@ -70,7 +70,6 @@ class ScanCommand(commands.Command): library = _get_library(args, config) - uris_in_library = set() uris_to_update = set() uris_to_remove = set() @@ -87,7 +86,7 @@ class ScanCommand(commands.Command): logger.debug('Missing file %s', track.uri) uris_to_remove.add(track.uri) elif mtime > track.last_modified: - uris_in_library.add(track.uri) + uris_to_update.add(track.uri) logger.info('Removing %d missing tracks.', len(uris_to_remove)) for uri in uris_to_remove: From 188c9ef26fd193b7e913abb9997ebe87fd1dbeca Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Tue, 16 Dec 2014 23:34:00 +0100 Subject: [PATCH 4/5] docs: Update changelog --- docs/changelog.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index bddad372..979a5a0c 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -22,6 +22,13 @@ Bug fix release. :attr:`mopidy.models.Track.track_no`, and :attr:`mopidy.models.Track.last_modified` from ``0`` to :class:`None`. +- Local: Fix scanning of modified files. (PR: :issue:`904`) + +- MPD: Re-enable browsing of empty directories. (PR: :issue:`906`) + +- MPD: Remove track comments from responses. They are not included by the + original MPD server, and this works around :issue:`881`. (PR: :issue:`882`) + v0.19.4 (2014-09-01) ==================== From b300c090341450a5337c434ab6c521733f973b4e Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Tue, 16 Dec 2014 23:35:42 +0100 Subject: [PATCH 5/5] docs: Update authors --- .mailmap | 1 + AUTHORS | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.mailmap b/.mailmap index d380162e..45935be6 100644 --- a/.mailmap +++ b/.mailmap @@ -16,3 +16,4 @@ Janez Troha Luke Giuliani Colin Montgomerie Ignasi Fosch +Christopher Schirner diff --git a/AUTHORS b/AUTHORS index e36d953d..b7bad761 100644 --- a/AUTHORS +++ b/AUTHORS @@ -42,3 +42,7 @@ - Sam Willcocks - Ignasi Fosch - Arjun Naik +- Christopher Schirner +- Dmitry Sandalov +- Deni Bertovic +- Thomas Amland