mirror of
https://github.com/beetbox/beets.git
synced 2025-12-30 04:22:40 +01:00
introduced print_modify_item as seperate function
preparation to implement interactive selection in modify command
This commit is contained in:
parent
7bdc7d37d3
commit
6b39751337
1 changed files with 16 additions and 7 deletions
|
|
@ -1330,13 +1330,7 @@ def modify_items(lib, mods, dels, query, write, move, album, confirm):
|
|||
.format(len(objs), 'album' if album else 'item'))
|
||||
changed = set()
|
||||
for obj in objs:
|
||||
obj.update(mods)
|
||||
for field in dels:
|
||||
try:
|
||||
del obj[field]
|
||||
except KeyError:
|
||||
pass
|
||||
if ui.show_model_changes(obj):
|
||||
if print_modify_item(obj, mods, dels):
|
||||
changed.add(obj)
|
||||
|
||||
# Still something to do?
|
||||
|
|
@ -1364,6 +1358,21 @@ def modify_items(lib, mods, dels, query, write, move, album, confirm):
|
|||
obj.try_sync(write, move)
|
||||
|
||||
|
||||
def print_modify_item(obj, mods, dels):
|
||||
"""Print the modifications to an item
|
||||
and return False if no changes were made
|
||||
mods: modifications
|
||||
dels: fields to delete
|
||||
"""
|
||||
obj.update(mods)
|
||||
for field in dels:
|
||||
try:
|
||||
del obj[field]
|
||||
except KeyError:
|
||||
pass
|
||||
return ui.show_model_changes(obj)
|
||||
|
||||
|
||||
def modify_parse_args(args):
|
||||
"""Split the arguments for the modify subcommand into query parts,
|
||||
assignments (field=value), and deletions (field!). Returns the result as
|
||||
|
|
|
|||
Loading…
Reference in a new issue