Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ branch:  streamtuner2


Check-in [d32669293c]

Overview
Comment:Overwrite row["format"] after updating entry.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d32669293c1f7bb10c7befed3f5e3050842b920a
User & Date: mario on 2015-05-24 16:57:29
Other Links: manifest | tags
Context
2015-05-24
16:58
Undo {expand:False} attribute for CellRendererPixbuf check-in: a4d0e74658 user: mario tags: trunk
16:57
Overwrite row["format"] after updating entry. check-in: d32669293c user: mario tags: trunk
16:57
Fix audioformat to audio/mpeg. check-in: fa5df72f08 user: mario tags: trunk
Changes

Modified contrib/url_soundcloud.py from [18282e867b] to [82dc99789f].

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def client():
    global conn
    if not conn:
        conn = soundcloud.Client(client_id="f0aea6e0484043f6638cb5bf35d43312")
    return conn

# Capture play events for faux MIME type
def sndcl_convert(row={}, audioformat="audio/mpeg", source="pls", url=None, assoc={}):
    if audioformat==fmt or rx_url.match(url):

        # find streaming address
        try:
            log.DATA_CONVERT_SOUNDCLOUD(url)
            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["url"] = url
            source = "srv"
            audioformat = "audio/mpeg"


        except Exception as e:
            log.ERR_SOUNDCLOUD("URL resolving failed:", e)
            
            # let web browser run
            audioformat = "url/http"
    
    # let primary handler take over
    if audioformat != fmt:
        return action.run_fmt_url(row, audioformat, source, url, assoc)


# Hook up custom action.handler for soundcloud URLs
#
# Still somewhat hodgepodge. The action module just lets .play() params
# rewrite by above handler. Should turn faux "audio/soundcloud" URL into
# plain/longwinded MP3 streaming address.







|











|

>









|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def client():
    global conn
    if not conn:
        conn = soundcloud.Client(client_id="f0aea6e0484043f6638cb5bf35d43312")
    return conn

# Capture play events for faux MIME type
def sndcl_convert(row={}, audioformat="audio/mpeg", source="pls", assoc={}):
    if audioformat==fmt or rx_url.match(url):

        # find streaming address
        try:
            log.DATA_CONVERT_SOUNDCLOUD(url)
            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["url"] = url
            row["format"] = "audio/mpeg"
            audioformat = "audio/mpeg"
            source = "srv"

        except Exception as e:
            log.ERR_SOUNDCLOUD("URL resolving failed:", e)
            
            # let web browser run
            audioformat = "url/http"
    
    # let primary handler take over
    if audioformat != fmt:
        return action.run_fmt_url(row, audioformat, source, assoc)


# Hook up custom action.handler for soundcloud URLs
#
# Still somewhat hodgepodge. The action module just lets .play() params
# rewrite by above handler. Should turn faux "audio/soundcloud" URL into
# plain/longwinded MP3 streaming address.