invert new embedart switch (#182)

The default behavior now does what most people probably expect, which is to
run like the on-import handler for the embedart plugin.
This commit is contained in:
Adrian Sampson 2013-03-17 22:50:28 -07:00
parent 0c53c0bc3f
commit f8d6e84581
2 changed files with 15 additions and 15 deletions

View file

@ -70,15 +70,15 @@ class EmbedCoverArtPlugin(BeetsPlugin):
def commands(self):
# Embed command.
embed_cmd = ui.Subcommand('embedart',
help='embed an image file into file metadata')
embed_cmd.parser.add_option('-c', '--current', help='embed the current\
album art into metadata', action='store_true')
help='embed image files into file metadata')
embed_cmd.parser.add_option('-f', '--file', metavar='PATH',
help='the image file to embed')
def embed_func(lib, opts, args):
if opts.current:
embed_current(lib, decargs(args))
else:
imagepath = normpath(args.pop(0))
if opts.file:
imagepath = normpath(opts.file)
embed(lib, imagepath, decargs(args))
else:
embed_current(lib, decargs(args))
embed_cmd.func = embed_func
# Extract command.
@ -100,7 +100,7 @@ class EmbedCoverArtPlugin(BeetsPlugin):
return [embed_cmd, extract_cmd, clear_cmd]
# "embedart" command.
# "embedart" command with --file argument.
def embed(lib, imagepath, query):
albums = lib.albums(query)
for i_album in albums:
@ -115,16 +115,16 @@ def embed(lib, imagepath, query):
_embed(imagepath, album.items(),
config['embedart']['maxwidth'].get(int))
# "embedart" command without explicit file.
def embed_current(lib, query):
albums = lib.albums(query)
for album in albums:
if not album.artpath:
log.info(u'No album art found: {0} - {1}'.
log.info(u'No album art present: {0} - {1}'.
format(album.albumartist, album.album))
continue
log.info('Embedding album art into {0} - {1}'.
log.info(u'Embedding album art into {0} - {1}'.
format(album.albumartist, album.album))
_embed(album.artpath, album.items(),
config['embedart']['maxwidth'].get(int))

View file

@ -25,10 +25,10 @@ Manually Embedding and Extracting Art
The ``embedart`` plugin provides a couple of commands for manually managing
embedded album art:
* ``beet embedart IMAGE QUERY``: given an image file and a query matching an
album, embed the image into the metadata of every track on the album. Using
the ``-c`` or ``--current`` option and a query matching albums, the current
album art is embeded.
* ``beet embedart [-f IMAGE] QUERY``: embed images into the every track on the
albums matching the query. If the ``-f`` (``--file``) option is given, then
use a specific image file from the filesystem; otherwise, each album embeds
its own currently associated 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