Ejemplo n.º 1
0
def update(lib=None):
    if database_changed:
        mpd_config = {'host': u'localhost', 'port': 6600, 'password': u''}
        # try to get global mpd config
        if 'mpd' in config.keys():
            for opt in ('host', 'port', 'password'):
                if opt in config['mpd'].keys():
                    mpd_config[opt] = config['mpd'][opt].get()
        # overwrite with plugin specific
        for opt in ('host', 'port', 'password'):
            if config['mpdupdate'][opt].get() is not None:
                mpd_config[opt] = config['mpdupdate'][opt].get()
        update_mpd(mpd_config['host'], mpd_config['port'],
                   mpd_config['password'])
Ejemplo n.º 2
0
    def __init__(self, library):
        self.lib = library
        # defaults
        self.mpd_config = {'host': u'localhost', 'port': 6600, 'password': u''}
        # from global 'mpd' section
        if 'mpd' in config.keys():
            for opt in ('host', 'port', 'password'):
                if opt in config['mpd'].keys():
                    self.mpd_config[opt] = config['mpd'][opt].get()

        # plugin specific / optargs
        for opt in ('host', 'port', 'password'):
            if config['mpdstats'][opt].get() is not None:
                self.mpd_config[opt] = config['mpdstats'][opt].get()

        self.music_directory = config['mpdstats']['music_directory'].get()
        self.do_rating = config['mpdstats']['rating'].get(bool)
        self.rating_mix = config['mpdstats']['rating_mix'].get(float)

        self.client = MPDClient()
Ejemplo n.º 3
0
def update(lib=None):
    if database_changed:
        mpd_config = {
                'host'          :       u'localhost',
                'port'          :       6600,
                'password'      :       u''
        }
        # try to get global mpd config
        if 'mpd' in config.keys():
            for opt in ('host', 'port', 'password'):
                if opt in config['mpd'].keys():
                    mpd_config[opt] = config['mpd'][opt].get()
        # overwrite with plugin specific
        for opt in ('host', 'port', 'password'):
            if config['mpdupdate'][opt].get() is not None:
                mpd_config[opt] = config['mpdupdate'][opt].get()
        update_mpd(
            mpd_config['host'],
            mpd_config['port'],
            mpd_config['password']
        )
Ejemplo n.º 4
0
    def __init__(self, library):
        self.lib = library
        # defaults
        self.mpd_config = {
                'host'          :       u'localhost',
                'port'          :       6600,
                'password'      :       u''
        }
        # from global 'mpd' section
        if 'mpd' in config.keys():
            for opt in ('host', 'port', 'password'):
                if opt in config['mpd'].keys():
                    self.mpd_config[opt] = config['mpd'][opt].get()

        # plugin specific / optargs
        for opt in ('host', 'port', 'password'):
            if config['mpdstats'][opt].get() is not None:
                self.mpd_config[opt] = config['mpdstats'][opt].get()

        self.music_directory = config['mpdstats']['music_directory'].get()
        self.do_rating = config['mpdstats']['rating'].get(bool)
        self.rating_mix = config['mpdstats']['rating_mix'].get(float)

        self.client = MPDClient()