diff options
Diffstat (limited to 'module/plugins/hoster/SoundcloudCom.py')
-rw-r--r-- | module/plugins/hoster/SoundcloudCom.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index 8dff4f42a..b189ee1ba 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -9,7 +9,8 @@ from module.common.json_layer import json_loads class SoundcloudCom(SimpleHoster): __name__ = "SoundcloudCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?soundcloud\.com/[\w-]+/[\w-]+' __config__ = [("use_premium", "bool" , "Use premium account if available", True ), @@ -24,7 +25,7 @@ class SoundcloudCom(SimpleHoster): OFFLINE_PATTERN = r'<title>"SoundCloud - Hear the world’s sounds"</title>' - def handleFree(self, pyfile): + def handle_free(self, pyfile): try: song_id = re.search(r'sounds:(\d+)"', self.html).group(1) @@ -37,19 +38,19 @@ class SoundcloudCom(SimpleHoster): except Exception: client_id = "b45b1aa10f1ac2941910a7f0d10f8e28" - # url to retrieve the actual song url + #: Url to retrieve the actual song url streams = json_loads(self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id, get={'client_id': client_id})) regex = re.compile(r'[^\d]') - http_streams = sorted([(key, value) for key, value in streams.iteritems() if key.startswith('http_')], + http_streams = sorted([(key, value) for key, value in streams.items() if key.startswith('http_')], key=lambda t: regex.sub(t[0], ''), reverse=True) - self.logDebug("Streams found: %s" % (http_streams or "None")) + self.log_debug("Streams found: %s" % (http_streams or "None")) if http_streams: - stream_name, self.link = http_streams[0 if self.getConfig('quality') == "Higher" else -1] + stream_name, self.link = http_streams[0 if self.get_config('quality') == "Higher" else -1] pyfile.name += '.' + stream_name.split('_')[1].lower() |