1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | # 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 |
|
|
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | # 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 |
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 | 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): |
>
|
|
| 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 | 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): |