CoverArt: add code to handle loading of local files as cover art

This commit is contained in:
Laurent Monin
2015-07-01 17:54:25 +02:00
parent ce5d07c8ac
commit 10b375ccb9

View File

@@ -164,6 +164,26 @@ class CoverArt:
self.next_in_queue()
return
# local files
try:
if coverartimage.filepath:
data = None
try:
with open(coverartimage.filepath, 'rb') as file:
self._set_metadata(coverartimage, file.read())
except IOError, (errnum, errmsg):
log.error("Failed to read %r: %s (%d)" %
(coverartimage.from_file, errmsg, errnum))
except CoverArtImageIOError:
# It doesn't make sense to store/download more images if we can't
# save them in the temporary folder, abort.
return
self.next_in_queue()
return
except AttributeError:
pass
# on the web
self._message(
N_("Downloading cover art of type '%(type)s' for %(albumid)s from %(host)s ..."),
{