From f8d6e845819ff7367915a20c94e69bcf67c2d8da Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 17 Mar 2013 22:50:28 -0700 Subject: [PATCH] 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. --- beetsplug/embedart.py | 22 +++++++++++----------- docs/plugins/embedart.rst | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/beetsplug/embedart.py b/beetsplug/embedart.py index a38daa0e7..22bb5364a 100644 --- a/beetsplug/embedart.py +++ b/beetsplug/embedart.py @@ -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)) diff --git a/docs/plugins/embedart.rst b/docs/plugins/embedart.rst index b4dafcf3c..1200071cf 100644 --- a/docs/plugins/embedart.rst +++ b/docs/plugins/embedart.rst @@ -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