Move PROBE_FIELD to module scope (#3318)

This commit is contained in:
Adrian Sampson 2019-06-27 22:43:18 -04:00
parent cca6c49784
commit 0726123e41

View file

@ -32,6 +32,9 @@ from beets import plugins
from beets import util from beets import util
from beets import ui from beets import ui
# We use this field to check whether AcousticBrainz info is present.
PROBE_FIELD = 'mood_acoustic'
class ABSubmitError(Exception): class ABSubmitError(Exception):
"""Raised when failing to analyse file with extractor.""" """Raised when failing to analyse file with extractor."""
@ -61,9 +64,6 @@ class AcousticBrainzSubmitPlugin(plugins.BeetsPlugin):
'pretend': False 'pretend': False
}) })
# Define a field which shows that acousticbrainz info is present
self.PROBE_FIELD = 'mood_acoustic'
self.extractor = self.config['extractor'].as_str() self.extractor = self.config['extractor'].as_str()
if self.extractor: if self.extractor:
self.extractor = util.normpath(self.extractor) self.extractor = util.normpath(self.extractor)
@ -135,7 +135,7 @@ only files which would be processed'
# If file has no mbid skip it. # If file has no mbid skip it.
if not self.opts.force_refetch and not self.config['force']: if not self.opts.force_refetch and not self.config['force']:
mood_str = item.get(self.PROBE_FIELD, u'') mood_str = item.get(PROBE_FIELD, u'')
if mood_str: if mood_str:
return None return None