Skip to content

Commit

Permalink
Remove code for creating URIs from Musicbrainz IDs (#31)
Browse files Browse the repository at this point in the history
* Remove code for creating URIs from Musicbrainz IDs

* Rmove unused imports of hashlib

* ... yeah that's global search and replace for you
  • Loading branch information
fatg3erman authored and jodal committed Jan 9, 2020
1 parent e337e9f commit 9b946c7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
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

0 comments on commit 9b946c7

Please sign in to comment.