Exemple #1
0
            'url':
            plugin.get_url(action='play', id=id, slug=slug, number=number),
            'is_playable':
            True,
            'art': {
                'thumb': image,
                'icon': image,
            },
        })

    return episodes_list


@plugin.action()
def play(params):
    try:
        url = punch.get_playable_url({
            "id": params.id,
            "slug": params.slug,
            "number": params.number
        })
    except LoginError as e:
        xbmc.executebuiltin('Notification(%s, %s, %d)' %
                            ("Error", e.value, 5000))

    return url


if __name__ == '__main__':
    plugin.run()  # Start plugin
    page = int(params.get("page", 1))
    channel = params.get("channel")
    if not channel:
        channel = get_channel()
    if not channel:
        return
    query = params.get("query")
    if not query:
        dialog = xbmcgui.Dialog()
        query = dialog.input(_("Search term"))
        query = py2_decode(query)
    if not query:
        return
    save_query(query, channel)
    list_videos("search_channel", page, query=query, channel=channel)


@plugin.action()
def play(params):
    li = xbmcgui.ListItem(path=params.url)
    if SUBTITLE:
        subtitle_file = os.path.join(addon.profile_dir, "subtitle.srt")
        subtitle_downloaded = download_subtitle(params.subtitle, subtitle_file)
        if subtitle_downloaded:
            li.setSubtitles([subtitle_file])
    xbmcplugin.setResolvedUrl(plugin.handle, True, li)


if __name__ == '__main__':
    plugin.run()