Esempio n. 1
0
def list_shows_stations_shows(stationId, page, label):
    xbmcplugin.setPluginCategory(_handle, label)
    page = int(page)
    page_size = int(addon.getSetting("page_size"))
    station = get_station_from_stationId(stationId)
    data = call_api(url="https://api.mujrozhlas.cz/stations/" + stationId +
                    "/shows?page[limit]=" + str(page_size) + "&page[offset]=" +
                    str((page - 1) * page_size))
    if "err" in data:
        xbmcgui.Dialog().notification("ČRo", "Problém při získání pořadů",
                                      xbmcgui.NOTIFICATION_ERROR, 4000)
        sys.exit()
    if "data" in data and len(data["data"]) > 0:
        items_count = int(data["meta"]["count"])
        for show in data["data"]:
            cast = []
            list_item = xbmcgui.ListItem(label=show["attributes"]["title"])
            list_item.setArt({
                "thumb": show["attributes"]["asset"]["url"],
                "icon": show["attributes"]["asset"]["url"]
            })
            list_item.setInfo(
                "video", {
                    "title": show["attributes"]["title"],
                    "director":
                    [show["attributes"]["asset"]["credit"]["author"]],
                    "plot": show["attributes"]["description"],
                    "studio": station
                })
            if "participants" in show["relationships"] and len(
                    show["relationships"]["participants"]["data"]) > 0:
                for person in show["relationships"]["participants"]["data"]:
                    cast.append(get_person(person["id"]))
                list_item.setInfo("video", {"cast": cast})
            url = get_url(action='list_show',
                          showId=show["id"],
                          page=1,
                          label=encode(show["attributes"]["title"]))
            menus = [
                ("Přidat k oblíbeným pořadům",
                 "RunPlugin(plugin://plugin.audio.cro?action=add_favourites&showId="
                 + str(show["id"]) + "&others=0)"),
                ("Přidat k ostatním obl. pořadům",
                 "RunPlugin(plugin://plugin.audio.cro?action=add_favourites&showId="
                 + str(show["id"]) + "&others=1)")
            ]
            list_item.addContextMenuItems(menus)
            xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
        if page * page_size <= items_count:
            list_item = xbmcgui.ListItem(label="Následující strana")
            url = get_url(action='list_shows_stations_shows',
                          stationId=stationId,
                          page=page + 1,
                          label=label)
            xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
        xbmcplugin.endOfDirectory(_handle)
    else:
        xbmcgui.Dialog().notification("ČRo", "Nenalezen žádný pořad",
                                      xbmcgui.NOTIFICATION_WARNING, 4000)
        sys.exit()
Esempio n. 2
0
def list_topics(label):
    xbmcplugin.setPluginCategory(_handle, label)
    data = call_api(url="https://api.mujrozhlas.cz/topics")
    if "err" in data:
        xbmcgui.Dialog().notification("ČRo",
                                      "Problém při získání seznamu témat",
                                      xbmcgui.NOTIFICATION_ERROR, 4000)
        sys.exit()
    if "data" in data and len(data["data"]) > 0:
        for topic in data["data"]:
            if "attributes" in topic and "title" in topic[
                    "attributes"] and len(topic["attributes"]["title"]) > 0:
                topicId = topic["id"]
                list_item = xbmcgui.ListItem(
                    label=topic["attributes"]["title"])
                url = get_url(action='list_topic',
                              topicId=topicId,
                              label=label + " / " +
                              encode(topic["attributes"]["title"]))
                list_item.setArt({
                    "thumb": topic["attributes"]["asset"]["url"],
                    "icon": topic["attributes"]["asset"]["url"]
                })
                xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
        xbmcplugin.endOfDirectory(_handle)
    else:
        xbmcgui.Dialog().notification("ČRo",
                                      "Problém při získání seznamu témat",
                                      xbmcgui.NOTIFICATION_ERROR, 4000)
        sys.exit()
