From 52b81bd858af62f3a01e781e068067d2af4ca900 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Fri, 21 Aug 2015 20:40:18 +0200 Subject: [PATCH 1/2] file: Don't scan files on browsing Fixes #1260 --- docs/changelog.rst | 5 +++++ mopidy/file/library.py | 14 +------------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index c0328de5..6ab7e732 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -21,6 +21,11 @@ Bug fix release. with a limited set of environment variables. (Fixes: :issue:`1249`, PR: :issue:`1255`) +- File: When browsing files, we no longer scan the files to check if they're + playable. This makes browsing of the file hierarchy instant for HTTP clients, + which do no scanning of the files' metadata, and a bit faster for MPD + clients, which no longer scan the files twice. + - Audio: Fix timeout handling in scanner. This regression caused timeouts to expire before it should, causing scans to fail. diff --git a/mopidy/file/library.py b/mopidy/file/library.py index d477d109..b8531a6e 100644 --- a/mopidy/file/library.py +++ b/mopidy/file/library.py @@ -71,7 +71,7 @@ class FileLibraryProvider(backend.LibraryProvider): name = dir_entry.decode(FS_ENCODING, 'replace') if os.path.isdir(child_path): result.append(models.Ref.directory(name=name, uri=uri)) - elif os.path.isfile(child_path) and self._is_audio_file(uri): + elif os.path.isfile(child_path): result.append(models.Ref.track(name=name, uri=uri)) result.sort(key=operator.attrgetter('name')) @@ -134,18 +134,6 @@ class FileLibraryProvider(backend.LibraryProvider): name=media_dir['name'], uri=path.path_to_uri(media_dir['path'])) - def _is_audio_file(self, uri): - try: - result = self._scanner.scan(uri) - if result.playable: - logger.debug('Playable file: %s', result.uri) - else: - logger.debug('Unplayable file: %s (not audio)', result.uri) - return result.playable - except exceptions.ScannerError as e: - logger.debug('Unplayable file: %s (%s)', uri, e) - return False - def _is_in_basedir(self, local_path): return any( path.is_path_inside_base_dir(local_path, media_dir['path']) From baa2cc7ac845209aab5d2fb4b41fed179cf5c9ae Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Fri, 21 Aug 2015 20:44:25 +0200 Subject: [PATCH 2/2] docs: Add issue and PR links --- docs/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 6ab7e732..55357087 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -24,7 +24,8 @@ Bug fix release. - File: When browsing files, we no longer scan the files to check if they're playable. This makes browsing of the file hierarchy instant for HTTP clients, which do no scanning of the files' metadata, and a bit faster for MPD - clients, which no longer scan the files twice. + clients, which no longer scan the files twice. (Fixes: :issue:`1260`, PR: + :issue:`1261`) - Audio: Fix timeout handling in scanner. This regression caused timeouts to expire before it should, causing scans to fail.