1. Adrian Sampson
  2. beets

Commits

Adrian Sampson  committed fe26efb

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.

  • Participants
  • Parent commits fbf8dd0
  • Branches default

Comments (0)

Files changed (2)

File beetsplug/embedart.py

View file
     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:
+            if opts.file:
+                imagepath = normpath(opts.file)
+                embed(lib, imagepath, decargs(args))
+            else:
                 embed_current(lib, decargs(args))
-            else:
-                imagepath = normpath(args.pop(0))
-                embed(lib, imagepath, decargs(args))
         embed_cmd.func = embed_func
 
         # Extract command.
 
         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:
     _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))

File docs/plugins/embedart.rst

View file
 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