Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support tracks without a valid duration, e.g. musepack #70

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions mopidy_local/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,17 @@
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:

Check warning on line 224 in mopidy_local/commands.py

View check run for this annotation

Codecov / codecov/patch

mopidy_local/commands.py#L224

Added line #L224 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case, this change will now let duration 0 pass and skip through all checks because it's not None and it's falsey

logger.warning(
f"Failed scanning {file_uri}: "
f"Track shorter than {MIN_DURATION_MS}ms"
)
else:
if result.duration is None:
logger.warning(

Check warning on line 231 in mopidy_local/commands.py

View check run for this annotation

Codecov / codecov/patch

mopidy_local/commands.py#L230-L231

Added lines #L230 - L231 were not covered by tests
f"Failed scanning {file_uri}: "
"proceeding without duration information"
)
local_uri = translator.path_to_local_track_uri(
absolute_path, media_dir
)
Expand Down