Move configuration check to plugin initalization
This commit is contained in:
@@ -11,6 +11,8 @@ class CleanTagsPlugin(BeetsPlugin):
|
|||||||
'keep': [], # Tags to write to files.
|
'keep': [], # Tags to write to files.
|
||||||
'discard': [] # Tags to discard
|
'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)
|
self.register_listener('write', self.clear_metadata)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -26,8 +28,6 @@ class CleanTagsPlugin(BeetsPlugin):
|
|||||||
return self.config['discard'].as_str_seq()
|
return self.config['discard'].as_str_seq()
|
||||||
|
|
||||||
def clear_metadata(self, item, path, tags):
|
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:
|
if self.clean:
|
||||||
file = File(path)
|
file = File(path)
|
||||||
file.delete()
|
file.delete()
|
||||||
|
|||||||
Reference in New Issue
Block a user