-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcli.py
More file actions
44 lines (36 loc) · 1.08 KB
/
cli.py
File metadata and controls
44 lines (36 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
CLI Interface for Spotify Downloader
"""
import argparse
from lib import SpotifyDownloader
def run_cli():
"""CLI interface for Spotify downloader"""
parser = argparse.ArgumentParser(
description="Spotify Downloader CLI"
)
parser.add_argument(
"link",
help="Spotify track, album or playlist"
)
args = parser.parse_args()
link = args.link
print("\n - - - Spotify Downloader CLI - - - ")
print(f"Processing ->: {link}")
print(" --------------------------------------")
downloader = SpotifyDownloader(
download_dir='downloaded',
cookie_browser='chrome',
download_delay=3
)
try:
stats = downloader.download_playlist(link)
print("\n" + "=" * 50)
print(f"Download Complete!")
print(f"Total tracks: {stats['total']}")
print(f"Successfully downloaded: {stats['successful']}")
print(f"Failed: {stats['failed']}")
print("=" * 50)
except Exception as e:
print(f"\nSorry, an error has occurred: {e}")
if __name__ == "__main__":
run_cli()