def startmb(): mbuser = None mbpass = None if headphones.CONFIG.MIRROR == "musicbrainz.org": mbhost = "musicbrainz.org" mbport = 80 sleepytime = 1 elif headphones.CONFIG.MIRROR == "custom": mbhost = headphones.CONFIG.CUSTOMHOST mbport = int(headphones.CONFIG.CUSTOMPORT) mbuser = headphones.CONFIG.CUSTOMUSER mbpass = headphones.CONFIG.CUSTOMPASS sleepytime = int(headphones.CONFIG.CUSTOMSLEEP) elif headphones.CONFIG.MIRROR == "headphones": mbhost = "144.76.94.239" mbport = 8181 mbuser = headphones.CONFIG.HPUSER mbpass = headphones.CONFIG.HPPASS sleepytime = 0 else: return False musicbrainzngs.set_useragent("headphones", "0.0", "https://github.com/rembo10/headphones") musicbrainzngs.set_hostname(mbhost + ":" + str(mbport)) # Their rate limiting should be redundant to our lock if sleepytime == 0: musicbrainzngs.set_rate_limit(False) else: #calling it with an it ends up blocking all requests after the first musicbrainzngs.set_rate_limit(limit_or_interval=float(sleepytime)) mb_lock.minimum_delta = sleepytime # Add headphones credentials if headphones.CONFIG.MIRROR == "headphones" or headphones.CONFIG.CUSTOMAUTH: if not mbuser or not mbpass: logger.warn("No username or password set for MusicBrainz server") else: musicbrainzngs.hpauth(mbuser, mbpass) # Let us know if we disable custom authentication if not headphones.CONFIG.CUSTOMAUTH and headphones.CONFIG.MIRROR == "custom": musicbrainzngs.disable_hpauth() logger.debug( 'Using the following server values: MBHost: %s, MBPort: %i, Sleep Interval: %i', mbhost, mbport, sleepytime) return True
def startmb(): mbuser = None mbpass = None if headphones.CONFIG.MIRROR == "musicbrainz.org": mbhost = "musicbrainz.org" mbport = 80 sleepytime = 1 elif headphones.CONFIG.MIRROR == "custom": mbhost = headphones.CONFIG.CUSTOMHOST mbport = int(headphones.CONFIG.CUSTOMPORT) mbuser = headphones.CONFIG.CUSTOMUSER mbpass = headphones.CONFIG.CUSTOMPASS sleepytime = int(headphones.CONFIG.CUSTOMSLEEP) elif headphones.CONFIG.MIRROR == "headphones": mbhost = "musicbrainz.codeshy.com" mbport = 80 mbuser = headphones.CONFIG.HPUSER mbpass = headphones.CONFIG.HPPASS sleepytime = 0 else: return False musicbrainzngs.set_useragent("headphones", "0.0", "https://github.com/rembo10/headphones") musicbrainzngs.set_hostname(mbhost + ":" + str(mbport)) # Their rate limiting should be redundant to our lock if sleepytime == 0: musicbrainzngs.set_rate_limit(False) else: # calling it with an it ends up blocking all requests after the first musicbrainzngs.set_rate_limit(limit_or_interval=float(sleepytime)) mb_lock.minimum_delta = sleepytime # Add headphones credentials if headphones.CONFIG.MIRROR == "headphones" or headphones.CONFIG.CUSTOMAUTH: if not mbuser or not mbpass: logger.warn("No username or password set for MusicBrainz server") else: musicbrainzngs.hpauth(mbuser, mbpass) # Let us know if we disable custom authentication if not headphones.CONFIG.CUSTOMAUTH and headphones.CONFIG.MIRROR == "custom": musicbrainzngs.disable_hpauth() logger.debug( "Using the following server values: MBHost: %s, MBPort: %i, Sleep Interval: %i", mbhost, mbport, sleepytime ) return True
def startmb(): mbuser = None mbpass = None if headphones.MIRROR == "musicbrainz.org": mbhost = "musicbrainz.org" mbport = 80 sleepytime = 1 elif headphones.MIRROR == "custom": mbhost = headphones.CUSTOMHOST mbport = int(headphones.CUSTOMPORT) sleepytime = int(headphones.CUSTOMSLEEP) elif headphones.MIRROR == "headphones": mbhost = "144.76.94.239" mbport = 8181 mbuser = headphones.HPUSER mbpass = headphones.HPPASS sleepytime = 0 else: return False musicbrainzngs.set_useragent("headphones", "0.0", "https://github.com/rembo10/headphones") musicbrainzngs.set_hostname(mbhost + ":" + str(mbport)) if sleepytime == 0: musicbrainzngs.set_rate_limit(False) else: #calling it with an it ends up blocking all requests after the first musicbrainzngs.set_rate_limit(limit_or_interval=float(sleepytime)) # Add headphones credentials if headphones.MIRROR == "headphones": if not mbuser and mbpass: logger.warn("No username or password set for VIP server") else: musicbrainzngs.hpauth(mbuser, mbpass) logger.debug( 'Using the following server values: MBHost: %s, MBPort: %i, Sleep Interval: %i', mbhost, mbport, sleepytime) return True
def startmb(): mbuser = None mbpass = None if headphones.MIRROR == "musicbrainz.org": mbhost = "musicbrainz.org" mbport = 80 sleepytime = 1 elif headphones.MIRROR == "custom": mbhost = headphones.CUSTOMHOST mbport = int(headphones.CUSTOMPORT) sleepytime = int(headphones.CUSTOMSLEEP) elif headphones.MIRROR == "headphones": mbhost = "144.76.94.239" mbport = 8181 mbuser = headphones.HPUSER mbpass = headphones.HPPASS sleepytime = 0 else: return False musicbrainzngs.set_useragent("headphones","0.0","https://github.com/rembo10/headphones") musicbrainzngs.set_hostname(mbhost + ":" + str(mbport)) if sleepytime == 0: musicbrainzngs.set_rate_limit(False) else: #calling it with an it ends up blocking all requests after the first musicbrainzngs.set_rate_limit(limit_or_interval=float(sleepytime)) # Add headphones credentials if headphones.MIRROR == "headphones": if not mbuser and mbpass: logger.warn("No username or password set for VIP server") else: musicbrainzngs.hpauth(mbuser,mbpass) logger.debug('Using the following server values: MBHost: %s, MBPort: %i, Sleep Interval: %i', mbhost, mbport, sleepytime) return True