initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
|
||||
|
||||
def download_playlist(playlist: dict, playlist_root: str) -> None:
|
||||
print(f"Downloading playlist {playlist['name']}")
|
||||
|
||||
# create playlist root, if not done yet
|
||||
try:
|
||||
os.mkdir(playlist_root)
|
||||
except FileExistsError:
|
||||
pass
|
||||
os.chdir(playlist_root)
|
||||
|
||||
# create playlist folder if not don yet
|
||||
playlist_dir = os.path.join(playlist_root, playlist["name"])
|
||||
try:
|
||||
os.mkdir(playlist_dir)
|
||||
print(f"Playlist folder for {playlist['name']} created")
|
||||
except FileExistsError:
|
||||
print(f"Playlist folder for {playlist['name']} already created")
|
||||
|
||||
os.chdir(playlist_dir)
|
||||
|
||||
command = f"spotdl {playlist['external_urls']['spotify']}"
|
||||
os.system(command)
|
||||
Reference in New Issue
Block a user