Esempio n. 3
0
def do_search(query, label):
    xbmcplugin.setPluginCategory(_handle, label)
    if query == "-----":
        input = xbmc.Keyboard("", "Hledat")
        input.doModal()
        if not input.isConfirmed():
            return
        query = input.getText()
        if len(query) == 0:
            xbmcgui.Dialog().notification(
                "ČRo", "Je potřeba zadat vyhledávaný řetězec",
                xbmcgui.NOTIFICATION_ERROR, 4000)
            return
        else:
            save_search_history(query)
    shows = {}
    shows_ordered = {}

    shows, shows_ordered = search_episodes(shows, shows_ordered, "title",
                                           query)
    #shows, shows_ordered = search_episodes(shows, shows_ordered, "description", query)
    shows, shows_ordered = search_shows(shows, shows_ordered, "title", query)
    #shows, shows_ordered = search_shows(shows, shows_ordered, "description", query)

    if len(shows) > 0:
        for key in sorted(shows_ordered, key=shows.get('id')):
            show = shows[key]
            list_item = xbmcgui.ListItem(label=show["title"])
            list_item.setArt({"thumb": show["img"], "icon": show["img"]})
            list_item.setInfo(
                "video", {
                    "title": show["title"],
                    "director": [show["director"]],
                    "plot": show["description"],
                    "studio": show["station"]
                })
            if len(show["cast"]) > 0:
                list_item.setInfo("video", {"cast": show["cast"]})
            menus = [
                ("Přidat k oblíbeným pořadům",
                 "RunPlugin(plugin://plugin.audio.cro?action=add_favourites&showId="
                 + str(show["id"]) + "&others=0)"),
                ("Přidat k ostatním obl. pořadům",
                 "RunPlugin(plugin://plugin.audio.cro?action=add_favourites&showId="
                 + str(show["id"]) + "&others=1)")
            ]
            list_item.addContextMenuItems(menus)
            url = get_url(action='list_show',
                          showId=show["id"],
                          page=1,
                          label=encode(show["title"]))
            xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
    else:
        xbmcgui.Dialog().notification("ČRo", "Nic nebylo nalezeno",
                                      xbmcgui.NOTIFICATION_WARNING, 4000)
    xbmcplugin.endOfDirectory(_handle)
Esempio n. 4
0
def list_shows_stations(label):
    xbmcplugin.setPluginCategory(_handle, label)
    stations, stations_nums = get_stations(filtered=1)
    for num in sorted(stations_nums.keys()):
        list_item = xbmcgui.ListItem(
            label=stations[stations_nums[num]]["title"])
        url = get_url(action='list_shows_stations_shows',
                      stationId=stations[stations_nums[num]]["id"],
                      page=1,
                      label=encode(stations[stations_nums[num]]["title"]))
        list_item.setArt({
            "thumb": stations[stations_nums[num]]["img"],
            "icon": stations[stations_nums[num]]["img"]
        })
        xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
    xbmcplugin.endOfDirectory(_handle)
Esempio n. 5
0
def list_show(showId, page, label, mark_new = 0):
    page = int(page)
    page_size = int(addon.getSetting("page_size"))
    show = get_show(showId)
    xbmcplugin.setPluginCategory(_handle, label)    
    data = call_api(url = "https://api.mujrozhlas.cz/shows/" + showId + "/episodes?sort=-since&page[limit]=" + str(page_size) + "&page[offset]=" + str((page-1)*page_size))
    if "err" in data:
        xbmcgui.Dialog().notification("ČRo","Problém při získání pořadů", xbmcgui.NOTIFICATION_ERROR, 4000)
        sys.exit()
    if "data" in data and len(data["data"]) > 0:
        items_count = int(data["meta"]["count"])
        for episode in data["data"]:
            if "attributes" in episode and "title" in episode["attributes"] and len(episode["attributes"]["title"]) > 0:
                starttime =  parse_date(episode["attributes"]["since"])
                if "mirroredSerial" in episode["attributes"] and "totalParts" in episode["attributes"]["mirroredSerial"] and "part" in episode["attributes"]:
                    parts =  " (" + str(episode["attributes"]["part"]) + "/" + str(episode["attributes"]["mirroredSerial"]["totalParts"]) + ") "
                else:
                    parts = ""      
                title = episode["attributes"]["title"] + parts + " (" + starttime.strftime("%d.%m.%Y %H:%M") + ")"
                from libs.favourites import get_listened
                link = episode["attributes"]["audioLinks"][0]["url"]
                if int(mark_new) == 1 and not get_listened(episode["id"]):
                    list_item = xbmcgui.ListItem(label="* " + title)
                else:
                    list_item = xbmcgui.ListItem(label=title)                    
                list_item.setArt({ "thumb" : show["img"], "icon" : show["img"] })
                list_item.setInfo( "video", { "tvshowtitle" : show["title"], "title" : title, "aired" : starttime.strftime("%Y-%m-%d"), "director" : [show["director"]] , "plot" : show["description"], "studio" : show["station"] })
                if len(show["cast"]) > 0:
                    list_item.setInfo( "video", { "cast" : show["cast"] })                
                list_item.setProperty("IsPlayable", "true")
                list_item.setContentLookup(False)
                url = get_url(action='play', url = encode(link), showId = showId, episodeId = episode["id"], title = encode(title), img = show["img"])  
                if PY2:
                    xbmcplugin.addDirectoryItem(_handle, url, list_item, False)
                else:
                    xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
        if page * page_size <= items_count:
            list_item = xbmcgui.ListItem(label="Následující strana")
            url = get_url(action='list_show', showId =  showId, page = page + 1, label = label, mark_new = mark_new)  
            xbmcplugin.addDirectoryItem(_handle, url, list_item, True)

        xbmcplugin.endOfDirectory(_handle, cacheToDisc = False)
    else:
        xbmcgui.Dialog().notification("ČRo","Problém při získání pořadů", xbmcgui.NOTIFICATION_ERROR, 4000)
        sys.exit()
