Commit Graph

7535 Commits

Author SHA1 Message Date
Antonio Larrosa
3de28b37a7 Don't define set_image functions inside load_remote_image 2017-03-24 13:51:24 +01:00
Antonio Larrosa
b0a1c0e071 Renamed behaviour_on_image_drop to load_image_behavior
Also renamed related methods/variables to follow the same pattern
2017-03-24 13:40:47 +01:00
Antonio Larrosa
b0c9c261d6 Rename drop_image to set_image and fix menu entry names
Renamed "Use Original Cover Art" to "Keep original cover art" and
added ... to the end of "Show more details"
2017-03-24 13:31:48 +01:00
Antonio Larrosa
cac46dabb1 Remove images in keep_original_images if the track doesn't have a file
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.
2017-03-24 11:56:39 +01:00
Antonio Larrosa
fe794ddd9b Copy the list of images when keeping them
We want a copy of the list or the orig_metadata.images would be
overwritten by changes to the metadata.images
2017-03-24 11:49:34 +01:00
Antonio Larrosa
0b62148b61 Fix E731: Use a def instead of lambda 2017-03-24 11:49:34 +01:00
Antonio Larrosa
e71f383006 Set the image drop default behaviour to "append"
This way we don't change the current behaviour
2017-03-24 11:49:34 +01:00
Antonio Larrosa
cc0a31d384 Add new setting to allow users to replace/append dropped images
The context menu for the cover art box now allows to set the behaviour
on image drop to replace/append front images.
2017-03-24 11:49:09 +01:00
Antonio Larrosa
fe004b9768 Show the "Show details" menu entry only when needed
Also reindent the "use original cover art" block which was overindented
2017-03-24 11:38:54 +01:00
Antonio Larrosa
99b4f014ae Remove unnecessary code 2017-03-24 11:38:46 +01:00
Antonio Larrosa
66275fabc7 Add context menu to CoverArtBox and "keep images" option
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
2017-03-24 11:38:24 +01:00
Laurent Monin
edbeafbc2c Update picard.pot 2017-03-24 11:08:24 +01:00
Laurent Monin
075b67834f Merge pull request #657 from antlarr/fix-album-cover-art-corner-cases
PICARD-1001, PICARD-1014, PICARD-1015, PICARD-1016, PICARD-1018: Fix album cover art corner cases
2017-03-24 10:58:45 +01:00
Antonio Larrosa
22b719f368 Fix file state not changing to NORMAL when no image was provided
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).
2017-03-24 09:54:00 +01:00
Antonio Larrosa
b07fded707 Remove unused/unneeded code
And added an empty line as needed by PEP-8
2017-03-23 19:35:40 +01:00
Antonio Larrosa
2cef2fb0e1 Simplified ImageList
Following zas' review comments
2017-03-23 19:35:40 +01:00
Antonio Larrosa
8803f27419 Move the State class to the module and its variables to instance 2017-03-23 19:35:40 +01:00
Antonio Larrosa
d2e7d20488 Unify all *.update_metadata_images methods to a common function in imagelist.py
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.
2017-03-23 19:35:40 +01:00
Antonio Larrosa
9fec50c104 Fix circular import of ImageList by moving it to util
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
2017-03-23 19:35:40 +01:00
Antonio Larrosa
cfbd86b190 Add an ImageList class to compare easily list of images
This removes the need to explicitly sort the list of images
by image type before each comparison
2017-03-23 19:35:40 +01:00
Antonio Larrosa
5648fc9496 Remove duplicated code in Cluster and InfoDialog 2017-03-23 19:35:40 +01:00
Antonio Larrosa
e346931f5e Compare CoverArtThumbnails using the hash key of the current used pixmap
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.
2017-03-23 19:35:40 +01:00
Antonio Larrosa
f49625ce5a Add message "1 image not in all tracks" and fix corner case
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.
2017-03-23 19:35:40 +01:00
Antonio Larrosa
5820a26a64 Fix info dialog image diff corner cases
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.
2017-03-23 19:35:40 +01:00
Antonio Larrosa
f6362a15aa Allow to view info also when it only has orig_metadata.images
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.
2017-03-23 19:35:40 +01:00
Antonio Larrosa
df8f5b55b9 Update the album item after images are changed
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.
2017-03-23 19:35:40 +01:00
Antonio Larrosa
9aceb08d9d Allow images with "no type" to match "any type"
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).
2017-03-23 19:35:40 +01:00
Antonio Larrosa
1f220d74e9 Update the orig_metadata images of a track when a file is saved
This should fix the remaining broken cases of PICARD-1015
2017-03-23 19:35:40 +01:00
Antonio Larrosa
66cc8dd85f Fix comparisons of list of images sorting them in coverartbox and infodialog
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
2017-03-23 19:35:40 +01:00
Antonio Larrosa
d228c56741 Use self.has_common_images to know if set_data should be executed or not
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)
2017-03-23 19:35:40 +01:00
Antonio Larrosa
5f96da38a3 Add tooltip also for original cover art 2017-03-23 19:35:40 +01:00
Antonio Larrosa
8afaa54627 Fix number of images in the album's itemview item title
This fixes the text on the album item after images are changed,
not before.

