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

Remove code for creating URIs from Musicbrainz IDs #31

Merged
merged 3 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 0 additions & 7 deletions mopidy_local/library.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import hashlib
import logging
import operator
import sqlite3
Expand Down Expand Up @@ -203,9 +202,3 @@ def _filters(self, uri):
return [{"album": uri}]
else:
return []

def _model_uri(self, type, model):
if model.musicbrainz_id and self._config["use_%s_mbid_uri" % type]:
return f"local:{type}:mbid:{model.musicbrainz_id}"
digest = hashlib.md5(str(model)).hexdigest()
return f"local:{type}:md5:{digest}"
5 changes: 1 addition & 4 deletions mopidy_local/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ def get_image_size_gif(data):


def model_uri(type, model):
# only use valid mbids; TODO: use regex for that?
if model.musicbrainz_id and len(model.musicbrainz_id) == 36:
return f"local:{type}:mbid:{model.musicbrainz_id}"
elif type == "album":
if type == "album":
# ignore num_tracks for multi-disc albums
digest = hashlib.md5(str(model.replace(num_tracks=None)).encode())
else:
Expand Down