From d151cd37c8d735e1d47d3136342b1b7e1d0523d2 Mon Sep 17 00:00:00 2001 From: flyingrub Date: Wed, 26 Nov 2014 19:45:28 +0100 Subject: [PATCH] fix: 1 error & 1 enhancement * Custom path * Error with Offset --- scdl/scdl.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/scdl/scdl.py b/scdl/scdl.py index f7c2bf6..4dbdceb 100755 --- a/scdl/scdl.py +++ b/scdl/scdl.py @@ -2,24 +2,25 @@ """scdl allow you to download music from soundcloud Usage: - scdl.py -l [-a | -f | -t | -p][-c][-o ][--hidewarnings][--addtofile] - scdl.py me (-s | -a | -f | -t | -p)[-c][-o ][--hidewarnings][--addtofile] + scdl.py -l [-a | -f | -t | -p][-c][-o ][--hidewarnings][--path ][--addtofile] + scdl.py me (-s | -a | -f | -t | -p)[-c][-o ][--hidewarnings][--path ][--addtofile] scdl.py -h | --help scdl.py --version Options: - -h --help Show this screen. - --version Show version. + -h --help Show this screen + --version Show version me Use the user profile from the auth_token - -l [url] URL can be track/playlist/user. + -l [url] URL can be track/playlist/user -s Download the stream of an user (token needed) -a Download all track of an user (including repost) -t Download all upload of an user -f Download all favorite of an user -p Download all playlist of an user -c Continue if a music already exist - -o [offset] Begin with a custom offset. + -o [offset] Begin with a custom offset + --path [path] Use a custom path for this time --hidewarnings Hide Warnings. (use with precaution) --addtofile Add the artist name to the filename if it isn't in the filename already """ @@ -61,10 +62,11 @@ def main(): # Parse argument arguments = docopt(__doc__, version='0.1') - #print(arguments) - if arguments[""] is not None: + print(arguments) + + if arguments["-o"] is not None: try: - offset = int(arguments[""]) + offset = int(arguments["-o"]) except: print('Offset should be an Integer...') sys.exit() @@ -73,6 +75,13 @@ def main(): warnings.filterwarnings("ignore") print("no warnings!") + if arguments["--path"] is not None: + if os.path.exists(arguments["--path"]): + os.chdir(arguments["--path"]) + else: + print('Invalid path...') + sys.exit() + print('') if arguments["-l"]: parse_url(arguments[""])