Fixes PICARD-1014
2017-03-23 19:35:40 +01:00
Antonio Larrosa
88e1cdaa86 Add orig_metadata.images to Tracks so infodialog shows artwork changes
Fixes PICARD-1015
2017-03-23 19:35:40 +01:00
Antonio Larrosa
12f9a35ae9 Fix album cover art not being updated on unmatched files changes and ...
Also makes CoverArtBox react inmediately to new files being dropped
in a selected album, so the CoverArtBox is updated instantly.
2017-03-23 19:35:40 +01:00
Laurent Monin
b3ceb9f4aa Merge pull request #662 from metabrainz/samj1912-patch-1
PICARD-1029: Fix typo in artist_credit_to_metadata
2017-03-23 17:49:56 +01:00
Sambhav Kothari
01f7e6e2e4 Fix typo in artist_credit_to_metadata 2017-03-23 21:36:25 +05:30
Laurent Monin
a7e0d71d43 Merge pull request #661 from Sophist-UK/PICARD-1023_enhance-add-directory-path-persistance
PICARD-1023: Tweak Add Directory path persistance
2017-03-22 22:06:08 +01:00
Wieland Hoffmann
17957260ef _browse: Move keyword arguments that are never changed to the call to self.get 2017-03-20 18:55:26 +01:00
Wieland Hoffmann
25be5aaa66 _browse: Remove queryargs from keyword arguments
It's set to kwargs later, ignoring its previous value.
2017-03-20 18:54:15 +01:00
Wieland Hoffmann
f38d200128 _find: Move keyword arguments that are never changed to the call to self.get 2017-03-20 18:52:35 +01:00
Wieland Hoffmann
68409e2612 Reindent kwargs 2017-03-20 18:51:25 +01:00
Wieland Hoffmann
c852e0caed _find: Remove queryargs from keyword arguments
It's set to an empty dictionary later, ignoring its previous value.
2017-03-20 18:50:26 +01:00
Sophist
7b28952dde Tweak Add Directory path persistance
Stop Add Directory opening one directory higher if you don't select any
sub-directories.
2017-03-19 18:57:09 +00:00
Sophist
e0fbdce746 Similar fix for _browse 2017-03-19 18:30:32 +00:00
Sophist
7c27d37240 Fix kwargs, set defaults, revert searchdialog.py 2017-03-19 18:26:51 +00:00
Laurent Monin
0a276b078d Merge pull request #659 from mineo/explicit-config-file
PICARD-1024: Allow specifying a configuration file path
2017-03-19 18:01:35 +01:00
Laurent Monin
9e63079555 Merge pull request #658 from Sophist-UK/PICARD-1021_Skip-file-loads-if-stopping
PICARD-1021: Skip file loads if Picard is stopping
2017-03-19 17:44:26 +01:00
Sophist
8ad0490504 Address @zas comments 2017-03-19 12:21:52 +00:00
Wieland Hoffmann
4be605f678 PICARD-1024: Allow specifying a configuration file path
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.
2017-03-19 10:41:45 +01:00
Wieland Hoffmann
3eef8eb4ab Remove unused imports 2017-03-19 10:41:45 +01:00