Output more infos about downloaded image in debug mode

This commit is contained in:
Laurent Monin
2014-05-19 23:54:22 +02:00
parent 2e7caa5a2c
commit 7e1902fdec
2 changed files with 16 additions and 1 deletions

View File

@@ -202,9 +202,14 @@ class CoverArt:
},
echo=None
)
log.debug("Cover art image downloaded: %r" % coverartimage)
try:
coverartimage.set_data(data)
log.debug("Cover art image downloaded: %r [%s]" %
(
coverartimage,
coverartimage.imageinfo_as_string()
)
)
self.metadata.append_image(coverartimage)
for track in self.album._new_tracks:
track.metadata.append_image(coverartimage)

View File

@@ -155,6 +155,16 @@ class CoverArtImage:
return True
return (self.support_types == False)
def imageinfo_as_string(self):
if self.datahash is None:
return ""
return "w=%d h=%d mime=%s ext=%s datalen=%d file=%s" % (self.width,
self.height,
self.mimetype,
self.extension,
self.datalength,
get_filename_from_hash(self.datahash))
def __repr__(self):
p = []
if self.url is not None: