mirror of
https://github.com/beetbox/beets.git
synced 2025-12-16 05:34:47 +01:00
Added an option to extract the art file of all matched albums. Closes #1261
This commit is contained in:
parent
54432d1698
commit
b1bf7f3e68
2 changed files with 23 additions and 3 deletions
|
|
@ -86,12 +86,26 @@ class EmbedCoverArtPlugin(BeetsPlugin):
|
|||
help='extract an image from file metadata')
|
||||
extract_cmd.parser.add_option('-o', dest='outpath',
|
||||
help='image output file')
|
||||
extract_cmd.parser.add_option('-a', dest='albums', action='store_true',
|
||||
help='extract the art of all matching albums')
|
||||
|
||||
def extract_func(lib, opts, args):
|
||||
outpath = normpath(opts.outpath or config['art_filename'].get())
|
||||
for item in lib.items(decargs(args)):
|
||||
if self.extract(outpath, item):
|
||||
if opts.albums:
|
||||
if opts.outpath and os.path.sep in normpath(opts.outpath):
|
||||
self._log.error(u"When using -a, only specify a filename instead"
|
||||
u" of a full path for -o")
|
||||
return
|
||||
for album in lib.albums(decargs(args)):
|
||||
outpath = normpath(os.path.join(album.path, opts.outpath
|
||||
or config['art_filename'].get()))
|
||||
for item in album.items():
|
||||
if self.extract(outpath, item):
|
||||
return
|
||||
else:
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -84,5 +84,11 @@ embedded album art:
|
|||
``art_filename`` configuration option. It defaults to ``cover`` if it's not
|
||||
specified via ``-o`` nor the config.
|
||||
|
||||
* ``beet extractart -a [-o FILE] QUERY``: extracts the images for all albums
|
||||
matching the query. The images are placed inside the album folder. The
|
||||
destination filename is taken either from the ``-o`` option or the
|
||||
``art_filename`` configuration option. It defaults to ``cover`` if it's not
|
||||
specified.
|
||||
|
||||
* ``beet clearart QUERY``: removes all embedded images from all items matching
|
||||
the query. (Use with caution!)
|
||||
|
|
|
|||
Loading…
Reference in a new issue