Merge pull request #2193 from jrobeson/replace-varargs_callback-in-duplicates

Use -k for each arg in duplicates plugin
This commit is contained in:
Johnny Robeson 2016-09-10 16:50:29 -04:00 committed by GitHub
commit 55f37bc127
3 changed files with 15 additions and 10 deletions

View file

@ -20,7 +20,7 @@ from __future__ import division, absolute_import, print_function
import shlex
from beets.plugins import BeetsPlugin
from beets.ui import decargs, print_, vararg_callback, Subcommand, UserError
from beets.ui import decargs, print_, Subcommand, UserError
from beets.util import command_output, displayable_path, subprocess
from beets.library import Item, Album
import six
@ -80,10 +80,9 @@ class DuplicatesPlugin(BeetsPlugin):
help=u'report duplicates only if all attributes are set',
)
self._command.parser.add_option(
u'-k', u'--keys', dest='keys',
action='callback', metavar='KEY1 KEY2',
callback=vararg_callback,
help=u'report duplicates based on keys',
u'-k', u'--key',
action='append', metavar='KEY',
help=u'report duplicates based on keys (use multiple times)',
)
self._command.parser.add_option(
u'-M', u'--merge', dest='merge',

View file

@ -18,6 +18,12 @@ to know:
* Please don't package beets as a Python 3 application *yet*, even though some
things may appear to work under Python 3.4 and later.
UI Change:
* :doc:`/plugins/duplicates` no longer accepts multiple arguments in the form
of ``-k title albumartist album``. Each argument must be prefixed with
``-k``. Example: ``-k title -k albumartist -k album``
The are a couple of small new features:
* :doc:`/plugins/mpdupdate`, :doc:`/plugins/mpdstats`: When the ``host`` option

View file

@ -28,7 +28,7 @@ duplicates themselves via command-line switches ::
-d, --delete delete items from library and disk
-F, --full show all versions of duplicate tracks or albums
-s, --strict report duplicates only if all attributes are set
-k, --keys report duplicates based on keys
-k, --key report duplicates based on keys (can be used multiple times)
-M, --merge merge duplicate items
-m DEST, --move=DEST move items to dest
-o DEST, --copy=DEST copy items to dest
@ -46,8 +46,8 @@ file. The available options mirror the command-line options:
- **checksum**: Use an arbitrary command to compute a checksum
of items. This overrides the ``keys`` option the first time it is run;
however, because it caches the resulting checksum as ``flexattrs`` in the
database, you can use ``--keys=name_of_the_checksumming_program
any_other_keys`` (or set configuration ``keys`` option) the second time
database, you can use ``--key=name_of_the_checksumming_program
--key=any_other_keys`` (or set configuration ``keys`` option) the second time
around.
Default: ``ffmpeg -i {file} -f crc -``.
- **copy**: A destination base directory into which to copy matched
@ -120,7 +120,7 @@ The same as the above but include the original album, and show the path::
Get tracks with the same title, artist, and album::
beet duplicates -k title albumartist album
beet duplicates -k title -k albumartist -k album
Compute Adler CRC32 or MD5 checksums, storing them as flexattrs, and report
back duplicates based on those values::
@ -138,7 +138,7 @@ Move likely duplicates to ``trash`` directory::
Delete items (careful!), if they're Nickelback::
beet duplicates --delete --keys albumartist albumartist:nickelback
beet duplicates --delete -k albumartist -k albumartist:nickelback
Tag duplicate items with some flag::