changes include: allow GET endpoints, redirect to codey.lol instead of returning status 422, clean junk from ai endpoint, add misc endpoint, add methods to lyric_search_new.sources.cache, other misc/cleanup

This commit is contained in:
2025-01-21 19:16:23 -05:00
parent e95ef3b088
commit 38dbddd297
7 changed files with 148 additions and 23 deletions

View File

@@ -110,16 +110,13 @@ class LastFM:
async with session.get(f"{self.api_base_url}artist.gettopalbums&artist={artist}&api_key={self.creds.get('key')}&autocorrect=1&format=json",
timeout=ClientTimeout(connect=3, sock_read=8)) as request:
assert request.status in [200, 204]
# return request.text
data = await request.json()
data = data.get('topalbums').get('album')
# print(f"Data:\n{data}")
retObj = [
{
'title': item.get('name')
} for item in data if not(item.get('name').lower() == "(null)") and int(item.get('playcount')) >= 50
]
# # print(f"Keys: {data[0].keys()}")
return retObj
except:
traceback.print_exc()