Esempio n. 6
0
def list_program(label):
    now = datetime.now()
    startDoW = now - timedelta(days=now.weekday())
    endDoW = startDoW + timedelta(days=6)
    xbmcplugin.setPluginCategory(_handle, label)
    stations, stations_nums = get_stations(filtered=1)
    for num in sorted(stations_nums.keys()):
        list_item = xbmcgui.ListItem(
            label=stations[stations_nums[num]]["title"])
        url = get_url(action='list_program_week',
                      stationId=stations[stations_nums[num]]["id"],
                      startdate=startDoW.strftime("%d.%m.%Y"),
                      enddate=endDoW.strftime("%d.%m.%Y"),
                      label=encode(stations[stations_nums[num]]["title"]))
        list_item.setArt({
            "thumb": stations[stations_nums[num]]["img"],
            "icon": stations[stations_nums[num]]["img"]
        })
        xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
    xbmcplugin.endOfDirectory(_handle)
Esempio n. 7
0
def list_live(label):
    xbmcplugin.setPluginCategory(_handle, label)
    stations, stations_nums = get_stations(filtered=1)
    schedule = get_current_schedule()
    urls = get_urls()
    for num in sorted(stations_nums.keys()):
        info = {}
        if stations[stations_nums[num]]["id"] in urls:
            if stations[stations_nums[num]]["id"] in schedule:
                title = stations[
                    stations_nums[num]]["title"] + " - " + schedule[stations[
                        stations_nums[num]]["id"]]["show"] + " (" + schedule[
                            stations[stations_nums[num]]
                            ["id"]]["start"] + " - " + schedule[stations[
                                stations_nums[num]]["id"]]["end"] + ")"
                info = {
                    "title":
                    schedule[stations[stations_nums[num]]["id"]]["show"],
                    "plot":
                    schedule[stations[stations_nums[num]]["id"]]["title"]
                }
            else:
                title = stations[stations_nums[num]]["title"]
            list_item = xbmcgui.ListItem(label=title)
            if "img" in stations[stations_nums[num]] and len(
                    stations[stations_nums[num]]["img"]) > 0:
                img = stations[stations_nums[num]]["img"]
                list_item.setArt({"thumb": img, "icon": img})
            else:
                img = "xxx"
            url = get_url(action='play_live',
                          url=urls[stations[stations_nums[num]]["id"]],
                          title=encode(title),
                          img=img)

            if len(info) > 0:
                list_item.setInfo("music", info)
            xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
    xbmcplugin.endOfDirectory(_handle)
