mirror of
https://github.com/beetbox/beets.git
synced 2025-12-16 05:34:47 +01:00
compile modify templates only once
This commit is contained in:
parent
a2030d1a63
commit
795bc2efc1
1 changed files with 4 additions and 3 deletions
|
|
@ -33,7 +33,7 @@ from beets import plugins
|
|||
from beets import importer
|
||||
from beets import util
|
||||
from beets.util import syspath, normpath, ancestry, displayable_path, \
|
||||
MoveOperation
|
||||
MoveOperation, functemplate
|
||||
from beets import library
|
||||
from beets import config
|
||||
from beets import logging
|
||||
|
|
@ -1420,9 +1420,10 @@ def modify_items(lib, mods, dels, query, write, move, album, confirm):
|
|||
print_('Modifying {} {}s.'
|
||||
.format(len(objs), 'album' if album else 'item'))
|
||||
changed = []
|
||||
templates = {key: functemplate.template(value) for key, value in mods.items()}
|
||||
for obj in objs:
|
||||
obj_mods = {key: model_cls._parse(key, format(obj, value))
|
||||
for key, value in mods.items()}
|
||||
obj_mods = {key: model_cls._parse(key, obj.evaluate_template(templates[key]))
|
||||
for key in mods.keys()}
|
||||
if print_and_modify(obj, obj_mods, dels) and obj not in changed:
|
||||
changed.append(obj)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue