Commit Graph

3115 Commits

Author SHA1 Message Date
Laurent Monin
7e1902fdec Output more infos about downloaded image in debug mode 2014-05-21 16:04:35 +02:00
Laurent Monin
2e7caa5a2c Fix up set_data() 2014-05-21 16:04:34 +02:00
Laurent Monin
a07825fd85 Improve debugging messages 2014-05-21 16:04:34 +02:00
Laurent Monin
9e2a91d203 Re-add dummy load to ensure test images are > 64kb
As said in comment, size was increased to catch a bug in mutagen, so better
to keep it.
2014-05-21 16:04:34 +02:00
Laurent Monin
c7ce593941 Introduce exceptions CoverArtImageIOError and CoverArtImageIdentificationError
- hide imageinfo exceptions
- hide io/filesystem exceptions
- those may change in future, callers don't need to know details
2014-05-21 16:04:34 +02:00
Laurent Monin
03ff7f9501 Cleanup debug messages 2014-05-19 17:09:15 +02:00
Laurent Monin
1ed5af2bc7 Reduce code redundancy, introduce _next_filename() and _is_write_needed() 2014-05-19 17:03:19 +02:00
Laurent Monin
f13574bb98 Remove unused CoverArtImage.filename and associated code 2014-05-19 16:28:32 +02:00
Laurent Monin
83e45ec77d Minor change in test. 2014-05-16 23:06:42 +02:00
Laurent Monin
c14e8339c2 Add few comments 2014-05-16 23:01:11 +02:00
Laurent Monin
0d25a8d961 TagCoverArtImage.source(): better display if no tag was set 2014-05-16 23:00:58 +02:00
Laurent Monin
454b11225e Tidy up. 2014-05-16 22:59:11 +02:00
Laurent Monin
6d7029f955 Return 'front' as main type if at least one type is 'front' 2014-05-16 22:58:55 +02:00
Laurent Monin
cc27ac0bba Add helper CoverArtImage.types_as_string() to format types for display 2014-05-16 22:37:53 +02:00
Laurent Monin
c37f740a30 types_and_front() -> types_from_id3(), setting is_front isn't require anymore 2014-05-16 20:53:10 +02:00
Laurent Monin
68f246a20d Use is_front_image() instead of is_front 2014-05-16 20:51:55 +02:00
Laurent Monin
f911beac83 Add missing import 2014-05-16 20:49:49 +02:00
Laurent Monin
a5827926ac Improve tests for cover art types
- add tests according to save_only_front_images_to_tags
- some formats cannot save more than one image
- some formats have no type
2014-05-16 20:40:50 +02:00
Laurent Monin
e3c5e4b4c7 Improve __repr__() outputs 2014-05-16 20:38:57 +02:00
Laurent Monin
07bcbb1abe CoverArtImage.maintype defaults to 'front' if is_front is set or no type set 2014-05-16 20:38:32 +02:00
Laurent Monin
9966908668 Initialize CoverArtImage.is_front to None, and don't specify default type
- is_front is used when one set "front" explicitly (CAA does it)
- types is now empty by default
- rely on is_front_image() to handle various cases
- if support_types is False, is_front_image() will default to True
2014-05-16 20:37:49 +02:00
Laurent Monin
32b014f4b8 Replace save_this_image_to_tags() with Metadata.images_to_be_saved_to_tags
It simplifies code, and it fixes the code, using is_front_image() instead of is_front.
2014-05-16 20:32:29 +02:00
Laurent Monin
0d8e1d31a3 Metadata.append_image(): remove useless assert() 2014-05-16 17:30:04 +02:00
Laurent Monin
1f9b49c656 imageinfo.identify(): improve description about exceptions 2014-05-16 17:25:53 +02:00
Laurent Monin
1431e3b32d Remove unused imports 2014-05-16 16:19:24 +02:00
Laurent Monin
fc59e6d40e CoverArtImage.set_data(): fix up comment
No ref counter anymore.
2014-05-16 16:00:23 +02:00
Laurent Monin
aadd248087 CoverArtImage.maintype -> @property 2014-05-16 15:58:58 +02:00
Laurent Monin
332ae6757e imageinfo: replace assert() with exception raise
Exception UnexpectedError may be raised if for some reason data parsing fails.
2014-05-16 15:55:02 +02:00
Laurent Monin
dc6e150d45 imageinfo: differentiate each failure case
Add exceptions (subclassing IdentificationError):
- NotEnoughData
- UnrecognizedFormat

Add corresponding test code.
2014-05-16 15:47:24 +02:00
Laurent Monin
fe62ec7c1e imageinfo.IdentifyError -> imageinfo.IdentificationError 2014-05-16 15:40:23 +02:00
Laurent Monin
d70b1a518a support_types=False is the default, unneeded 2014-05-15 17:28:11 +02:00
Laurent Monin
caac63262f Remove now unused util.mimetype 2014-05-15 16:09:27 +02:00
Laurent Monin
a0213db350 Rely on imageinfo.identify to extract mimetype
- it does what mimetypes.get_from_data()
- .tiff is unused (afaik), so don't bother with it
- it is safer to analyze data for mime type (as data may not match provided mime type)
- when images are loaded from audio file tags, a check is done on valid format
2014-05-15 16:05:01 +02:00
Laurent Monin
8afcefaa6b Remove now unused LockableDefaultDict 2014-05-15 15:42:54 +02:00
Laurent Monin
5ab4625fe7 imageinfo: simplify code and exceptions, image_info() -> identify() 2014-05-15 15:40:36 +02:00
Laurent Monin
9a8fd64aec imageinfo: add extension to result 2014-05-15 15:29:22 +02:00
Laurent Monin
adc54cc3b4 Fix deprecated exception.message 2014-05-15 15:28:16 +02:00
Laurent Monin
a9e9a14a74 Use real image files to test formats 2014-05-15 14:36:41 +02:00
Laurent Monin
b4367486bd Introduce image_info() to extract width, height from image data 2014-05-15 14:35:56 +02:00
Laurent Monin
42f2048d99 Drop refcount/__del__ mess, make code much more reliable and simpler 2014-05-15 14:26:39 +02:00
Laurent Monin
d652e7307b Make exit cleanup process more generic 2014-05-14 15:55:04 +02:00
Laurent Monin
60bfd6d344 Merge Image() and CoverArtImage()
- Info dialog Artwork tab now displays types and comment for cover art images
- a tooltip gives info about the source (url, caa url, local file, tag, ...)
2014-05-14 15:55:04 +02:00
Laurent Monin
ad0c66ec24 Use new translate_caa_type() to handle caa type translations 2014-05-14 15:55:03 +02:00
Laurent Monin
bdaf9e7d89 Add missing whitelines + album_artist_from_path() description 2014-05-13 17:05:01 +02:00
Laurent Monin
7d378f3026 Merge pull request #328 from Sophist-UK/sophist_improve_clustering
Improve clustering using directory structure if no existing album tags
2014-05-13 15:28:43 +02:00
Sophist
4daab44b74 Fix typo 2014-05-12 22:28:47 +01:00
Sophist
6344ca2806 Move album_artist_from_path to utils
and add test.
2014-05-12 22:24:31 +01:00
Sophist
3cc636b402 Simplify code for readability. 2014-05-12 21:07:37 +01:00
Sophist
cacc4c1419 Remove debug print. 2014-05-12 21:07:35 +01:00
Sophist
cbc3a79205 Tweak to not overwrite artist if it exists 2014-05-12 21:07:34 +01:00