From: kaliko Date: Tue, 9 Dec 2014 10:37:25 +0000 (+0100) Subject: New option to disable use of mbid X-Git-Tag: 0.13.0~20 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=70bf86ca3f65a550436cdc70326cb8601f24e5a6;p=mpd-sima.git New option to disable use of mbid --- diff --git a/data/man/info.xml b/data/man/info.xml index 5422b9e..50abd24 100644 --- a/data/man/info.xml +++ b/data/man/info.xml @@ -5,7 +5,7 @@ - + diff --git a/data/man/mpd-sima.1 b/data/man/mpd-sima.1 index fbbf6f5..6bd8ac2 100644 --- a/data/man/mpd-sima.1 +++ b/data/man/mpd-sima.1 @@ -2,12 +2,12 @@ .\" Title: mpd-sima .\" Author: Jack Kaliko .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 11/24/2014 -.\" Manual: mpd-sima 0.12.3 User Manual +.\" Date: 12/08/2014 +.\" Manual: mpd-sima 0.13.0 User Manual .\" Source: mpd-sima .\" Language: English .\" -.TH "MPD\-SIMA" "1" "11/24/2014" "mpd-sima" "mpd-sima 0.12.3 User Manual" +.TH "MPD\-SIMA" "1" "12/08/2014" "mpd-sima" "mpd-sima 0.13.0 User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/data/man/mpd_sima.cfg.5 b/data/man/mpd_sima.cfg.5 index 154a2ad..46c73f0 100644 --- a/data/man/mpd_sima.cfg.5 +++ b/data/man/mpd_sima.cfg.5 @@ -2,12 +2,12 @@ .\" Title: mpd_sima.cfg .\" Author: Jack Kaliko .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 11/24/2014 -.\" Manual: mpd-sima 0.12.3 User Manual +.\" Date: 12/09/2014 +.\" Manual: mpd-sima 0.13.0 User Manual .\" Source: mpd-sima .\" Language: English .\" -.TH "MPD_SIMA\&.CFG" "5" "11/24/2014" "mpd-sima" "mpd-sima 0.12.3 User Manual" +.TH "MPD_SIMA\&.CFG" "5" "12/09/2014" "mpd-sima" "mpd-sima 0.13.0 User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -162,6 +162,18 @@ How far to look back in history to avoid to play twice the same track/title (dur This value triggers queue process if the queue length is less than specified queue_length\&. .RE .PP +\fBmusicbrainzid=\fR\fItrue\fR +.RS 4 +Use MusicBrainzIdentifier to search music (mainly for artists)\&. Consider using these metadata as it enhances a lot artist/album/tracks identification\&. +.br + +Default is True, switch to False if you don\*(Aqt have MusicBrainzIdentifier set for at least 80% of you music library\&. +.br + +Use Picard to tag your file: +\m[blue]\fB\%https://picard.musicbrainz.org/\fR\m[]\&. +.RE +.PP \fBuser_db=\fR\fIfalse\fR .RS 4 Temporarily removed feature diff --git a/data/man/mpd_sima.cfg.5.xml b/data/man/mpd_sima.cfg.5.xml index 9ef63de..309beff 100644 --- a/data/man/mpd_sima.cfg.5.xml +++ b/data/man/mpd_sima.cfg.5.xml @@ -201,6 +201,19 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ queue_length. + + true + + Use MusicBrainzIdentifier to search music (mainly + for artists). Consider using these metadata as it + enhances a lot artist/album/tracks identification. + Default is True, switch to False if you don't have + MusicBrainzIdentifier set for at least 80% of you + music library. + Use Picard to tag your file: . + + + false diff --git a/data/man/simadb_cli.1 b/data/man/simadb_cli.1 index a45ab0d..f39167e 100644 --- a/data/man/simadb_cli.1 +++ b/data/man/simadb_cli.1 @@ -2,12 +2,12 @@ .\" Title: simadb_cli .\" Author: Jack Kaliko .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 11/24/2014 -.\" Manual: mpd-sima 0.12.3 User Manual +.\" Date: 12/08/2014 +.\" Manual: mpd-sima 0.13.0 User Manual .\" Source: mpd-sima .\" Language: English .\" -.TH "SIMADB_CLI" "1" "11/24/2014" "mpd-sima" "mpd-sima 0.12.3 User Manual" +.TH "SIMADB_CLI" "1" "12/08/2014" "mpd-sima" "mpd-sima 0.13.0 User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/Changelog b/doc/Changelog index 249e1e3..67b2cb2 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,7 @@ MPD_sima v0.13.0 - * + * Use of MusicBrainzIdentifier by default + Please consider tagging your library with these metadata -- kaliko jack UNRELEASED diff --git a/doc/examples/all_settings.cfg b/doc/examples/all_settings.cfg index 46a6184..01c9100 100644 --- a/doc/examples/all_settings.cfg +++ b/doc/examples/all_settings.cfg @@ -101,6 +101,12 @@ user_db = false # description: Queue length triggering tracks addition queue_length = 1 +## MUSICBRAINZID +# type: boolean +# default: True +# description: Use of MusicBrainzIdentifier tag +musicbrainzid = True + ######################### PLUGINS ##################################### [crop] diff --git a/sima/client.py b/sima/client.py index d127442..0bfc882 100644 --- a/sima/client.py +++ b/sima/client.py @@ -317,6 +317,16 @@ class PlayerClient(Player): raise PlayerError('Could connect to "%s", ' 'but command "%s" not available' % (host, nddcmd)) + + # Controls use of MusicBrainzIdentifier + if Artist.use_mbid: + if 'MUSICBRAINZ_ARTISTID' not in self._client.tagtypes(): + self.log.warning('Use of MusicBrainzIdentifier is set but MPD is ' + 'not providing related metadata') + self.log.info(self._client.tagtypes()) + else: + self.log.warning('Use of MusicBrainzIdentifier disabled!') + self.log.info('Consider using MusicBrainzIdentifier for your music library') self._flush_cache() def disconnect(self): diff --git a/sima/launch.py b/sima/launch.py index 03baa4f..1ff6c94 100644 --- a/sima/launch.py +++ b/sima/launch.py @@ -34,6 +34,7 @@ from os.path import isfile # 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 @@ -114,6 +115,11 @@ def start(sopt, restart=False): # Loading contrib plugins load_plugins(sima, 'contrib') + # Set use of MusicBrainzIdentifier + if not config.getboolean('sima', 'musicbrainzid'): + logger.info('Disabling MusicBrainzIdentifier') + Meta.use_mbid = False + # Run as a daemon if config.getboolean('daemon', 'daemon'): if restart: diff --git a/sima/lib/meta.py b/sima/lib/meta.py index 32bb883..2d78f2f 100644 --- a/sima/lib/meta.py +++ b/sima/lib/meta.py @@ -38,11 +38,22 @@ class MetaException(Exception): class WrongUUID4(MetaException): pass +def mbidfilter(func): + def wrapper(*args, **kwargs): + cls = args[0] + if not cls.use_mbid: + kwargs.pop('mbid', None) + kwargs.pop('musicbrainz_artistid', None) + kwargs.pop('musicbrainz_albumartistid', None) + func(*args, **kwargs) + return wrapper + class Meta: """Generic Class for Meta object Meta(name=[, mbid=UUID4]) """ + use_mbid = True def __init__(self, **kwargs): self.__name = None #TODO: should be immutable @@ -117,6 +128,7 @@ class Album(Meta): class Artist(Meta): + @mbidfilter def __init__(self, name=None, mbid=None, **kwargs): """Artist object built from a mapping dict containing at least an "artist" entry: diff --git a/sima/lib/webserv.py b/sima/lib/webserv.py index 36b364f..7609da7 100644 --- a/sima/lib/webserv.py +++ b/sima/lib/webserv.py @@ -226,6 +226,7 @@ class WebService(Plugin): return [] tolookfor = self.player.playlist[-1].Artist self.log.info('Looking for artist similar to "{}"'.format(tolookfor)) + self.log.debug(repr(tolookfor)) similar = self.ws_similar_artists(tolookfor) if not similar: self.log.info('Got nothing from {0}!'.format(self.ws.name)) diff --git a/sima/utils/config.py b/sima/utils/config.py index 786208a..3cd3371 100644 --- a/sima/utils/config.py +++ b/sima/utils/config.py @@ -52,6 +52,7 @@ DEFAULT_CONF = { 'history_duration': 8, 'queue_length': 1, 'var_dir': 'empty', + 'musicbrainzid': "true", }, 'daemon':{ 'daemon': False,