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

⌈⌋ branch:  streamtuner2


Check-in [cbd84b656f]

Overview
Comment:`timedout` and `description` are seemingly gone from the API responses.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cbd84b656f88b32fde71fffb6b8e100bb49d547f
User & Date: mario on 2015-05-15 17:55:37
Other Links: manifest | tags
Context
2015-05-15
17:58
Add ahttp.fix_url() for dirble `website` addresses. check-in: 96d86cc203 user: mario tags: trunk
17:55
`timedout` and `description` are seemingly gone from the API responses. check-in: cbd84b656f user: mario tags: trunk
17:49
Add `filter_bitrate` to default pack: list. check-in: 9a5cee5ac7 user: mario tags: trunk
Changes

Modified channels/dirble.py from [8581a994c5] to [d2166f415b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# encoding: UTF-8
# api: streamtuner2
# title: Dirble
# description: Song history tracker for Internet radio stations.
# url: http://dirble.com/
# version: 2.0
# type: channel
# category: radio
# config:
#    { name: dirble_api_key,  value: "",  type: text,  description: Alternative API access key. }
# png:
#    iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAA3NCSVQICAjb4U/gAAACP0lE
#    QVQokVVSO0+UURA9M/d+jyWbBVcQFSQhPqJSYBRFA5pVoFGURApjYYWtvYUNP8FKOwsttDFq
#    jMTEWEiDD0wETNSIxJC46yqEsCz7ve4di28hOO2cMzNnzqH+azcBACAiAgQg1EsAQESwCYBA
#    pwCxNowjI1v7YGLH0Y5iSQFhJEprYjZxtG13+/lCb2dOWxBBABiTrJSLkx8+z/xa0yRutml4
#    sC9X+qqJyFqTzTcPDfTup2p5NSTFSintOFmvZ7iv687Dl8/ezufaGgcHT2enKjpdbxMbRcnr
#    x09uT36JfJ9FWLtnCoWxkRM3Ris/F//Mlpce3LtvSsW6BhAxs5VgtVqtxUaJQCqPnr4ItXfr
................................................................................
    def unpack(self, r):
    
        # find stream (might select on `bitrate` or `format` if available)
        if len(r.get("streams", [])):
            s = r["streams"][0]
        else:
            return {}


        # rename fields
        return dict(
            genre = " ".join(c["slug"] for c in r["categories"]),
            title = r["name"],
            playing = "{country} {description}".format(**r),
            homepage = r["website"],
            url = s["stream"],
            format = s["content_type"],
            bitrate = s["bitrate"],
           # img = r["image"]["image"]["thumb"]["url"], # CDN HTTPS trip up requests.get
            state = self.state_map[int(s["status"])] if s["status"] in [0,1,2] else "",
            deleted = s["timedout"],
        )
        
    state_map = ["gtk-media-pause", "gtk-media-next", "gtk-media-rewind"]


    # Patch API url together, send request, decode JSON list
    def api(self, method, **params):





|



|







 







>





|






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# encoding: UTF-8
# api: streamtuner2
# title: Dirble
# description: Song history tracker for Internet radio stations.
# url: http://dirble.com/
# version: 2.1
# type: channel
# category: radio
# config:
#    { name: dirble_api_key,  value: "",  type: text,  description: Alternative API access key., hidden: 1 }
# png:
#    iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAA3NCSVQICAjb4U/gAAACP0lE
#    QVQokVVSO0+UURA9M/d+jyWbBVcQFSQhPqJSYBRFA5pVoFGURApjYYWtvYUNP8FKOwsttDFq
#    jMTEWEiDD0wETNSIxJC46yqEsCz7ve4di28hOO2cMzNnzqH+azcBACAiAgQg1EsAQESwCYBA
#    pwCxNowjI1v7YGLH0Y5iSQFhJEprYjZxtG13+/lCb2dOWxBBABiTrJSLkx8+z/xa0yRutml4
#    sC9X+qqJyFqTzTcPDfTup2p5NSTFSintOFmvZ7iv687Dl8/ezufaGgcHT2enKjpdbxMbRcnr
#    x09uT36JfJ9FWLtnCoWxkRM3Ris/F//Mlpce3LtvSsW6BhAxs5VgtVqtxUaJQCqPnr4ItXfr
................................................................................
    def unpack(self, r):
    
        # find stream (might select on `bitrate` or `format` if available)
        if len(r.get("streams", [])):
            s = r["streams"][0]
        else:
            return {}
        print r

        # rename fields
        return dict(
            genre = " ".join(c["slug"] for c in r["categories"]),
            title = r["name"],
            playing = "{} {}".format(r.get("country"), r.get("description")),
            homepage = r["website"],
            url = s["stream"],
            format = s["content_type"],
            bitrate = s["bitrate"],
           # img = r["image"]["image"]["thumb"]["url"], # CDN HTTPS trip up requests.get
            state = self.state_map[int(s["status"])] if s["status"] in [0,1,2] else "",
            deleted = s.get("timedout", False),
        )
        
    state_map = ["gtk-media-pause", "gtk-media-next", "gtk-media-rewind"]


    # Patch API url together, send request, decode JSON list
    def api(self, method, **params):