mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
fix #1457: enforce correct config typing
This commit is contained in:
parent
d6348a4da2
commit
834418de6d
1 changed files with 16 additions and 18 deletions
|
|
@ -40,11 +40,11 @@ class DuplicatesPlugin(BeetsPlugin):
|
||||||
'strict': False,
|
'strict': False,
|
||||||
'path': False,
|
'path': False,
|
||||||
'keys': ['mb_trackid', 'mb_albumid'],
|
'keys': ['mb_trackid', 'mb_albumid'],
|
||||||
'checksum': None,
|
'checksum': '',
|
||||||
'copy': False,
|
'copy': '',
|
||||||
'move': False,
|
'move': '',
|
||||||
'delete': False,
|
'delete': False,
|
||||||
'tag': False,
|
'tag': '',
|
||||||
})
|
})
|
||||||
|
|
||||||
self._command = Subcommand('duplicates',
|
self._command = Subcommand('duplicates',
|
||||||
|
|
@ -97,16 +97,18 @@ class DuplicatesPlugin(BeetsPlugin):
|
||||||
|
|
||||||
def _dup(lib, opts, args):
|
def _dup(lib, opts, args):
|
||||||
self.config.set_args(opts)
|
self.config.set_args(opts)
|
||||||
fmt = self.config['format'].get()
|
|
||||||
album = self.config['album'].get(bool)
|
album = self.config['album'].get(bool)
|
||||||
full = self.config['full'].get(bool)
|
checksum = self.config['checksum'].get(str)
|
||||||
strict = self.config['strict'].get(bool)
|
copy = self.config['copy'].get(str)
|
||||||
keys = self.config['keys'].get()
|
count = self.config['count'].get(bool)
|
||||||
checksum = self.config['checksum'].get()
|
|
||||||
copy = self.config['copy'].get()
|
|
||||||
move = self.config['move'].get()
|
|
||||||
delete = self.config['delete'].get(bool)
|
delete = self.config['delete'].get(bool)
|
||||||
tag = self.config['tag'].get()
|
fmt = self.config['format'].get(str)
|
||||||
|
full = self.config['full'].get(bool)
|
||||||
|
keys = self.config['keys'].get(list)
|
||||||
|
move = self.config['move'].get(str)
|
||||||
|
path = self.config['path'].get(bool)
|
||||||
|
strict = self.config['strict'].get(bool)
|
||||||
|
tag = self.config['tag'].get(str)
|
||||||
|
|
||||||
if album:
|
if album:
|
||||||
keys = ['mb_albumid']
|
keys = ['mb_albumid']
|
||||||
|
|
@ -114,11 +116,11 @@ class DuplicatesPlugin(BeetsPlugin):
|
||||||
else:
|
else:
|
||||||
items = lib.items(decargs(args))
|
items = lib.items(decargs(args))
|
||||||
|
|
||||||
if self.config['path']:
|
if path:
|
||||||
fmt = '$path'
|
fmt = '$path'
|
||||||
|
|
||||||
# Default format string for count mode.
|
# Default format string for count mode.
|
||||||
if self.config['count'] and not fmt:
|
if count and not fmt:
|
||||||
if album:
|
if album:
|
||||||
fmt = '$albumartist - $album'
|
fmt = '$albumartist - $album'
|
||||||
else:
|
else:
|
||||||
|
|
@ -126,10 +128,6 @@ class DuplicatesPlugin(BeetsPlugin):
|
||||||
fmt += ': {0}'
|
fmt += ': {0}'
|
||||||
|
|
||||||
if checksum:
|
if checksum:
|
||||||
if not isinstance(checksum, basestring):
|
|
||||||
raise UserError(
|
|
||||||
'duplicates: "checksum" option must be a command'
|
|
||||||
)
|
|
||||||
for i in items:
|
for i in items:
|
||||||
k, _ = self._checksum(i, checksum)
|
k, _ = self._checksum(i, checksum)
|
||||||
keys = [k]
|
keys = [k]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue