2021-10-28 08:14:18 +02:00
|
|
|
import argparse
|
|
|
|
|
2021-10-24 19:15:41 +02:00
|
|
|
from app import client
|
2021-11-18 23:02:05 +01:00
|
|
|
from config import CONFIG_VALUES
|
2021-10-28 08:14:18 +02:00
|
|
|
|
2021-10-24 19:15:41 +02:00
|
|
|
if __name__ == '__main__':
|
2021-10-28 08:14:18 +02:00
|
|
|
parser = argparse.ArgumentParser(prog='zspotify',
|
|
|
|
description='A Spotify downloader needing only a python interpreter and ffmpeg.')
|
|
|
|
parser.add_argument('-ns', '--no-splash',
|
|
|
|
action='store_true',
|
|
|
|
help='Suppress the splash screen when loading.')
|
2021-11-18 22:16:07 +01:00
|
|
|
parser.add_argument('--config-location',
|
|
|
|
type=str,
|
|
|
|
help='Specify the zs_config.json location')
|
2021-10-28 08:14:18 +02:00
|
|
|
group = parser.add_mutually_exclusive_group(required=True)
|
2021-10-28 18:59:36 +02:00
|
|
|
group.add_argument('urls',
|
2021-10-28 08:14:18 +02:00
|
|
|
type=str,
|
2021-10-28 18:59:36 +02:00
|
|
|
# action='extend',
|
2021-10-28 08:14:18 +02:00
|
|
|
default='',
|
2021-10-28 18:59:36 +02:00
|
|
|
nargs='*',
|
|
|
|
help='Downloads the track, album, playlist, podcast episode, or all albums by an artist from a url. Can take multiple urls.')
|
2021-10-28 08:14:18 +02:00
|
|
|
group.add_argument('-ls', '--liked-songs',
|
|
|
|
dest='liked_songs',
|
|
|
|
action='store_true',
|
|
|
|
help='Downloads all the liked songs from your account.')
|
|
|
|
group.add_argument('-p', '--playlist',
|
|
|
|
action='store_true',
|
|
|
|
help='Downloads a saved playlist from your account.')
|
|
|
|
group.add_argument('-s', '--search',
|
|
|
|
dest='search_spotify',
|
|
|
|
action='store_true',
|
|
|
|
help='Loads search prompt to find then download a specific track, album or playlist')
|
2021-11-11 17:14:22 +01:00
|
|
|
group.add_argument('-d', '--download',
|
|
|
|
type=str,
|
|
|
|
help='Downloads tracks, playlists and albums from the URLs written in the file passed.')
|
2021-10-28 08:14:18 +02:00
|
|
|
|
2021-11-18 23:02:05 +01:00
|
|
|
for configkey in CONFIG_VALUES:
|
|
|
|
parser.add_argument(CONFIG_VALUES[configkey]['arg'],
|
|
|
|
type=str,
|
|
|
|
default=None,
|
|
|
|
help='Specify the value of the ['+configkey+'] config value')
|
|
|
|
|
2021-10-28 08:14:18 +02:00
|
|
|
parser.set_defaults(func=client)
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
args.func(args)
|