Ejemplo n.º 1
0
def sendung(phenny, input):
    """
    zeigt die aktuelle Sendung auf dem Stream
    """

    #info = read_sendunginfo(phenny.config.sendung_url)
    info = read_newpage()
    if not sendung:
        return
    elif "stream_info" in info.keys():
        phenny.say(info["stream_info"])
    elif "sendung_thema" in info.keys():
        phenny.say("%s mit %s seit %s" % (info["sendung_title"], info["sendung_thema"], info["sendung_start"]))
    else:
        phenny.say("%s seit %s" % (info["sendung_title"], info["sendung_start"]))
    return
Ejemplo n.º 2
0
def sendung(phenny, input):
    """
    zeigt die aktuelle Sendung auf dem Stream
    """

    #info = read_sendunginfo(phenny.config.sendung_url)
    info = read_newpage()
    if not sendung:
        return
    elif "stream_info" in info.keys():
        phenny.say(info["stream_info"])
    elif "sendung_thema" in info.keys():
        phenny.say("%s mit %s seit %s" %
                   (info["sendung_title"], info["sendung_thema"],
                    info["sendung_start"]))
    else:
        phenny.say("%s seit %s" %
                   (info["sendung_title"], info["sendung_start"]))
    return
Ejemplo n.º 3
0
def cached_streaminfos(url, mount, song=None):
    """
        Cached die icyinfo, sodass nur einmal in der Minute abgefragt wird

        @todo consider reading to be async and always return cached data
    """

    # Update if old or non existant
    if cached_streaminfos.last < time.time(
    ) - cached_streaminfos.time or not cached_streaminfos.data or not cached_streaminfos.info or not cached_streaminfos.song:
        info = read_icyinfo("%s/%s" % (url, mount))
        if info:
            cached_streaminfos.info = info

        data = read_xslinfo("%s/status.xsl?mount=/%s" % (url, mount))
        if data:
            cached_streaminfos.data = data

        #song = {"song": read_nswstreaminfo(song)}
        song = read_newpage()
        if song["song"]:
            cached_streaminfos.song = song

        cached_streaminfos.last = time.time()

    if not cached_streaminfos.data:
        cached_streaminfos.data = {}

    if not cached_streaminfos.info:
        cached_streaminfos.info = {}

    if not cached_streaminfos.song:
        cached_streaminfos.song = {}

    return dict(
        list(cached_streaminfos.data.items()) +
        list(cached_streaminfos.info.items()) +
        list(cached_streaminfos.song.items()))