Skip to content

Commit

Permalink
Merge pull request #1025 from tkem/fix/1023
Browse files Browse the repository at this point in the history
Fix #1023: Remove support for local album images from coverartarchive.org
  • Loading branch information
adamcik committed Mar 7, 2015
2 parents 7337324 + 8d2cedc commit a279285
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 27 deletions.
3 changes: 0 additions & 3 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ v0.20.0 (UNRELEASED)

**Local backend**

- Add cover URL to all scanned files with MusicBrainz album IDs. (Fixes:
:issue:`697`, PR: :issue:`802`)

- Local library API: Implementors of :meth:`mopidy.local.Library.lookup` should
now return a list of :class:`~mopidy.models.Track` instead of a single track,
just like the other ``lookup()`` methods in Mopidy. For now, returning a
Expand Down
1 change: 0 additions & 1 deletion mopidy/local/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def run(self, args, config):
mtime = file_mtimes.get(os.path.join(media_dir, relpath))
track = utils.convert_tags_to_track(tags).copy(
uri=uri, length=duration, last_modified=mtime)
track = translator.add_musicbrainz_coverart_to_track(track)
if library.add_supports_tags_and_duration:
library.add(track, tags=tags, duration=duration)
else:
Expand Down
9 changes: 0 additions & 9 deletions mopidy/local/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,10 @@


M3U_EXTINF_RE = re.compile(r'#EXTINF:(-1|\d+),(.*)')
COVERART_BASE = 'http://coverartarchive.org/release/%s/front'

logger = logging.getLogger(__name__)


def add_musicbrainz_coverart_to_track(track):
if track.album and track.album.musicbrainz_id:
images = [COVERART_BASE % track.album.musicbrainz_id]
album = track.album.copy(images=images)
track = track.copy(album=album)
return track


def local_track_uri_to_file_uri(uri, media_dir):
return path_to_uri(local_track_uri_to_path(uri, media_dir))

Expand Down
15 changes: 1 addition & 14 deletions tests/local/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import unittest

from mopidy.local import translator
from mopidy.models import Album, Track
from mopidy.models import Track
from mopidy.utils import path

from tests import path_to_data_dir
Expand Down Expand Up @@ -118,16 +118,3 @@ def test_ext_encoding_is_latin1(self):

class URItoM3UTest(unittest.TestCase):
pass


class AddMusicbrainzCoverartTest(unittest.TestCase):
def test_add_cover_for_album(self):
album = Album(musicbrainz_id='someid')
track = Track(album=album)

expected = album.copy(
images=['http://coverartarchive.org/release/someid/front'])

self.assertEqual(
track.copy(album=expected),
translator.add_musicbrainz_coverart_to_track(track))

0 comments on commit a279285

Please sign in to comment.