-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Add a secondary source for covert art images in order to increase coverage. Currently there is no cover art image for a fair number of library disks. The coverage could be increased by adding a secondary lookup against another source such as YouTube or MusicBrainz in cases where there is no Discogs image. Example code for doing this using the YouTube API is as follows:
Python example of album cover lookup using the YTMusic libraray
def findCoverArtUrl(artist, title):
yt = YTMusic()
search_key = '"' + artist + '" "' + title + '"'
search_results = yt.search(search_key, "albums")
print("YouTube search for -{}- found {} items".format(search_key, len(search_results)))
titleLC = title.lower().strip()
artistLC = artist.lower().strip()
singleResult = len(search_results) == 1 # assume perfect match if only 1 result
for item in search_results:
itemTitleLC = item['title'].lower().strip()
itemArtistLC = item['artists'][0]['name'].lower().strip()
if singleResult or (itemTitleLC == titleLC and artistLC == itemArtistLC):
thumbnails = item['thumbnails']
if len(thumbnails) >= 3:
return item['thumbnails'][2]['url']
else:
print("No thumbnail")
return None
Metadata
Metadata
Assignees
Labels
No labels