Commit d8a91ab0 authored by Gink's avatar Gink

Increased accuracy of exthook when searching

> Changes Ed Sheeran's album named multiply from × to x, which fixed album art finding
  for this title.
parent 1097ceec
This diff is collapsed.
# -*- coding: utf-8 -*-
import pprint
import musicbrainzngs
from musicbrainzngs import ResponseError
pp = pprint.PrettyPrinter(indent=4)
def init():
musicbrainzngs.set_useragent("mymusiclist","0.1", contact="none")
musicbrainzngs.set_rate_limit(limit_or_interval=False, new_requests=1)
print("Exthook init called.")
print("[Exthook] Initialized")
def getAlbumArtByName(name, artistname):
results = musicbrainzngs.search_release_groups(name, artist=artistname)
def getAlbumArtByName(name, artist):
debug("GET " + name + " " + artist)
results = musicbrainzngs.search_release_groups(name, limit = 3, artistname=artist, primarytype="album")
#pp.pprint(results['release-group-list'])
results = results['release-group-list']
resultid = results[0]['id']
print("[Exthook] ID = " + resultid)
debug("ID = " + resultid)
try:
imagelist = musicbrainzngs.get_release_group_image_list(resultid)
except ResponseError:
debug("No image found.")
return "NaN"
return imagelist['images'][0]['thumbnails']['large']
def debug(string):
print("[Exthook] " + string)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment