コード例 #1
0
def build_radio_type(client, radio_type):
    stations = radio.make_structure(client)[radio_type]

    elements = [build_item_radio_station(radio_type, key, stations[key]) for key in stations.keys()]

    xbmcplugin.addDirectoryItems(addon_handle, elements, len(elements))
    xbmcplugin.endOfDirectory(addon_handle)
コード例 #2
0
def build_radio(client):
    stations = radio.make_structure(client)
    dashboard = radio.make_dashboard(client)
    elements = [build_item_radio_station("dashboard", key, dashboard[key]) for key in dashboard.keys()]
    elements += [build_item_radio_type(key) for key in stations.keys()]

    xbmcplugin.addDirectoryItems(addon_handle, elements, len(elements))
    xbmcplugin.endOfDirectory(addon_handle)
コード例 #3
0
    station_key_ = sys.argv[3]

    # get stations info
    auth, client = check_login(settings)

    # init playlist
    pl = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
    pl.clear()

    # init player
    player = MyPlayer()

    if type_ == "custom":
        player.start("%s:%s" % (radio_type_, station_key_), radio_type_)
    else:
        stations = radio.make_structure(client)
        stations["dashboard"] = radio.make_dashboard(client)
        station = stations[radio_type_][station_key_]
        player.start(station.getId(), station.source.station.id_for_from)

    while not monitor.abortRequested():
        player.check()
        if not player.valid:
            break
        # Sleep/wait for abort for 10 seconds
        if monitor.waitForAbort(10):
            # Abort was requested while waiting. We should exit
            break

    log("Stopped")
    del monitor