1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 22:27:28 +00:00

Add back e621 preference, refactor artist logic

This commit is contained in:
Myned 2019-09-24 22:21:10 -04:00
parent 98eb5e2cc0
commit cd27cadb52
No known key found for this signature in database
GPG key ID: BC58C09870A63E59

View file

@ -81,19 +81,30 @@ async def query_saucenao(url):
similarity = int(float(match['header']['similarity'])) similarity = int(float(match['header']['similarity']))
if similarity < 55: if similarity < 55:
return False return False
artist = 'member_name'
elif 'creator' in match['data']: source = match['data']['ext_urls'][0]
artist = 'creator' for e in match['data']['ext_urls']:
else: if 'e621' in e:
artist = 'imdb_id' source = e
break
artist = 'Unknown'
for e in (
'author_name',
'member_name',
'creator'
):
if e in match['data']:
artist = match['data'][e]
break
result = { result = {
'source': match['data']['ext_urls'][0], 'source': source,
'artist': match['data'][artist], 'artist': artist,
'thumbnail': match['header']['thumbnail'], 'thumbnail': match['header']['thumbnail'],
'similarity': str(similarity), 'similarity': str(similarity),
'database': 'SauceNAO' 'database': 'SauceNAO'
} }
return result return result