def list_favourites(label, others=0):
    xbmcplugin.setPluginCategory(_handle, label)
    favourites = get_favourites(int(others))
    favourites_ordered = {}

    for key in favourites:
        favourites_ordered.update({key: favourites[key]["title"]})
    for showId in sorted(favourites_ordered, key=favourites_ordered.get):
        show = favourites[showId]
        if addon.getSetting(
                "hide_unlistened_favourites") == "false" and others == 0:
            unlistened = get_unlistened_count(showId)
            if unlistened > 0:
                list_item = xbmcgui.ListItem(label=show["title"] + " (" +
                                             str(unlistened) +
                                             decode(" nových)"))
            elif unlistened == 0:
                list_item = xbmcgui.ListItem(label=show["title"])
            else:
                list_item = xbmcgui.ListItem(label=show["title"] +
                                             ' (nenalezený pořad)')
        else:
            list_item = xbmcgui.ListItem(label=show["title"])
        list_item.setArt({"thumb": show["img"], "icon": show["img"]})
        list_item.setInfo(
            "video", {
                "title": show["title"],
                "director": [show["director"]],
                "plot": show["description"],
                "studio": show["station"]
            })
        if len(show["cast"]) > 0:
            list_item.setInfo("video", {"cast": show["cast"]})

        menus = [(
            "Odstranit z oblíbených",
            "RunPlugin(plugin://plugin.audio.cro?action=delete_favourites&showId="
            + str(show["id"]) + ")")]
        if others == 0:
            menus.append((
                "Přesunout do ostatních",
                "RunPlugin(plugin://plugin.audio.cro?action=set_others&showId="
                + str(show["id"]) + "&val=1" + ")"))
        else:
            menus.append((
                "Přesunout z ostatních",
                "RunPlugin(plugin://plugin.audio.cro?action=set_others&showId="
                + str(show["id"]) + "&val=0" + ")"))
        if addon.getSetting(
                "hide_unlistened_favourites") == "false" and others == 0:
            menus.append((
                "Označit epizody jako poslechnuté",
                "RunPlugin(plugin://plugin.audio.cro?action=set_listened_all&showId="
                + str(show["id"]) + ")"))
        list_item.addContextMenuItems(menus)
        if addon.getSetting(
                "hide_unlistened_favourites") == "false" and others == 0:
            url = get_url(action='list_show',
                          showId=show["id"],
                          page=1,
                          label=encode(show["title"]),
                          mark_new=1)
        else:
            url = get_url(action='list_show',
                          showId=show["id"],
                          page=1,
                          label=encode(show["title"]),
                          mark_new=0)
        list_item.setContentLookup(False)
        xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
    xbmcplugin.endOfDirectory(_handle, cacheToDisc=False)
def list_favourites_new(label):
    items = int(addon.getSetting("favourites_new_count"))
    xbmcplugin.setPluginCategory(_handle, label)
    favourites = get_favourites(others=0)
    episodes = {}
    episodes_ordered = {}
    for showId in favourites:
        show = favourites[showId]
        data = call_api(url="https://api.mujrozhlas.cz/shows/" + showId +
                        "/episodes?sort=-since&page[limit]=" + str(items))
        if "err" in data:
            xbmcgui.Dialog().notification(
                "ČRo", "Pořad " + show["title"] + " nebyl nalezený",
                xbmcgui.NOTIFICATION_ERROR, 4000)
            # sys.exit()
        if "data" in data and len(data["data"]) > 0:
            for episode in data["data"]:
                if "attributes" in episode and "title" in episode[
                        "attributes"] and len(
                            episode["attributes"]["title"]) > 0:
                    starttime = parse_date(episode["attributes"]["since"])
                    starttime_ts = time.mktime(starttime.timetuple())
                    episodes_ordered.update({episode["id"]: starttime_ts})
                    if "mirroredSerial" in episode[
                            "attributes"] and "totalParts" in episode[
                                "attributes"][
                                    "mirroredSerial"] and "part" in episode[
                                        "attributes"]:
                        parts = " (" + str(
                            episode["attributes"]["part"]) + "/" + str(
                                episode["attributes"]["mirroredSerial"]
                                ["totalParts"]) + ") "
                    else:
                        parts = ""
                    title = episode["attributes"][
                        "title"] + parts + " (" + starttime.strftime(
                            "%d.%m.%Y %H:%M") + ")"
                    link = episode["attributes"]["audioLinks"][0]["url"]
                    episodes.update({
                        episode["id"]: {
                            "showId": showId,
                            "link": link,
                            "img": show["img"],
                            "tvshowtitle": show["title"],
                            "title": title,
                            "aired": starttime.strftime("%Y-%m-%d"),
                            "director": [show["director"]],
                            "plot": show["description"],
                            "studio": show["station"]
                        }
                    })

    if len(episodes) > 0:
        for key in sorted(episodes_ordered,
                          key=episodes_ordered.get,
                          reverse=True):
            list_item = xbmcgui.ListItem(label=episodes[key]["title"])
            list_item.setArt({
                "thumb": episodes[key]["img"],
                "icon": episodes[key]["img"]
            })
            list_item.setInfo(
                "video", {
                    "tvshowtitle": episodes[key]["tvshowtitle"],
                    "title": episodes[key]["title"],
                    "aired": episodes[key]["aired"],
                    "director": episodes[key]["director"],
                    "plot": episodes[key]["plot"],
                    "studio": episodes[key]["studio"]
                })
            list_item.setProperty("IsPlayable", "true")
            list_item.setContentLookup(False)
            url = get_url(action='play',
                          url=encode(episodes[key]["link"]),
                          showId=episodes[key]["showId"],
                          episodeId=key,
                          title=encode(episodes[key]["title"]),
                          img=episodes[key]["img"])
            if PY2:
                xbmcplugin.addDirectoryItem(_handle, url, list_item, False)
            else:
                xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
    xbmcplugin.endOfDirectory(_handle)
