def startmb(forcemb=False): mbuser = None mbpass = None # Can use headphones mirror for queries if headphones.MIRROR == "headphones" or "custom": forcemb = False if forcemb or 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 = "178.63.142.150" mbport = 8181 mbuser = headphones.HPUSER mbpass = headphones.HPPASS sleepytime = 0 else: mbhost = "tbueter.com" mbport = 5000 sleepytime = 0 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: musicbrainzngs.set_rate_limit(True) # 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) # Don't really need to return q anymore since ngs, but maybe we can return an 'initialized=True' instead? q = musicbrainzngs logger.debug( 'Using the following server values:\nMBHost: %s ; MBPort: %i ; Sleep Interval: %i ' % (mbhost, mbport, sleepytime)) return (q, sleepytime)
def startmb(forcemb=False): mbuser = None mbpass = None # Can use headphones mirror for queries if headphones.MIRROR == "headphones" or "custom": forcemb=False if forcemb or 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 = "178.63.142.150" mbport = 8181 mbuser = headphones.HPUSER mbpass = headphones.HPPASS sleepytime = 0 else: mbhost = "tbueter.com" mbport = 5000 sleepytime = 0 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: musicbrainzngs.set_rate_limit(True) # 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) # Don't really need to return q anymore since ngs, but maybe we can return an 'initialized=True' instead? q = musicbrainzngs logger.debug('Using the following server values:\nMBHost: %s ; MBPort: %i ; Sleep Interval: %i ' % (mbhost, mbport, sleepytime)) return (q, sleepytime)
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 = "178.63.142.150" 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:\nMBHost: %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 = "176.58.107.206" 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:\nMBHost: %s ; MBPort: %i ; Sleep Interval: %i " % (mbhost, mbport, sleepytime) ) return True
# the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. """Searches for albums in the MusicBrainz database. """ import logging import lib.musicbrainzngs as musicbrainzngs import lib.beets.autotag.hooks import lib.beets SEARCH_LIMIT = 5 VARIOUS_ARTISTS_ID = '89ad4ac3-39f7-470e-963a-56509c546377' musicbrainzngs.set_useragent('beets', lib.beets.__version__, 'http://beets.radbox.org/') class ServerBusyError(Exception): pass class BadResponseError(Exception): pass log = logging.getLogger('beets') RELEASE_INCLUDES = [ 'artists', 'media', 'recordings', 'release-groups', 'labels', 'artist-credits'
# # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. """Searches for albums in the MusicBrainz database. """ import logging import lib.musicbrainzngs as musicbrainzngs import lib.beets.autotag.hooks import lib.beets SEARCH_LIMIT = 5 VARIOUS_ARTISTS_ID = '89ad4ac3-39f7-470e-963a-56509c546377' musicbrainzngs.set_useragent('beets', lib.beets.__version__, 'http://beets.radbox.org/') class ServerBusyError(Exception): pass class BadResponseError(Exception): pass log = logging.getLogger('beets') RELEASE_INCLUDES = ['artists', 'media', 'recordings', 'release-groups', 'labels', 'artist-credits'] TRACK_INCLUDES = ['artists'] # python-musicbrainz-ngs search functions: tolerate different API versions. if hasattr(musicbrainzngs, 'release_search'): # Old API names. _mb_release_search = musicbrainzngs.release_search _mb_recording_search = musicbrainzngs.recording_search