Move configuration check to plugin initalization
This commit is contained in:
@@ -11,6 +11,8 @@ class CleanTagsPlugin(BeetsPlugin):
|
||||
'keep': [], # Tags to write to files.
|
||||
'discard': [] # Tags to discard
|
||||
})
|
||||
if self.keep_tags and self.discard_tags:
|
||||
raise ConfigValueError('Cannot specify both "keep" and "discard" for cleantags plugin.')
|
||||
self.register_listener('write', self.clear_metadata)
|
||||
|
||||
@property
|
||||
@@ -26,8 +28,6 @@ class CleanTagsPlugin(BeetsPlugin):
|
||||
return self.config['discard'].as_str_seq()
|
||||
|
||||
def clear_metadata(self, item, path, tags):
|
||||
if self.keep_tags and self.discard_tags:
|
||||
raise ConfigValueError('Cannot specify both "keep" and "discard" for cleantags plugin.')
|
||||
if self.clean:
|
||||
file = File(path)
|
||||
file.delete()
|
||||
|
||||
Reference in New Issue
Block a user