Merge branch 'master' into embedart-logging

Conflicts:
	beetsplug/embedart.py
This commit is contained in:
Bruno Cauet 2015-01-24 11:31:31 +01:00
commit 23dcdebe9a
6 changed files with 20 additions and 7 deletions

View file

@ -326,7 +326,11 @@ class Image(object):
self.data = data
self.desc = desc
if isinstance(type, int):
type = list(ImageType)[type]
try:
type = list(ImageType)[type]
except IndexError:
log.debug(u"ignoring unknown image type index {0}", type)
type = ImageType.other
self.type = type
@property

View file

@ -93,10 +93,10 @@ class EmbedCoverArtPlugin(BeetsPlugin):
help='image output file')
def extract_func(lib, opts, args):
outpath = normpath(opts.outpath or 'cover')
item = lib.items(decargs(args)).get()
if item:
self.extract(outpath, item)
outpath = normpath(opts.outpath or config['art_filename'].get())
for item in lib.items(decargs(args)):
if self.extract(outpath, item):
return
extract_cmd.func = extract_func
# Clear command.

View file

@ -22,6 +22,8 @@ Features:
* :doc:`plugins/mbsync`: A new ``-f/--format`` option controls the output
format when listing unrecognized items. The output is also now more helpful
by default. :bug:`1246`
* :doc:`/plugins/fetchart`: Names of extracted image art is taken from the
``art_filename`` configuration option. :bug:`1258`
Fixes:
@ -46,6 +48,8 @@ Fixes:
:bug:`1248`
* :doc:`/plugins/embedart`: We now show a comprehensible error message when
``beet embedart -f FILE`` is given a non-existent path. :bug:`1252`
* Fix a crash when a file has an unrecognized image type tag. Thanks to
Matthias Kiefer. :bug:`1260`
For developers:

View file

@ -80,8 +80,9 @@ embedded album art:
* ``beet extractart [-o FILE] QUERY``: extracts the image from an item matching
the query and stores it in a file. You can specify the destination file using
the ``-o`` option, but leave off the extension: it will be chosen
automatically. The destination filename defaults to ``cover`` if it's not
specified.
automatically. The destination filename is specified using the
``art_filename`` configuration option. It defaults to ``cover`` if it's not
specified via ``-o`` nor the config.
* ``beet clearart QUERY``: removes all embedded images from all items matching
the query. (Use with caution!)

BIN
test/rsrc/image_unknown_type.mp3 Executable file

Binary file not shown.

View file

@ -730,6 +730,10 @@ class MP3Test(ReadWriteTestBase, PartialTestMixin,
'channels': 1,
}
def test_unknown_apic_type(self):
mediafile = self._mediafile_fixture('image_unknown_type')
self.assertEqual(mediafile.images[0].type, ImageType.other)
class MP4Test(ReadWriteTestBase, PartialTestMixin,
ImageStructureTestMixin, unittest.TestCase):