mirror of https://github.com/afkcodes/zspotify.git
removed exception handling from track
This commit is contained in:
parent
702ec22094
commit
16c7ee5d51
|
@ -44,27 +44,20 @@ def get_song_info(song_id) -> Tuple[List[str], List[str], str, str, Any, Any, An
|
||||||
try:
|
try:
|
||||||
artists = []
|
artists = []
|
||||||
genres = []
|
genres = []
|
||||||
genreRetrieved = False
|
|
||||||
for data in info[TRACKS][0][ARTISTS]:
|
for data in info[TRACKS][0][ARTISTS]:
|
||||||
artists.append(data[NAME])
|
artists.append(data[NAME])
|
||||||
try:
|
# query artist genres via href, which will be the api url
|
||||||
if not genreRetrieved:
|
(raw, artistInfo) = ZSpotify.invoke_url(f'{data["href"]}')
|
||||||
# query artist genres via href, which will be the api url
|
if ZSpotify.CONFIG.get_allGenres() and len(artistInfo[GENRES]) > 0:
|
||||||
(raw, artistInfo) = ZSpotify.invoke_url(f'{data["href"]}')
|
for genre in artistInfo[GENRES]:
|
||||||
if ZSpotify.CONFIG.get_allGenres() and len(artistInfo[GENRES]) > 0:
|
genres.append(genre)
|
||||||
genreRetrieved = False
|
elif len(artistInfo[GENRES]) > 0:
|
||||||
for genre in artistInfo[GENRES]:
|
genres.append(artistInfo[GENRES][0])
|
||||||
genres.append(genre)
|
|
||||||
elif len(artistInfo[GENRES]) > 0:
|
if len(genres) == 0:
|
||||||
genres.append(artistInfo[GENRES][0])
|
Printer.print(PrintChannel.SKIPS, "No Genre found.")
|
||||||
genreRetrieved = True
|
genres.append('')
|
||||||
else:
|
|
||||||
genres.append('')
|
|
||||||
genreRetrieved = True
|
|
||||||
except Exception as genreError:
|
|
||||||
if len(genres) == 0:
|
|
||||||
genres.append('')
|
|
||||||
|
|
||||||
album_name = info[TRACKS][0][ALBUM][NAME]
|
album_name = info[TRACKS][0][ALBUM][NAME]
|
||||||
name = info[TRACKS][0][NAME]
|
name = info[TRACKS][0][NAME]
|
||||||
image_url = info[TRACKS][0][ALBUM][IMAGES][0][URL]
|
image_url = info[TRACKS][0][ALBUM][IMAGES][0][URL]
|
||||||
|
|
Loading…
Reference in New Issue