mirror of
				https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
				synced 2025-11-04 05:20:34 +00:00 
			
		
		
		
	Skip songs with id==None (eg locally added song)
This commit is contained in:
		
							parent
							
								
									c40d89b458
								
							
						
					
					
						commit
						daad5e00d8
					
				@ -49,7 +49,7 @@ def client(args) -> None:
 | 
				
			|||||||
    if args.liked_songs:
 | 
					    if args.liked_songs:
 | 
				
			||||||
        for song in get_saved_tracks():
 | 
					        for song in get_saved_tracks():
 | 
				
			||||||
            if not song[TRACK][NAME]:
 | 
					            if not song[TRACK][NAME]:
 | 
				
			||||||
                Printer.print(PrintChannel.ERRORS, '###   SKIPPING:  SONG DOES NOT EXIST ON SPOTIFY ANYMORE   ###' + "\n")
 | 
					                Printer.print(PrintChannel.SKIPS, '###   SKIPPING:  SONG DOES NOT EXIST ON SPOTIFY ANYMORE   ###' + "\n")
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                download_track('liked', song[TRACK][ID])
 | 
					                download_track('liked', song[TRACK][ID])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -83,6 +83,9 @@ def download_from_urls(urls: list[str]) -> bool:
 | 
				
			|||||||
            playlist_songs = get_playlist_songs(playlist_id)
 | 
					            playlist_songs = get_playlist_songs(playlist_id)
 | 
				
			||||||
            name, _ = get_playlist_info(playlist_id)
 | 
					            name, _ = get_playlist_info(playlist_id)
 | 
				
			||||||
            for song in playlist_songs:
 | 
					            for song in playlist_songs:
 | 
				
			||||||
 | 
					                if not song[TRACK][NAME]:
 | 
				
			||||||
 | 
					                    Printer.print(PrintChannel.SKIPS, '###   SKIPPING:  SONG DOES NOT EXIST ON SPOTIFY ANYMORE   ###' + "\n")
 | 
				
			||||||
 | 
					                else:
 | 
				
			||||||
                    download_track('playlist', song[TRACK][ID], extra_keys={'playlist': name})
 | 
					                    download_track('playlist', song[TRACK][ID], extra_keys={'playlist': name})
 | 
				
			||||||
        elif episode_id is not None:
 | 
					        elif episode_id is not None:
 | 
				
			||||||
            download = True
 | 
					            download = True
 | 
				
			||||||
 | 
				
			|||||||
@ -70,7 +70,7 @@ def download_episode(episode_id) -> None:
 | 
				
			|||||||
    extra_paths = podcast_name + '/'
 | 
					    extra_paths = podcast_name + '/'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if podcast_name is None:
 | 
					    if podcast_name is None:
 | 
				
			||||||
        Printer.print(PrintChannel.ERRORS, '###   SKIPPING: (EPISODE NOT FOUND)   ###')
 | 
					        Printer.print(PrintChannel.SKIPS, '###   SKIPPING: (EPISODE NOT FOUND)   ###')
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        filename = podcast_name + ' - ' + episode_name
 | 
					        filename = podcast_name + ' - ' + episode_name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -126,6 +126,7 @@ def download_track(mode: str, track_id: str, extra_keys={}, disable_progressbar=
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        Printer.print(PrintChannel.ERRORS, '###   SKIPPING SONG - FAILED TO QUERY METADATA   ###')
 | 
					        Printer.print(PrintChannel.ERRORS, '###   SKIPPING SONG - FAILED TO QUERY METADATA   ###')
 | 
				
			||||||
 | 
					        Printer.print(PrintChannel.ERRORS, 'Track_ID: ' + str(track_id) + "\n")
 | 
				
			||||||
        Printer.print(PrintChannel.ERRORS, str(e) + "\n")
 | 
					        Printer.print(PrintChannel.ERRORS, str(e) + "\n")
 | 
				
			||||||
        Printer.print(PrintChannel.ERRORS, "".join(traceback.TracebackException.from_exception(e).format()) + "\n")
 | 
					        Printer.print(PrintChannel.ERRORS, "".join(traceback.TracebackException.from_exception(e).format()) + "\n")
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
@ -191,6 +192,7 @@ def download_track(mode: str, track_id: str, extra_keys={}, disable_progressbar=
 | 
				
			|||||||
                        time.sleep(ZSpotify.CONFIG.get_anti_ban_wait_time())
 | 
					                        time.sleep(ZSpotify.CONFIG.get_anti_ban_wait_time())
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            Printer.print(PrintChannel.ERRORS, '###   SKIPPING: ' + song_name + ' (GENERAL DOWNLOAD ERROR)   ###')
 | 
					            Printer.print(PrintChannel.ERRORS, '###   SKIPPING: ' + song_name + ' (GENERAL DOWNLOAD ERROR)   ###')
 | 
				
			||||||
 | 
					            Printer.print(PrintChannel.ERRORS, 'Track_ID: ' + str(track_id) + "\n")
 | 
				
			||||||
            Printer.print(PrintChannel.ERRORS, str(e) + "\n")
 | 
					            Printer.print(PrintChannel.ERRORS, str(e) + "\n")
 | 
				
			||||||
            Printer.print(PrintChannel.ERRORS, "".join(traceback.TracebackException.from_exception(e).format()) + "\n")
 | 
					            Printer.print(PrintChannel.ERRORS, "".join(traceback.TracebackException.from_exception(e).format()) + "\n")
 | 
				
			||||||
            if os.path.exists(filename_temp):
 | 
					            if os.path.exists(filename_temp):
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user