master
flyingrub 2015-01-05 23:22:14 +01:00
parent f2f3af45cc
commit 527292b38e
3 changed files with 21 additions and 2 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ dist/
*.pyc
*.egg-info/
__pycache__/
*.mp3

View File

@ -17,7 +17,7 @@ It should work with OS X, Linux, Windows.
### Installation
___
1. Install scdl `pip3 install scdl`
2. Setup your path and your auth_token in `$HOME/.config/scdl/scdl.cfg`
2. (Optional) Setup your path and your auth_token in `$HOME/.config/scdl/scdl.cfg`
### Authentication:

View File

@ -131,7 +131,7 @@ def get_item(track_url):
item = client.get('/resolve', url=track_url)
except Exception as e:
print("Could not resolve url " + track_url)
print(e.message, e.args)
print(e)
sys.exit(0)
return item
@ -142,8 +142,11 @@ def parse_url(track_url):
"""
arguments = docopt(__doc__, version='0.1')
item = get_item(track_url)
if not item:
return
elif isinstance(item, soundcloud.resource.ResourceList):
download_all(item)
elif item.kind == 'track':
print("Found a track")
download_track(item)
@ -287,6 +290,21 @@ def download_playlist(playlist):
download_track(mp3_url)
def download_all(tracks):
"""
Download all song of a page
Not recommended
"""
print("NOTE: This will only download the songs of the page.(49 max)")
print("I recommend you to provide an user link and a download type.")
count = 0
for track in tracks:
count += 1
print("")
print('Track n°%d' % (count))
download_track(track)
def download_track(track):
"""
Downloads a track