Commit Graph

4459 Commits

Author SHA1 Message Date
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
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
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
Laurent Monin
d45a5a5277 Merge pull request #660 from mineo/run-cleanup-cleanup
Use run_cleanup instead of copying its function body
2017-03-18 15:41:32 +01:00
Wieland Hoffmann
8d91e6b0d3 Remove unused imports 2017-03-18 12:01:34 +01:00
Wieland Hoffmann
9a35ee97a8 Use run_cleanup instead of copying its function body 2017-03-18 11:59:22 +01:00
Sophist
7e40e0386a Skip file loads if Picard is stopping 2017-03-16 18:52:32 +00:00
Laurent Monin
a78450122d Resync translations 2017-03-13 13:36:25 +01:00
Laurent Monin
ac3e0b7c72 Regenerate pot file 2017-03-13 13:34:48 +01:00
Laurent Monin
cb1ff1d4e6 Merge pull request #642 from antlarr/album-cover-art
PICARD-1000: Show album/cluster cover art
2017-03-13 13:31:24 +01:00
Laurent Monin
9c20d93a82 Merge pull request #654 from samj1912/picard1012
PICARD-1012: Change QToolButtons to QPushButtons for GUI uniformity
2017-03-13 13:26:17 +01:00
Laurent Monin
c628849603 Merge pull request #635 from tungol/TXXX_hook
PICARD-990: Avoid multiple value TXXX frames
2017-03-13 13:24:17 +01:00
Laurent Monin
32dc32de2f Update attributes translations 2017-03-13 13:07:45 +01:00
Laurent Monin
0b4ab688d8 Merge pull request #655 from samj1912/picard1011
PICARD-1011: Set action toolbar tab order according to custom order
2017-03-13 12:56:06 +01:00
Laurent Monin
cfaba806c7 Merge pull request #653 from samj1912/picard1010
PICARD-1010: Fix display/hide logic for Coverart box
2017-03-13 12:49:14 +01:00
Sambhav Kothari
fa18ef3046 PICARD-1011: Set action toolbar tab order according to custom order
With #567 support for customizable toolbars was added.
This commit changes the set_tab_order function to correspond with the
custom toolbar layout dynamically.

See: https://tickets.metabrainz.org/browse/PICARD-1011
2017-03-13 13:34:35 +05:30
Sambhav Kothari
38bbe977db PICARD-1012: Change QToolButtons to QPushButtons for GUI uniformity
QToolButtons in User Interface and Scripting looked smalled in comparison
to the rest of the UI.

See: https://tickets.metabrainz.org/browse/PICARD-1012
2017-03-13 00:10:56 +05:30
Antonio Larrosa
879a86e51c Fix unneeded broken import from a bad rebase merge 2017-03-12 19:07:52 +01:00
Sambhav Kothari
855784522b PICARD-1010: Fix display/hide logic for Coverart box
Earlier when the display for Cover art box was toggled, it only
hid the cover art box on trigger. On selection update a
super().show() was called which again caused the cover art box to be
visible. This fixes the flawed display logic due to PR#643.

See: https://tickets.metabrainz.org/browse/PICARD-1010
2017-03-12 21:26:51 +05:30
Antonio Larrosa
0992a6cb7e Move MAX_COVERS_TO_STACK to picard.const 2017-03-11 13:05:40 +01:00
Antonio Larrosa
65499261ec Small fixes
Add a constant to hold the maximum number of covers to draw in a stack.
Extract html tags out of a translated message.
Reformat an if expression to move overators to front.
Remove an unneeded comment.
2017-03-11 13:05:40 +01:00