1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 |
-
+
+
| # encoding: UTF-8
# api: streamtuner2
# title: TuneIn
# description: Online Radio, Broadcasts, Podcasts per RadioTime API
# version: 0.2
# version: 0.3
# type: channel
# category: radio
# url: http://tunein.com/
# config:
# { name: radiotime_group, value: music, type: select, select: music|genres, description: Catalogue type as categories. (→ Reload Category Tree) }
# { name: radiotime_maxpages, value: 10, type: int, description: Maximum number of pages. }
# priority: default
# png:
# iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAbpJREFUOI2Nkk9PE1EUxc+ZuTMIaP+KqClxx4dA0jRVgwFM/JPIRv0CunDnxsQ1G4NGvgD7LkiExG5IDHFhDDEmblwRQJG2AVuwMNOZd91QAuUR
# e1bvnnfeLzf3PsKioq6Dtf25xsq3Kdf3gkxh9OUis29tWcdm9iPxuvHl62MNQz/a+3uhVl56M647d7sGHOxU8hpFR7Uag9+l+UddAySdWuv0soWR710DXOj93mtDWxQBRTBwq7AcZfte2bK0mQCQ11X0I5lzEW2858BZMXBkZWkGqk8Atk7c
# mBhqVCWV2E0MDz9dYLo8ptWbwdrP2aC6nSYhIOck2PiVdDwvfXxox9WqVAcPVtc/jOkm68uf56M/9T4AoAhMq5V06NCc2d+hNAzhwBttPz5q36FxchOT0xT5HwMEvRO1CHITk9MEgHHdfED4z4La9nmQqiY2dNywHY6b++d6h65OhVvVElw3
# 7rmY2VOE7xZ5pWTdwh2t52NEzwEeQtgTIXhR5uUfnVlr783m7vXGx0/32oOlCC7dLs4COAWwfiTH9+PTrrFnbWan6LkA/HLXAFckaJ+9bKYyeKP4cIEpK/wffVOh5FvT8j8AAAAASUVORK5CYII=
# documentation: http://opml.radiotime.com/ |
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104 | 81
82
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 |
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
| "playing": row.get("subtext", ""),
"favicon": row.get("image", None),
})
return r
# Fetch OPML, convert outline elements to dicts
def api(self, method, url=None):
def api(self, method):
r = []
# fetch API page
next = self.base + method
max = int(conf.radiotime_maxpages)
while next:
opml = ahttp.get(url or self.base + method)
x = ElementTree.fromstring(opml)
# append entries
for outline in x.findall(".//outline"):
outline = dict(outline.items())
# additional pages
if "key" in outline and outline["key"] == "nextStations":
if len(x) < conf.max_streams:
r = r + self.api(method=None, url=outline["URL"])
opml = ahttp.get(next)
next = None
x = ElementTree.fromstring(opml)
# append entries
for outline in x.findall(".//outline"):
outline = dict(outline.items())
# additional pages
if "key" in outline and outline["key"] == "nextStations":
if len(r) < conf.max_streams and max > 0:
next = outline["URL"]
else:
pass
else:
r.append(outline)
max = max - 1
else:
r.append(outline)
return r
|