mirror of
				https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
				synced 2025-11-03 21:10:34 +00:00 
			
		
		
		
	Add support for multiple urls Fix #149
This commit is contained in:
		
							parent
							
								
									17329d8cf6
								
							
						
					
					
						commit
						a2fb09e2ed
					
				@ -35,7 +35,7 @@ Python packages:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
Basic command line usage:
 | 
					Basic command line usage:
 | 
				
			||||||
  python zspotify <track/album/playlist/episode/artist url>   Downloads the track, album, playlist or podcast episode specified as a command line argument. If an artist url is given, all albums by specified artist will be downloaded.
 | 
					  python zspotify <track/album/playlist/episode/artist url>   Downloads the track, album, playlist or podcast episode specified as a command line argument. If an artist url is given, all albums by specified artist will be downloaded. Can take multiple urls.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Extra command line options:
 | 
					Extra command line options:
 | 
				
			||||||
  -p, --playlist       Downloads a saved playlist from your account
 | 
					  -p, --playlist       Downloads a saved playlist from your account
 | 
				
			||||||
 | 
				
			|||||||
@ -11,11 +11,12 @@ if __name__ == '__main__':
 | 
				
			|||||||
                        action='store_true',
 | 
					                        action='store_true',
 | 
				
			||||||
                        help='Suppress the splash screen when loading.')
 | 
					                        help='Suppress the splash screen when loading.')
 | 
				
			||||||
    group = parser.add_mutually_exclusive_group(required=True)
 | 
					    group = parser.add_mutually_exclusive_group(required=True)
 | 
				
			||||||
    group.add_argument('url',
 | 
					    group.add_argument('urls',
 | 
				
			||||||
                       type=str,
 | 
					                       type=str,
 | 
				
			||||||
 | 
					                       # action='extend',
 | 
				
			||||||
                       default='',
 | 
					                       default='',
 | 
				
			||||||
                       nargs='?',
 | 
					                       nargs='*',
 | 
				
			||||||
                       help='Downloads the track, album, playlist, podcast episode, or all albums by an artist from a url.')
 | 
					                       help='Downloads the track, album, playlist, podcast episode, or all albums by an artist from a url. Can take multiple urls.')
 | 
				
			||||||
    group.add_argument('-ls', '--liked-songs',
 | 
					    group.add_argument('-ls', '--liked-songs',
 | 
				
			||||||
                       dest='liked_songs',
 | 
					                       dest='liked_songs',
 | 
				
			||||||
                       action='store_true',
 | 
					                       action='store_true',
 | 
				
			||||||
@ -32,3 +33,5 @@ if __name__ == '__main__':
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    args = parser.parse_args()
 | 
					    args = parser.parse_args()
 | 
				
			||||||
    args.func(args)
 | 
					    args.func(args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # print(args)
 | 
				
			||||||
 | 
				
			|||||||
@ -29,28 +29,29 @@ def client(args) -> None:
 | 
				
			|||||||
            print('[ DETECTED FREE ACCOUNT - USING HIGH QUALITY ]\n\n')
 | 
					            print('[ DETECTED FREE ACCOUNT - USING HIGH QUALITY ]\n\n')
 | 
				
			||||||
        ZSpotify.DOWNLOAD_QUALITY = AudioQuality.HIGH
 | 
					        ZSpotify.DOWNLOAD_QUALITY = AudioQuality.HIGH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if args.url:
 | 
					    if args.urls:
 | 
				
			||||||
        track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(
 | 
					        for spotify_url in args.urls:
 | 
				
			||||||
            args.url)
 | 
					            track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(
 | 
				
			||||||
 | 
					                spotify_url)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if track_id is not None:
 | 
					            if track_id is not None:
 | 
				
			||||||
            download_track(track_id)
 | 
					                download_track(track_id)
 | 
				
			||||||
        elif artist_id is not None:
 | 
					            elif artist_id is not None:
 | 
				
			||||||
            download_artist_albums(artist_id)
 | 
					                download_artist_albums(artist_id)
 | 
				
			||||||
        elif album_id is not None:
 | 
					            elif album_id is not None:
 | 
				
			||||||
            download_album(album_id)
 | 
					                download_album(album_id)
 | 
				
			||||||
        elif playlist_id is not None:
 | 
					            elif playlist_id is not None:
 | 
				
			||||||
            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:
 | 
				
			||||||
                download_track(song[TRACK][ID],
 | 
					                    download_track(song[TRACK][ID],
 | 
				
			||||||
                               sanitize_data(name) + '/')
 | 
					                                   sanitize_data(name) + '/')
 | 
				
			||||||
                print('\n')
 | 
					                    print('\n')
 | 
				
			||||||
        elif episode_id is not None:
 | 
					            elif episode_id is not None:
 | 
				
			||||||
            download_episode(episode_id)
 | 
					                download_episode(episode_id)
 | 
				
			||||||
        elif show_id is not None:
 | 
					            elif show_id is not None:
 | 
				
			||||||
            for episode in get_show_episodes(show_id):
 | 
					                for episode in get_show_episodes(show_id):
 | 
				
			||||||
                download_episode(episode)
 | 
					                    download_episode(episode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if args.playlist:
 | 
					    if args.playlist:
 | 
				
			||||||
        download_from_user_playlist()
 | 
					        download_from_user_playlist()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user