Index: contrib/url_soundcloud.py ================================================================== --- contrib/url_soundcloud.py +++ contrib/url_soundcloud.py @@ -1,20 +1,21 @@ # api: streamtuner2 # title: Soundcloud streams # description: Convert soundcloud links from reddit to streamable tracks -# version: 0.2 +# version: 0.3 # type: filter # category: audio # depends: python:soundcloud, action >= 1.1, reddit >= 0.8 # priority: rare # -# Overrides action.play() function to convert soundcloud URLs +# Hooks into action.play() function to convert soundcloud URLs # to track/streaming address. Disables the reddit filter for # walled gardens, and overrides any custom player configured # for "audio/soundcloud" in settings. +import copy import re import soundcloud from config import * import ahttp import action @@ -42,10 +43,11 @@ track = client().get('/resolve', url=url) track_str = "/tracks/{}/stream".format(track.id) url = client().get(track_str, allow_redirects=False).location # override attributes + row = copy.copy(row) # Throw away afterwards; tokens time out. row["url"] = url row["format"] = "audio/mpeg" audioformat = "audio/mpeg" source = "srv"