1
2
3
4
5
6
7
8
9
10
11
|
1
2
3
4
5
6
7
8
9
10
11
|
-
+
|
# api: streamtuner2
# title: RadioTray hook
# description: Allows to bookmark stations to RadioTray/NG
# version: 0.6
# version: 0.7
# type: feature
# category: bookmarks
# depends: deb:python-dbus, deb:streamtuner2, deb:python-xdg
# config:
# { name: radiotray_map, type: select, value: "group", select: 'root|group|asis|play', description: 'Map genres to default RadioTray groups, or just "root".' }
# url: http://radiotray.sourceforge.net/
# priority: extra
|
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
-
-
-
-
-
-
+
+
+
+
+
+
+
+
|
group = self.map_group(row.get("genre"))
log.PROC("mapping genre '%s' to RT group '%s'" % (row["genre"], group))
# Radiotray-NG
try:
self.radiotray_ng().add_radio(row["title"], row["url"], group)
except:
#try:
cfg = self.radiotray_ng().get_config()
self.save_rtng_json(cfg, row, group)
self.parent.status("Updated RT-NG bookmarks.json. Use Preferences>Reload Bookmarks..")
#except:
# log.ERR("radiotray-ng not active")
try:
cfg = self.radiotray_ng().get_config()
self.save_rtng_json(cfg, row, group)
#time.sleep(0.350)
self.radiotray_ng().reload_bookmarks()
self.parent.status("Exported to Radiotray. You may need to use Preferences > Reload Bookmarks.")
except Exception as e:
log.ERR("radiotray-ng not active", e)
# RadioTray doesn't have an addRadio method yet, so just fall back to play the stream URL
try:
self.radiotray().addRadio(row["title"], row["url"], group)
except:
try:
self.radiotray().playUrl(row["url"])
|
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
-
+
|
"group": row["genre"],
"image": None,
"stations": []
}
j.append(found)
# overwrite bookmarks.json
if found:
g["stations"].append({
found["stations"].append({
"image": None,
"name": row["title"],
"url": row["url"]
})
json.dump(j, open(fn, "w"), indent=4)
# match genre to RT groups
|