mirror of
https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
synced 2024-11-26 09:53:17 +01: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:
|
||||
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:
|
||||
-p, --playlist Downloads a saved playlist from your account
|
||||
|
@ -11,11 +11,12 @@ if __name__ == '__main__':
|
||||
action='store_true',
|
||||
help='Suppress the splash screen when loading.')
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('url',
|
||||
group.add_argument('urls',
|
||||
type=str,
|
||||
# action='extend',
|
||||
default='',
|
||||
nargs='?',
|
||||
help='Downloads the track, album, playlist, podcast episode, or all albums by an artist from a url.')
|
||||
nargs='*',
|
||||
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',
|
||||
dest='liked_songs',
|
||||
action='store_true',
|
||||
@ -32,3 +33,5 @@ if __name__ == '__main__':
|
||||
|
||||
args = parser.parse_args()
|
||||
args.func(args)
|
||||
|
||||
# print(args)
|
||||
|
@ -29,28 +29,29 @@ def client(args) -> None:
|
||||
print('[ DETECTED FREE ACCOUNT - USING HIGH QUALITY ]\n\n')
|
||||
ZSpotify.DOWNLOAD_QUALITY = AudioQuality.HIGH
|
||||
|
||||
if args.url:
|
||||
track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(
|
||||
args.url)
|
||||
if args.urls:
|
||||
for spotify_url in args.urls:
|
||||
track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(
|
||||
spotify_url)
|
||||
|
||||
if track_id is not None:
|
||||
download_track(track_id)
|
||||
elif artist_id is not None:
|
||||
download_artist_albums(artist_id)
|
||||
elif album_id is not None:
|
||||
download_album(album_id)
|
||||
elif playlist_id is not None:
|
||||
playlist_songs = get_playlist_songs(playlist_id)
|
||||
name, _ = get_playlist_info(playlist_id)
|
||||
for song in playlist_songs:
|
||||
download_track(song[TRACK][ID],
|
||||
sanitize_data(name) + '/')
|
||||
print('\n')
|
||||
elif episode_id is not None:
|
||||
download_episode(episode_id)
|
||||
elif show_id is not None:
|
||||
for episode in get_show_episodes(show_id):
|
||||
download_episode(episode)
|
||||
if track_id is not None:
|
||||
download_track(track_id)
|
||||
elif artist_id is not None:
|
||||
download_artist_albums(artist_id)
|
||||
elif album_id is not None:
|
||||
download_album(album_id)
|
||||
elif playlist_id is not None:
|
||||
playlist_songs = get_playlist_songs(playlist_id)
|
||||
name, _ = get_playlist_info(playlist_id)
|
||||
for song in playlist_songs:
|
||||
download_track(song[TRACK][ID],
|
||||
sanitize_data(name) + '/')
|
||||
print('\n')
|
||||
elif episode_id is not None:
|
||||
download_episode(episode_id)
|
||||
elif show_id is not None:
|
||||
for episode in get_show_episodes(show_id):
|
||||
download_episode(episode)
|
||||
|
||||
if args.playlist:
|
||||
download_from_user_playlist()
|
||||
|
Loading…
Reference in New Issue
Block a user