# local import
from . import core, info
from .lib.logger import set_logger
-from .lib.meta import Meta
from .lib.simadb import SimaDB
from .utils.config import ConfMan
from .utils.startopt import StartOpt
# Loading contrib plugins
load_plugins(sima, 'contrib')
- logger.info('plugins loaded, prioriy: {}'.format(' > '.join(map(str, sima.plugins))))
- # Set use of MusicBrainzIdentifier
- if not config.getboolean('sima', 'musicbrainzid'):
- logger.info('Disabling MusicBrainzIdentifier')
- Meta.use_mbid = False
+ logger.info('plugins loaded, prioriy: %s', ' > '.join(map(str, sima.plugins)))
# Run as a daemon
if config.getboolean('daemon', 'daemon'):
# local import
-from .lib.meta import Artist, Album
+from .lib.meta import Meta, Artist, Album
from .lib.track import Track
from .lib.simastr import SimaStr
from .utils.leven import levenshtein_ratio
"""
needed_cmds = ['status', 'stats', 'add', 'find',
'search', 'currentsong', 'ping']
+ needed_mbid_tags = {'Artist', 'Album', 'AlbumArtist',
+ 'Title', 'Track', 'Genre',
+ 'MUSICBRAINZ_ARTISTID', 'MUSICBRAINZ_ALBUMID',
+ 'MUSICBRAINZ_ALBUMARTISTID', 'MUSICBRAINZ_TRACKID'}
database = None
def __init__(self, daemon):
'but command "%s" not available' %
(host, cmd))
# Controls use of MusicBrainzIdentifier
- # TODO: Use config instead of Artist object attibute?
- if self.use_mbid:
- tt = self.tagtypes()
- if 'MUSICBRAINZ_ARTISTID' not in tt:
- self.log.warning('Use of MusicBrainzIdentifier is set but MPD is '
- 'not providing related metadata')
+ self.tagtypes('clear')
+ for tag in MPD.needed_mbid_tags:
+ self.tagtypes('enable', tag)
+ if self.daemon.config.get('sima', 'musicbrainzid'):
+ tt = set(self.tagtypes())
+ if len(MPD.needed_mbid_tags & tt) != len(MPD.needed_mbid_tags):
+ self.log.warning('Use of MusicBrainzIdentifier is set but MPD '
+ 'is not providing related metadata')
self.log.info(tt)
self.log.warning('Disabling MusicBrainzIdentifier')
- self.use_mbid = False
+ self.use_mbid = Meta.use_mbid = False
else:
- self.log.debug('Available metadata: %s', tt) # pylint: disable=no-member
+ self.log.debug('Available metadata: %s', tt)
+ self.use_mbid = Meta.use_mbid = True
else:
self.log.warning('Use of MusicBrainzIdentifier disabled!')
self.log.info('Consider using MusicBrainzIdentifier for your music library')
+ self.use_mbid = Meta.use_mbid = False
self._reset_cache()
# ######### / Overriding MPDClient #########