update audio dept. to use TotemPlParser for internet radio streams

workspace
Brendan Howell 3 years ago
parent c359aa5961
commit 9ad4d6b119

@ -1,6 +1,8 @@
import kode256 import kode256
import requests import requests
import gi
from gi.repository import TotemPlParser
from gsp import GstreamerPlayer from gsp import GstreamerPlayer
from bureau import Bureau, add_command, add_webview from bureau import Bureau, add_command, add_webview
@ -32,9 +34,19 @@ class Audio(Bureau):
""" """
shortcode, _ = data.split(".") shortcode, _ = data.split(".")
self.log.debug("looking up shortcode " + shortcode) self.log.debug("looking up shortcode " + shortcode)
url = self.urldb.get(shortcode) pl_url = self.urldb.get(shortcode)
self.log.debug(" playing url " + url) self.log.debug(" playing url " + pl_url)
parser = TotemPlParser.Parser()
urls = []
def parsercb(parser, uri, metadata, urls):
#TODO: would be nice to use the metadata when adding the station
# and for now-playing
urls.append(uri)
parser.connect("entry-parsed", parsercb, urls)
parser.parse(pl_url, True)
for url in urls:
self.player.queue(url) self.player.queue(url)
self.current_uri = url self.current_uri = url

Loading…
Cancel
Save