Skip to content

Commit

Permalink
Merge pull request #2582 from zas/codacy_fixes
Browse files Browse the repository at this point in the history
Codacy fixes
  • Loading branch information
zas authored Feb 22, 2025
2 parents 8b445aa + 973593f commit d0c6750
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .prospector.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Configuration for prospector, mainly used by Codacy.
output-format: grouped

max-line-length: 120
ignore-patterns:
- ^picard/ui/forms/ui_.*\.py$

mccabe:
run: false

pep8:
# Please see comments in setup.cfg as to why we disable the below checks.
Expand Down
9 changes: 7 additions & 2 deletions picard/coverart/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def _coverart_downloaded(self, coverartimage, data, http, error):
filters_result = run_image_filters(data, image_info, self.album, coverartimage)
if filters_result:
self._set_metadata(coverartimage, data, image_info)
except imageinfo.IdentificationError:
except imageinfo.IdentificationError as e:
log.warning("Couldn't identify image %r: %s", coverartimage, e)
return

self.next_in_queue()
Expand Down Expand Up @@ -172,7 +173,11 @@ def next_in_queue(self):
try:
path = coverartimage.url.toLocalFile()
with open(path, 'rb') as file:
self._set_metadata(coverartimage, file.read())
data = file.read()
image_info = imageinfo.identify(data)
self._set_metadata(coverartimage, data, image_info)
except imageinfo.IdentificationError as e:
log.error("Couldn't identify image file %r: %s", path, e)
except OSError as exc:
(errnum, errmsg) = exc.args
log.error("Failed to read %r: %s (%d)", path, errmsg, errnum)
Expand Down

0 comments on commit d0c6750

Please sign in to comment.