Esempio n. 10
0
def list_topic(topicId, label):
    xbmcplugin.setPluginCategory(_handle, label)
    data = call_api(url="https://api.mujrozhlas.cz/topics/" + topicId +
                    "/episodes?page[limit]=100")
    if "err" in data:
        xbmcgui.Dialog().notification("ČRo", "Problém při získání pořadů",
                                      xbmcgui.NOTIFICATION_ERROR, 4000)
        sys.exit()
    if "data" in data and len(data["data"]) > 0:
        widgets = get_widgets(topicId)
        for widget in widgets:
            list_item = xbmcgui.ListItem(label=widget)
            list_item.setProperty("IsPlayable", "false")
            url = get_url(action='list_topic_recommended',
                          topicId=topicId,
                          filtr=encode(widget),
                          label=label + " / " + encode(widget))
            xbmcplugin.addDirectoryItem(_handle, url, list_item, True)

        shows = {}
        shows_added = []
        for episode in data["data"]:
            if "attributes" in episode and "title" in episode[
                    "attributes"] and len(episode["attributes"]["title"]) > 0:
                if episode["relationships"]["show"]["data"][
                        "id"] not in shows_added:
                    show = get_show(
                        episode["relationships"]["show"]["data"]["id"])
                    shows.update({show["title"]: show})
                    shows_added.append(show["id"])
        for key in sorted(shows.keys()):
            show = shows[key]
            list_item = xbmcgui.ListItem(label=show["title"])
            list_item.setArt({"thumb": show["img"], "icon": show["img"]})
            list_item.setInfo(
                "video", {
                    "title": show["title"],
                    "director": [show["director"]],
                    "plot": show["description"],
                    "studio": show["station"]
                })
            if len(show["cast"]) > 0:
                list_item.setInfo("video", {"cast": show["cast"]})
            menus = [
                ("Přidat k oblíbeným pořadům",
                 "RunPlugin(plugin://plugin.audio.cro?action=add_favourites&showId="
                 + str(show["id"]) + "&others=0)"),
                ("Přidat k ostatním obl. pořadům",
                 "RunPlugin(plugin://plugin.audio.cro?action=add_favourites&showId="
                 + str(show["id"]) + "&others=1)")
            ]
            list_item.addContextMenuItems(menus)
            url = get_url(action='list_show',
                          showId=show["id"],
                          page=1,
                          label=encode(show["title"]))
            list_item.setContentLookup(False)
            xbmcplugin.addDirectoryItem(_handle, url, list_item, True)
        xbmcplugin.endOfDirectory(_handle)
    else:
        xbmcgui.Dialog().notification("ČRo", "Problém při získání pořadů",
                                      xbmcgui.NOTIFICATION_ERROR, 4000)
        sys.exit()
