This commit is contained in:
2025-02-15 21:09:33 -05:00
parent 60416c493f
commit 39d1ddaffa
22 changed files with 509 additions and 525 deletions

View File

@@ -20,7 +20,7 @@ class LastFM:
async def search_artist(self, artist: Optional[str] = None) -> dict:
"""Search LastFM for an artist"""
try:
if artist is None:
if not artist:
return {
'err': 'No artist specified.',
}
@@ -91,8 +91,7 @@ class LastFM:
dict
"""
try:
if artist is None or album is None:
logging.info("inv request")
if not artist or not album:
return {
'err': 'No artist or album specified',
}
@@ -111,16 +110,16 @@ class LastFM:
'err': 'General Failure',
}
async def get_artist_albums(self, artist: Optional[str] = None) -> dict|list[dict]:
async def get_artist_albums(self, artist: Optional[str] = None) -> Union[dict, list[dict]]:
"""
Get Artists Albums from LastFM
Args:
artist (Optional[str])
Returns:
dict|list[dict]
Union[dict, list[dict]]
"""
try:
if artist is None:
if not artist:
return {
'err': 'No artist specified.',
}
@@ -149,10 +148,10 @@ class LastFM:
Args:
artist (Optional[str])
Returns:
int|dict
int
"""
try:
if artist is None:
if not artist:
return -1
artist_search: dict = await self.search_artist(artist=artist)
if not artist_search: