move metadata management in command function

This commit is contained in:
Fabrice Laporte 2014-10-18 11:04:10 +02:00
parent ac57ef0e67
commit 343972f5d0

View file

@ -114,9 +114,7 @@ def ft_in_title(item, drop_feat, write):
ui.print_(u'no featuring artists found')
ui.print_()
if write:
item.try_write()
item.store()
class FtInTitlePlugin(BeetsPlugin):
def __init__(self):
@ -147,7 +145,10 @@ class FtInTitlePlugin(BeetsPlugin):
write = config['import']['write'].get(bool)
for item in lib.items(ui.decargs(args)):
ft_in_title(item, drop_feat, write)
ft_in_title(item, drop_feat)
item.store()
if write:
item.try_write()
self._command.func = func
return [self._command]
@ -156,7 +157,6 @@ class FtInTitlePlugin(BeetsPlugin):
"""Import hook for moving featuring artist automatically.
"""
drop_feat = self.config['drop'].get(bool)
write = config['import']['write'].get(bool)
for item in task.imported_items():
ft_in_title(item, drop_feat, write)
ft_in_title(item, drop_feat)