If the track doesn't have a file and the user selected to keep original
images, remove the downloaded images from metadata.images so when a
file is added to the track, the original image is kept. Also, this
is more consistent with respect to album images for albums where
some tracks don't have a file and "Keep original images" is selected.
Add a context menu to the Cover Art Box and introduce
an option in that menu to "keep original cover art" which restores
metadata.images from the objects' orig_metadata.images
If the user disabled all cover art providers and tried to save a file
that already contained an image, the state would never change to normal
even after saving the file. This commit fixes this by only comparing
images in File.update if the metadata.images variable is not empty
(note that metadata.update only copies image list if it's not empty,
so this makes sense).
This removes a lot of duplicated code in Album, Cluster and Track, making
a generic function that works for all cases depending on the type of the
object passed as parameter.
Otherwise we get a circular import such as:
File "/home/travis/build/metabrainz/picard/test/test_mbxml.py", line 6, in <module>
from picard.metadata import Metadata
File "/home/travis/build/metabrainz/picard/picard/metadata.py", line 24, in <module>
from picard.coverart.imagelist import ImageList
File "/home/travis/build/metabrainz/picard/picard/coverart/__init__.py", line 28, in <module>
from picard.coverart.providers import cover_art_providers, CoverArtProvider
File "/home/travis/build/metabrainz/picard/picard/coverart/providers/__init__.py", line 168, in <module>
from picard.coverart.providers.local import CoverArtProviderLocal
File "/home/travis/build/metabrainz/picard/picard/coverart/providers/local.py", line 26, in <module>
from picard.coverart.image import CoverArtImageFromFile
File "/home/travis/build/metabrainz/picard/picard/coverart/image.py", line 33, in <module>
from picard.script import ScriptParser
File "/home/travis/build/metabrainz/picard/picard/script.py", line 27, in <module>
from picard.metadata import Metadata
ImportError: cannot import name Metadata
By also setting has_common_images to True when len(data)==1 (which doesn't
affect the shown pixmap) when calculing the key, this fixes the case
when an album has only 2 files, one with the same images as the release
and the other doesn't have any image at all. In that case, when
choosing if orig/new widgets have to be visible, the original
and new images were the same, but the "new" widget had
has_common_images == True and "orig" had has_common_images == False.
Since the second file actually doesn't have any orig image, we don't
want to show orig/new widgets when selecting the album.
When one track has one image and the rest don't have any. Show
"1 image not in all tracks" as album title.
Also, count images in orig_metadata.images when a release doesn't
have any, since CoverArtBox shows orig_metadata in such a case and
it would be strange to have a cover shown and "0 images" in the title.
Make InfoDialog store locally in the constructor the images it'll use as
new images and as existing images. This allows to swap them in case we
want to display the existing artwork of a file whose release doesn't
define any artwork (that is, a track with 1 file and which has
orig_metadata.images but no metadata.images). Also, it'll allow
for easier refactoring in the future.
Also make CoverArtBox use item.can_view_info instead of duplicating
(wrong) the logic to decide if the "show more info" button should be
visible or not.
An album can have no metadata.images but have orig_metadata.images.
In that case, we also want to display the info dialog, to show
the existing images.
Also, removed self.metadata, since for an album, that's only true when
self.metadata.images is true, which is tested right afterwards.
Now that signals are emitted correctly when a file changes its images,
album.update_metadata_images is called correctly so there's no need
to force calls to update_metadata_images from update().
This fixes the update of the CoverArtBox widget when an album
which is selected is saved.
This fixes PICARD-1001, which was comparing the following two images:
CoverArtImage(url=u'http://ec2.images-amazon.com/images/P/B001BJAG9O.03.LZZZZZZZ.jpg')
TagCoverArtImage(u'/mnt/data/music/Amy Macdonald/2007 - This Is the Life [2008]/01 - Mr Rock & Roll.flac', tag='FLAC/PICTURE', types=[u'front'], support_types=True)
Which were exactly the same, but the one coming from the release had
an empty types, so they were handled as different.
This commit makes images with "no type" defined match "any type" (as
long as the image data is the same, of course).
When the list of new images and the list of original images are compared
to select if there are changes, it's important that they are sorted,
since when an info dialog is opened, it sorts the images by image type.
This breaks all future comparisons of that list of images with others,
so this sorts the images to fix this issue.
This fixes PICARD-1001
The images used by the Thumbnail are kept in a "poor-man-cache" to know
if set_data should be run or not, but has_common_images wasn't used.
This fixes the situation where an album with only two files in
different tracks, one with two original images and another with none,
would keep a wrong original cover art when selecting the album and the
track with the two original images alternatively. The reason is that
the images to show would be the same, but for the Track, has_common_images
would be True, while for the Album, it would be False (so for the Track
it would be a normal stack but for the album it would have the yellow glow)
This is mostly useful for debugging to avoid touching the main configuration
file while trying different settings, but could also be used for switching
between multiple tagging profiles.