Skip to content

Commit 167a3d2

Browse files
author
Ronan Nello
committed
Merge pull request #22 from Glitch-is/master
Fixed Path and download URL
2 parents 2a8c9c1 + 38edf69 commit 167a3d2

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ ___
2727
> get your auth token here : http://flyingrub.tk/soundcloud/
2828
2929
* This permitt scdl to access to your user profile data.
30-
* For now scdl use it only to use `scdl.py me [OPTIONS]` instead of `scdl.py -l [url] [OPTIONS]`
30+
* For now scdl use it only to use `scdl me [OPTIONS]` instead of `scdl -l [url] [OPTIONS]`
3131
* (soon) scdl will download an user's stream thanks to this
3232

3333
## Help
3434
### Usage:
3535
```
36-
scdl.py -l <track_url> [-a | -f | -t | -p][-c][-o <offset>][--hidewarnings][--addtofile]
37-
scdl.py me (-s | -a | -f | -t | -p)[-c][-o <offset>][--hidewarnings][--addtofile]
38-
scdl.py -h | --help
39-
scdl.py --version
36+
scdl -l <track_url> [-a | -f | -t | -p][-c][-o <offset>][--hidewarnings][--addtofile]
37+
scdl me (-s | -a | -f | -t | -p)[-c][-o <offset>][--hidewarnings][--addtofile]
38+
scdl -h | --help
39+
scdl --version
4040
```
4141

4242
### Options:
@@ -54,6 +54,7 @@ ___
5454
-o [offset] Begin with a custom offset.
5555
--hidewarnings Hide Warnings. (use with precaution)
5656
--addtofile Add the artist name to the filename if it isn't in the filename already
57+
--path Path to download directory, can be set in the config. If none of this is set, it uses the current working directory
5758
```
5859

5960

scdl/scdl.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import mutagen
4242

4343
token = ''
44+
path = ''
4445
offset = 0
4546
filename = ''
4647
scdl_client_id = '9dbef61eb005cb526480279a0cc868c4'
@@ -71,18 +72,22 @@ def main():
7172

7273
if arguments["--hidewarnings"]:
7374
warnings.filterwarnings("ignore")
74-
print("no warnings!")
75+
# print("no warnings!") # Warn about no warnings...?
7576

7677
if arguments["--path"] is not None:
7778
if os.path.exists(arguments["--path"]):
79+
print('Downloading to '+arguments["--path"]+'...')
7880
os.chdir(arguments["--path"])
7981
else:
80-
print('Invalid path...')
81-
sys.exit()
82+
if path is not None:
83+
print('Downloading to '+path+'...')
84+
os.chdir(path)
85+
else:
86+
print('Downloading to current directory...')
8287

8388
print('')
8489
if arguments["-l"]:
85-
parse_url(arguments["<track_url>"])
90+
parse_url(arguments["-l"])
8691
elif arguments["me"]:
8792
if arguments["-a"]:
8893
download_all_user_tracks(who_am_i())
@@ -99,6 +104,7 @@ def get_config():
99104
read the path where to store music
100105
"""
101106
global token
107+
global path
102108
config = configparser.ConfigParser()
103109
config.read(os.path.join(os.path.expanduser('~'), '.config/scdl/scdl.cfg'))
104110
try:

setup.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)