mirror of
				https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
				synced 2025-11-04 05:20:34 +00:00 
			
		
		
		
	updated exception handling
This commit is contained in:
		
							parent
							
								
									0d553243d2
								
							
						
					
					
						commit
						702ec22094
					
				@ -1,5 +1,6 @@
 | 
			
		||||
import os
 | 
			
		||||
import re
 | 
			
		||||
from threading import Thread
 | 
			
		||||
import time
 | 
			
		||||
import uuid
 | 
			
		||||
from typing import Any, Tuple, List
 | 
			
		||||
@ -46,7 +47,7 @@ def get_song_info(song_id) -> Tuple[List[str], List[str], str, str, Any, Any, An
 | 
			
		||||
        genreRetrieved = False
 | 
			
		||||
        for data in info[TRACKS][0][ARTISTS]:
 | 
			
		||||
            artists.append(data[NAME])
 | 
			
		||||
            
 | 
			
		||||
            try:
 | 
			
		||||
                if not genreRetrieved:
 | 
			
		||||
                    # query artist genres via href, which will be the api url
 | 
			
		||||
                    (raw, artistInfo) = ZSpotify.invoke_url(f'{data["href"]}')
 | 
			
		||||
@ -60,6 +61,10 @@ def get_song_info(song_id) -> Tuple[List[str], List[str], str, str, Any, Any, An
 | 
			
		||||
                    else:
 | 
			
		||||
                        genres.append('')
 | 
			
		||||
                        genreRetrieved = True
 | 
			
		||||
            except Exception as genreError:
 | 
			
		||||
                if len(genres) == 0:
 | 
			
		||||
                    genres.append('')
 | 
			
		||||
                    
 | 
			
		||||
        album_name = info[TRACKS][0][ALBUM][NAME]
 | 
			
		||||
        name = info[TRACKS][0][NAME]
 | 
			
		||||
        image_url = info[TRACKS][0][ALBUM][IMAGES][0][URL]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user