zotify/zotify/__main__.py

69 lines
2.6 KiB
Python
Raw Permalink Normal View History

2021-12-25 22:27:27 -07:00
#! /usr/bin/env python3
"""
Zotify
It's like youtube-dl, but for that other music platform.
"""
import argparse
2022-02-02 01:56:57 -07:00
from zotify.app import client
from zotify.config import CONFIG_VALUES
2021-12-25 22:27:27 -07:00
2022-02-02 01:56:57 -07:00
def main():
2021-12-25 22:27:27 -07:00
parser = argparse.ArgumentParser(prog='zotify',
2022-02-14 23:07:45 -07:00
description='A music and podcast downloader needing only python and ffmpeg.')
2021-12-25 22:27:27 -07:00
parser.add_argument('-ns', '--no-splash',
action='store_true',
help='Suppress the splash screen when loading.')
parser.add_argument('--config-location',
type=str,
2022-02-12 00:48:27 -07:00
help='Specify the zconfig.json location')
2022-02-18 20:25:36 -07:00
parser.add_argument('--username',
type=str,
help='Account username')
parser.add_argument('--password',
type=str,
help='Account password')
2022-02-24 18:52:30 -07:00
group = parser.add_mutually_exclusive_group(required=False)
2021-12-25 22:27:27 -07:00
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. Can take multiple urls.')
2022-02-12 00:48:27 -07:00
group.add_argument('-l', '--liked',
2021-12-25 22:27:27 -07:00
dest='liked_songs',
action='store_true',
help='Downloads all the liked songs from your account.')
2022-03-24 03:42:06 -06:00
group.add_argument('-f', '--followed',
dest='followed_artists',
action='store_true',
help='Downloads all the songs from all your followed artists.')
2021-12-25 22:27:27 -07:00
group.add_argument('-p', '--playlist',
action='store_true',
help='Downloads a saved playlist from your account.')
group.add_argument('-s', '--search',
2022-02-12 00:48:27 -07:00
type=str,
nargs='?',
const=' ',
2021-12-25 22:27:27 -07:00
help='Loads search prompt to find then download a specific track, album or playlist')
group.add_argument('-d', '--download',
type=str,
help='Downloads tracks, playlists and albums from the URLs written in the file passed.')
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')
parser.set_defaults(func=client)
args = parser.parse_args()
args.func(args)
2022-02-02 01:56:57 -07:00
2022-02-12 00:48:27 -07:00
2022-02-02 01:56:57 -07:00
if __name__ == '__main__':
main()