forked from yackx/SoundCloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
diff --git a/track.py b/track.py
index 5710e5c..365bf71 100644
--- a/track.py
+++ b/track.py
@@ -4,6 +4,7 @@
import urllib, re, os.path, soundcloud
import utils
+import requests
def download_from_url(client_id, track_url, dir, override=False):
@@ -23,7 +24,7 @@ def download_from_id(client_id, track_id, dir, override=False):
def download(client, track, dir, override=False):
"""Download a track using the given SC client"""
title = fix_title(track.title, track.user['username'])
- print '"%s"' % title
+ print '"%s"' % title.encode('ascii', 'ignore')
if not dir: dir = 'mp3'
utils.create_dir(dir)
file_name = utils.build_file_name(dir, title)
@@ -32,8 +33,11 @@ def download(client, track, dir, override=False):
print "File already exists, skipped"
return False
- stream_url = client.get(track.stream_url, allow_redirects=False)
- urllib.urlretrieve(stream_url.location, file_name)
+ try:
+ stream_url = client.get(track.stream_url, allow_redirects=False)
+ urllib.urlretrieve(stream_url.location, file_name)
+ except:
+ print "Error downloading file, skipped"
return True
Metadata
Metadata
Assignees
Labels
No labels