mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-21 15:14:13 +00:00
CoverArt: add code to handle loading of local files as cover art
This commit is contained in:
@@ -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 ..."),
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user