Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish Version 3.4.0 #1204

Merged
merged 12 commits into from
Mar 16, 2021
Prev Previous commit
Next Next commit
@aklajnert's Allow specifying output directory (#1207)
@aklajnert's Allow specifying output directory (#1207)
  • Loading branch information
Silverarmor committed Mar 15, 2021
commit e314155b2bc25a2b3958dfe9fd2cbc03b30eceb4
11 changes: 10 additions & 1 deletion spotdl/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#! Basic necessities to get the CLI running
import argparse
import os
import sys

# ! The actual download stuff
from spotdl.download.downloader import DownloadManager
Expand Down Expand Up @@ -88,6 +90,12 @@ def console_entry_point():
clientSecret='0f02b7c483c04257984695007a4a8d5c'
)

if arguments.path:
if not os.path.isdir(arguments.path):
sys.exit("The output directory doesn't exist.")
print(f"Will download to: {os.path.abspath(arguments.path)}")
os.chdir(arguments.path)

downloader = DownloadManager()

for request in arguments.url:
Expand Down Expand Up @@ -136,7 +144,8 @@ def parse_arguments():
description=help_notice,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument("url", type=str, nargs="+")
parser.add_argument("url", type=str, nargs="+", help="URL to a song/album/playlist")
parser.add_argument("-o", "--output", help="Output directory path", dest="path")

return parser.parse_args()

Expand Down