Add support for multiple urls Fix #149

This commit is contained in:
el-gringo-alto 2021-10-28 12:59:36 -04:00
parent 17329d8cf6
commit a2fb09e2ed
3 changed files with 29 additions and 25 deletions

View File

@ -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

View File

@ -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)

View File

@ -29,9 +29,10 @@ def client(args) -> None:
print('[ DETECTED FREE ACCOUNT - USING HIGH QUALITY ]\n\n')
ZSpotify.DOWNLOAD_QUALITY = AudioQuality.HIGH
if 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(
args.url)
spotify_url)
if track_id is not None:
download_track(track_id)