mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-06 00:23:58 +00:00
Eventually raise CoverArtImageIOError when getting CoverArtImage.data
This commit is contained in:
@@ -304,10 +304,13 @@ class CoverArtImage:
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
"""Reads the data from the temporary file created for this image. May
|
||||
raise IOErrors or OSErrors.
|
||||
"""Reads the data from the temporary file created for this image.
|
||||
May raise CoverArtImageIOError
|
||||
"""
|
||||
return self.datahash.data
|
||||
try:
|
||||
return self.datahash.data
|
||||
except (OSError, IOError) as e:
|
||||
raise CoverArtImageIOError(e)
|
||||
|
||||
@property
|
||||
def tempfile_filename(self):
|
||||
|
||||
@@ -23,6 +23,7 @@ import traceback
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from picard import log
|
||||
from picard.coverartarchive import translate_caa_type
|
||||
from picard.coverartimage import CoverArtImageIOError
|
||||
from picard.util import format_time, encode_filename, bytes2human
|
||||
from picard.ui import PicardDialog
|
||||
from picard.ui.ui_infodialog import Ui_InfoDialog
|
||||
@@ -57,11 +58,12 @@ class InfoDialog(PicardDialog):
|
||||
if image.thumbnail:
|
||||
try:
|
||||
data = image.thumbnail.data
|
||||
except:
|
||||
except CoverArtImageIOError as e:
|
||||
log.warning(unicode(e))
|
||||
pass
|
||||
else:
|
||||
data = image.data
|
||||
except (OSError, IOError) as e:
|
||||
except CoverArtImageIOError:
|
||||
log.error(traceback.format_exc())
|
||||
continue
|
||||
item = QtGui.QListWidgetItem()
|
||||
|
||||
Reference in New Issue
Block a user