def findSeries(name, limit=1): serieslist = [] seriesResults = None criteria = {"series": name.lower()} with mb_lock: try: seriesResults = musicbrainzngs.search_series(limit=limit, **criteria)["series-list"] except musicbrainzngs.WebServiceError as e: logger.warn("Attempt to query MusicBrainz for %s failed (%s)" % (name, str(e))) mb_lock.snooze(5) if not seriesResults: return False for result in seriesResults: if "disambiguation" in result: uniquename = unicode(result["name"] + " (" + result["disambiguation"] + ")") else: uniquename = unicode(result["name"]) serieslist.append( { "uniquename": uniquename, "name": unicode(result["name"]), "type": unicode(result["type"]), "id": unicode(result["id"]), "url": unicode("http://musicbrainz.org/series/" + result["id"]), # probably needs to be changed "score": int(result["ext:score"]), } ) return serieslist
def findSeries(name, limit=1): serieslist = [] seriesResults = None chars = set('!?*-') if any((c in chars) for c in name): name = '"' + name + '"' criteria = {'series': name.lower()} with mb_lock: try: seriesResults = musicbrainzngs.search_series(limit=limit, **criteria)['series-list'] except musicbrainzngs.WebServiceError as e: logger.warn('Attempt to query MusicBrainz for %s failed (%s)' % (name, str(e))) mb_lock.snooze(5) if not seriesResults: return False for result in seriesResults: if 'disambiguation' in result: uniquename = unicode(result['name'] + " (" + result['disambiguation'] + ")") else: uniquename = unicode(result['name']) serieslist.append({ 'uniquename': uniquename, 'name': unicode(result['name']), 'type': unicode(result['type']), 'id': unicode(result['id']), 'url': unicode("http://musicbrainz.org/series/" + result['id']),#probably needs to be changed 'score': int(result['ext:score']) }) return serieslist
def findSeries(name, limit=1): serieslist = [] seriesResults = None criteria = {'series': name.lower()} with mb_lock: try: seriesResults = musicbrainzngs.search_series(limit=limit, **criteria)['series-list'] except musicbrainzngs.WebServiceError as e: logger.warn('Attempt to query MusicBrainz for %s failed (%s)' % (name, str(e))) mb_lock.snooze(5) if not seriesResults: return False for result in seriesResults: if 'disambiguation' in result: uniquename = unicode(result['name'] + " (" + result['disambiguation'] + ")") else: uniquename = unicode(result['name']) serieslist.append({ 'uniquename': uniquename, 'name': unicode(result['name']), 'type': unicode(result['type']), 'id': unicode(result['id']), 'url': unicode("http://musicbrainz.org/series/" + result['id']), # probably needs to be changed 'score': int(result['ext:score']) }) return serieslist