diff --git a/screenless/bureau/audio/audio.py b/screenless/bureau/audio/audio.py index 11bc908..c04d650 100644 --- a/screenless/bureau/audio/audio.py +++ b/screenless/bureau/audio/audio.py @@ -1,6 +1,8 @@ import kode256 import requests +import gi +from gi.repository import TotemPlParser from gsp import GstreamerPlayer from bureau import Bureau, add_command, add_webview @@ -32,10 +34,20 @@ class Audio(Bureau): """ shortcode, _ = data.split(".") self.log.debug("looking up shortcode " + shortcode) - url = self.urldb.get(shortcode) - self.log.debug(" playing url " + url) - - self.player.queue(url) + pl_url = self.urldb.get(shortcode) + 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.current_uri = url @add_command("stop", "Halt audio playback.")