diff --git a/scdl/__init__.py b/scdl/__init__.py index 16ed0b5..acd0710 100644 --- a/scdl/__init__.py +++ b/scdl/__init__.py @@ -2,4 +2,4 @@ """Python Soundcloud Music Downloader.""" -__version__ = "v2.2.0" \ No newline at end of file +__version__ = "v2.2.1" \ No newline at end of file diff --git a/scdl/scdl.py b/scdl/scdl.py index 2a2cac3..00969a8 100755 --- a/scdl/scdl.py +++ b/scdl/scdl.py @@ -4,7 +4,7 @@ """scdl allows you to download music from Soundcloud Usage: - scdl -l [-a | -f | -C | -t | -p | -r][-c | --force-metadata][-n ] + scdl (-l | me) [-a | -f | -C | -t | -p | -r][-c | --force-metadata][-n ] [-o ][--hidewarnings][--debug | --error][--path ][--addtofile][--addtimestamp] [--onlymp3][--hide-progress][--min-size ][--max-size ][--remove][--no-album-tag] [--no-playlist-folder][--download-archive ][--extract-artist][--flac][--original-art] @@ -65,6 +65,8 @@ import logging import mimetypes import pathlib +import soundcloud + mimetypes.init() import os @@ -148,7 +150,7 @@ def main(): if not client.is_client_id_valid(): raise ValueError(f"client_id is not valid") - if token and not client.is_auth_token_valid(): + if (token or arguments["me"]) and not client.is_auth_token_valid(): raise ValueError(f"auth_token is not valid") if arguments["-o"] is not None: @@ -196,13 +198,16 @@ def main(): if not arguments["--playlist-name-format"]: arguments["--playlist-name-format"] = config["scdl"]["playlist_name_format"] + if arguments["me"]: + # set url to profile associated with auth token + arguments["-l"] = client.get_me().permalink_url + # convert arguments dict to python_args (kwargs-friendly args) for key, value in arguments.items(): key = key.strip("-").replace("-", "_") python_args[key] = value - if arguments["-l"]: - download_url(client, **python_args) + download_url(client, **python_args) if arguments["--remove"]: remove_files()