Commit Graph

3092 Commits

Author SHA1 Message Date
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
Sophist
87da33bd8e Improve clustering by grouping by directory 2014-05-12 21:07:32 +01:00
Sophist
3e601c06c1 Strip tracknumber from title if leading 2014-05-12 21:07:31 +01:00
Laurent Monin
e7924239c0 Merge pull request #327 from Sophist-UK/sophist_fix_tagstofilenames
Fix issues in Tags from File Names...
2014-05-12 14:59:24 +02:00
Laurent Monin
a6ce2047cf Merge pull request #325 from zas/request_delay_fix
Fix up "Waiting 0 ms before ..." debug message
2014-05-12 14:57:47 +02:00
Laurent Monin
818af48e25 Merge pull request #324 from zas/add_files_debug_fix
Fix debug message "Add files <generator object <genexpr> at ..."
2014-05-12 14:57:11 +02:00
Laurent Monin
f34eb6316d Merge pull request #320 from zas/album.metadata.hack.fix
Remove the hack modifying album.metadata['album'] for display purpose
2014-05-12 14:56:45 +02:00
Sophist
9b2bd19f1a Fix issues in Tags from File Names...
1. Replace all \ with / in path not just last one so it works properly
on Windows.
2. Set combo index to show last used string
3. Strip leading zeros from numeric tags like tracknumber.
2014-05-12 10:25:02 +01:00
Laurent Monin
6280451464 Fix up "Waiting 0 ms before ..." debug message
- last_ms has sub-milliseconds precision
- request_delay - last_ms can be < 1.0 (and it is a float)
- message use %d to convert value from float to int (so 0.5 is displayed 0 ms)
- QTimer.start() only supports milliseconds precision as int (so 0.5 will prolly be converted to 0)
- if delay is required, better wait more than not enough, so, ie.,  0.7 ms delay is converted to 1 ms
- when delay is required, 0 delay doesn't make sense, first branch of the if condition handled that
- int(math.ceil(delay)) does the job
- int() cast is needed with python 2 (it returns a float), python 3 math.ceil() returns int
2014-05-11 14:10:06 +02:00
Laurent Monin
478544f2bb Fix debug message "Add files <generator object <genexpr> at ..."
Not very useful, replaced by a more useful debug message (later in code, since exclusion of files is already logged)
2014-05-11 13:29:53 +02:00
Laurent Monin
c2f128c001 Merge pull request #322 from Sophist-UK/sophist_add_tests_windows_drive
Fix and add tests for windows drive
2014-05-11 13:18:38 +02:00
Sophist
81544ca38f Fix so this runs correctly under ix with win set. 2014-05-11 11:31:58 +01:00
Sophist
adab289bdb Fix and add tests for windows drive 2014-05-11 10:24:35 +01:00
Laurent Monin
82b4895e98 Merge pull request #321 from Sophist-UK/sophist_improve_76bf791c2a990eebe3b1d7620bd002a5999415b0
Improve 76bf791
2014-05-11 10:08:03 +02:00
Sophist
c826639abc Improve 76bf791c2a
Puts the fix where it really should be in replace_win32_incompat.
2014-05-11 08:00:19 +01:00
Laurent Monin
b454cc1506 Remove the hack modifying album.metadata['album'] for display purpose
This hack was leading to cluttered debug messages since __repr__() was returning
status message in place of album's title.

Instead use a `status` property which is displayed in place of the title when it isn't None.
2014-05-10 22:30:45 +02:00
Laurent Monin
2a4cd9c317 Merge pull request #313 from zas/coverart_cleanup
Coverart cleanup, mostly code rewrite + minor fixes
2014-05-10 22:03:52 +02:00
Laurent Monin
60527717ff Merge pull request #318 from Sophist-UK/sophist_refresh_only_obj.can_refresh
Only refresh objects which can be refreshed
2014-05-10 21:56:02 +02:00
Laurent Monin
34d02c4027 Merge pull request #319 from Sophist-UK/sophist_fix_cover_art_saves_windows
Fix conversion of : to _ in drive letter on windows
2014-05-10 21:55:35 +02:00
Laurent Monin
52afea16d8 Differentiate case of no CAA info vs no cover art 2014-05-10 21:21:13 +02:00
Laurent Monin
ced1d2ac82 has_caa_artwork -> caa_has_suitable_artwork
It reflects much more its purpose as even if caa has artwork we may have this set to False
2014-05-10 21:02:35 +02:00
Laurent Monin
7b034087d7 Introduce caa_has_front and caa_has_back, reduce code redundancy 2014-05-10 20:59:52 +02:00
Laurent Monin
8078702741 has_front -> want_front, has_back -> want_back
Those are defined according to user config option for accepted caa types.
2014-05-10 20:53:30 +02:00
Sophist
76bf791c2a Fix conversion of : to _ in drive letter on windows
```
D: 19:02:00 Saving cover images to u'D_\\Audio\\Music\\Pop\\ABBA\\ABBA
(1992) Gold - Greatest Hits\\folder'
E: 19:02:00 Traceback (most recent call last):
File "picard\util\thread.pyo", line 46, in run
File "picard\file.pyo", line 197, in _save_and_rename
File "picard\file.pyo", line 326, in _save_images
File "picard\metadata.pyo", line 143, in save
File "os.pyo", line 150, in makedirs
File "os.pyo", line 150, in makedirs
File "os.pyo", line 150, in makedirs
File "os.pyo", line 150, in makedirs
File "os.pyo", line 150, in makedirs
File "os.pyo", line 157, in makedirs
WindowsError: [Error 5] Access is denied: u'D_'
```
2014-05-10 19:02:42 +01:00