From 181dff90b4ec481da47573ced24129dcd770b2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Str=C3=A4nger?= Date: Tue, 13 Dec 2022 00:12:38 +0100 Subject: [PATCH 1/2] support tracks without a valid duration, e.g. musepack --- mopidy_local/commands.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mopidy_local/commands.py b/mopidy_local/commands.py index b8f851f..69f590c 100644 --- a/mopidy_local/commands.py +++ b/mopidy_local/commands.py @@ -221,17 +221,15 @@ def _scan_metadata( logger.warning( f"Failed scanning {file_uri}: No audio found in file" ) - elif result.duration is None: - logger.warning( - f"Failed scanning {file_uri}: " - "No duration information found in file" - ) - elif result.duration < MIN_DURATION_MS: + elif result.duration and result.duration < MIN_DURATION_MS: logger.warning( f"Failed scanning {file_uri}: " f"Track shorter than {MIN_DURATION_MS}ms" ) else: + if result.duration is None: + logger.warning(f"Failed scanning {file_uri}: proceeding without duration information") + local_uri = translator.path_to_local_track_uri( absolute_path, media_dir ) From ffe3ba71b3d20838db488314918a9f332e449638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Str=C3=A4nger?= Date: Tue, 14 Feb 2023 00:11:20 +0100 Subject: [PATCH 2/2] comply to the linter rules --- mopidy_local/commands.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mopidy_local/commands.py b/mopidy_local/commands.py index 69f590c..b83e4f8 100644 --- a/mopidy_local/commands.py +++ b/mopidy_local/commands.py @@ -228,8 +228,10 @@ def _scan_metadata( ) else: if result.duration is None: - logger.warning(f"Failed scanning {file_uri}: proceeding without duration information") - + logger.warning( + f"Failed scanning {file_uri}: " + "proceeding without duration information" + ) local_uri = translator.path_to_local_track_uri( absolute_path, media_dir )