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

Skip tracks with empty uri in track_to_mpd_format #1343

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion mopidy/mpd/translator.py
@@ -1,11 +1,15 @@
from __future__ import absolute_import, unicode_literals

import datetime
import logging
import re

from mopidy.models import TlTrack
from mopidy.mpd.protocol import tagtype_list


logger = logging.getLogger(__name__)

# TODO: special handling of local:// uri scheme
normalize_path_re = re.compile(r'[^/]+')

Expand Down Expand Up @@ -34,8 +38,12 @@ def track_to_mpd_format(track, position=None, stream_title=None):
else:
(tlid, track) = (None, track)

if not track.uri:
logger.warning('Ignoring track without uri')
return []

result = [
('file', track.uri or ''),
('file', track.uri),
('Time', track.length and (track.length // 1000) or 0),
('Artist', concat_multi_values(track.artists, 'name')),
('Album', track.album and track.album.name or ''),
Expand Down