mirror of
				https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
				synced 2025-10-29 18:51:31 +00:00 
			
		
		
		
	Added download_artist_albums
Added a function to be called in client if artist_id_str is not None; download_artist_albums(artist_id_str) that uses the get_artist_album function to get the artist's album id's and then downloads each one with the download_album function. Also modified get_artist_album function to return a list of album ids instead of a list of tuples of album ids and names.
This commit is contained in:
		
							parent
							
								
									92090512d0
								
							
						
					
					
						commit
						126ebe2046
					
				
							
								
								
									
										10
									
								
								zspotify.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								zspotify.py
									
									
									
									
									
								
							| @ -127,6 +127,8 @@ def client(): | |||||||
| 
 | 
 | ||||||
|             if track_id_str is not None: |             if track_id_str is not None: | ||||||
|                 download_track(track_id_str) |                 download_track(track_id_str) | ||||||
|  |             elif artist_id_str is not None: | ||||||
|  |                 download_artist_albums(artist_id_str) | ||||||
|             elif album_id_str is not None: |             elif album_id_str is not None: | ||||||
|                 download_album(album_id_str) |                 download_album(album_id_str) | ||||||
|             elif playlist_id_str is not None: |             elif playlist_id_str is not None: | ||||||
| @ -146,6 +148,8 @@ def client(): | |||||||
| 
 | 
 | ||||||
|         if track_id_str is not None: |         if track_id_str is not None: | ||||||
|             download_track(track_id_str) |             download_track(track_id_str) | ||||||
|  |         elif artist_id_str is not None: | ||||||
|  |             download_artist_albums(artist_id_str) | ||||||
|         elif album_id_str is not None: |         elif album_id_str is not None: | ||||||
|             download_album(album_id_str) |             download_album(album_id_str) | ||||||
|         elif playlist_id_str is not None: |         elif playlist_id_str is not None: | ||||||
| @ -604,6 +608,12 @@ def download_album(album): | |||||||
|         download_track(track['id'], artist + " - " + album_name + "/") |         download_track(track['id'], artist + " - " + album_name + "/") | ||||||
|         print("\n") |         print("\n") | ||||||
| 
 | 
 | ||||||
|  | def download_artist_albums(artist): | ||||||
|  |     """ Downloads albums of an artist """ | ||||||
|  |     token = SESSION.tokens().get("user-read-email") | ||||||
|  |     albums = get_artist_albums(token, artist) | ||||||
|  |     for name, album_id in albums: | ||||||
|  |         download_album(album_id) | ||||||
| 
 | 
 | ||||||
| def download_from_user_playlist(): | def download_from_user_playlist(): | ||||||
|     """ Downloads songs from users playlist """ |     """ Downloads songs from users playlist """ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 yiannisha
						yiannisha