Esempio n. 11
0
def list_topic_recommended(topicId, filtr, label):
    xbmcplugin.setPluginCategory(_handle, label)
    data = call_api(url="https://api.mujrozhlas.cz/topics/" + topicId)
    if "err" in data:
        xbmcgui.Dialog().notification("ČRo", "Problém při získání pořadů",
                                      xbmcgui.NOTIFICATION_ERROR, 4000)
        sys.exit()
    if "data" in data and len(data["data"]) > 0 and "attributes" in data[
            "data"] and "widgets" in data["data"]["attributes"]:
        for widget in data["data"]["attributes"]["widgets"]:
            if "attributes" in widget and "title" in widget[
                    "attributes"] and encode(
                        widget["attributes"]["title"]) == filtr:
                if "items" in widget["attributes"]:
                    items = widget["attributes"]["items"]
                elif "entities" in widget["attributes"]:
                    items = widget["attributes"]["entities"]
                for item in items:
                    if "entity" in item and "type" in item["entity"]:
                        if item["entity"]["type"] == "show":
                            show = get_show(item["entity"]["id"])
                            list_item = xbmcgui.ListItem(label=show["title"])
                            list_item.setArt({
                                "thumb": show["img"],
                                "icon": show["img"]
                            })
                            list_item.setInfo(
                                "video", {
                                    "title": show["title"],
                                    "director": [show["director"]],
                                    "plot": show["description"],
                                    "studio": show["station"]
                                })
                            if len(show["cast"]) > 0:
                                list_item.setInfo("video",
                                                  {"cast": show["cast"]})
                            menus = [
                                ("Přidat k oblíbeným pořadům",
                                 "RunPlugin(plugin://plugin.audio.cro?action=add_favourites&showId="
                                 + str(show["id"]) + "&others=0)"),
                                ("Přidat k ostatním obl. pořadům",
                                 "RunPlugin(plugin://plugin.audio.cro?action=add_favourites&showId="
                                 + str(show["id"]) + "&others=1)")
                            ]
                            list_item.addContextMenuItems(menus)
                            url = get_url(action='list_show',
                                          showId=show["id"],
                                          page=1,
                                          label=encode(show["title"]))
                            xbmcplugin.addDirectoryItem(
                                _handle, url, list_item, True)
                        if item["entity"]["type"] == "episode":
                            show = get_show(item["entity"]["relationships"]
                                            ["show"]["data"]["id"])
                            starttime = parse_date(
                                item["entity"]["attributes"]["since"])
                            title = item["entity"]["attributes"][
                                "mirroredShow"]["title"] + " - " + item[
                                    "entity"]["attributes"][
                                        "title"] + " (" + starttime.strftime(
                                            "%d.%m.%Y %H:%M") + ")"
                            list_item = xbmcgui.ListItem(label=title)
                            url = item["entity"]["attributes"]["audioLinks"][
                                0]["url"]
                            list_item.setArt({
                                "thumb": show["img"],
                                "icon": show["img"]
                            })
                            list_item.setInfo(
                                "video", {
                                    "tvshowtitle": show["title"],
                                    "title": title,
                                    "aired": starttime.strftime("%Y-%m-%d"),
                                    "director": [show["director"]],
                                    "plot": show["description"],
                                    "studio": show["station"]
                                })
                            if len(show["cast"]) > 0:
                                list_item.setInfo("video",
                                                  {"cast": show["cast"]})
                            list_item.setProperty("IsPlayable", "true")
                            list_item.setContentLookup(False)
                            url = get_url(action='play',
                                          url=url,
                                          showId=show["id"],
                                          episodeId=item["entity"]["id"],
                                          title=encode(title),
                                          img=show["img"])
                            if PY2:
                                xbmcplugin.addDirectoryItem(
                                    _handle, url, list_item, False)
                            else:
                                xbmcplugin.addDirectoryItem(
                                    _handle, url, list_item, True)
                    if "type" in item and item["type"] == "episode":
                        show = get_show(
                            item["relationships"]["show"]["data"]["id"])
                        starttime = parse_date(item["attributes"]["since"])
                        title = item["attributes"]["mirroredShow"][
                            "title"] + " - " + item["attributes"][
                                "title"] + " (" + starttime.strftime(
                                    "%d.%m.%Y %H:%M") + ")"
                        url = item["attributes"]["audioLinks"][0]["url"]
                        list_item = xbmcgui.ListItem(label=title)
                        list_item.setArt({
                            "thumb": show["img"],
                            "icon": show["img"]
                        })
                        list_item.setInfo(
                            "video", {
                                "tvshowtitle": show["title"],
                                "title": title,
                                "aired": starttime.strftime("%Y-%m-%d"),
                                "director": [show["director"]],
                                "plot": show["description"],
                                "studio": show["station"]
                            })
                        if len(show["cast"]) > 0:
                            list_item.setInfo("video", {"cast": show["cast"]})
                        list_item.setProperty("IsPlayable", "true")
                        list_item.setContentLookup(False)
                        url = get_url(action='play',
                                      url=url,
                                      showId=show["id"],
                                      episodeId=item["id"],
                                      title=encode(title),
                                      img=show["img"])
                        if PY2:
                            xbmcplugin.addDirectoryItem(
                                _handle, url, list_item, False)
                        else:
                            xbmcplugin.addDirectoryItem(
                                _handle, url, list_item, True)
        xbmcplugin.endOfDirectory(_handle)
    else:
        xbmcgui.Dialog().notification("ČRo", "Problém při získání pořadů",
                                      xbmcgui.NOTIFICATION_ERROR, 4000)
        sys.exit()