当前位置: 首页>>代码示例>>Python>>正文


Python Plugin.set_content方法代码示例

本文整理汇总了Python中xbmcswift2.Plugin.set_content方法的典型用法代码示例。如果您正苦于以下问题:Python Plugin.set_content方法的具体用法?Python Plugin.set_content怎么用?Python Plugin.set_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xbmcswift2.Plugin的用法示例。


在下文中一共展示了Plugin.set_content方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: len

# 需要导入模块: from xbmcswift2 import Plugin [as 别名]
# 或者: from xbmcswift2.Plugin import set_content [as 别名]
        vitem.set_info(type='video', info_labels={'Title': url})
        vitem.add_stream_info(stream_type='video', stream_values={})
        plugin.set_resolved_url(resolved)
        return plugin.play_video(vitem)
    except:
        plugin.notify(msg="Failed to resolve {0} to a playable video.".format(url))
    try:
        if resolved is None or len(resolved) < 5:
            import YoutubeDLWrapper
            ytdl = YoutubeDLWrapper._getYTDL()
            ytdl.clearDownloadParams()
            resolved = ytdl.extract_info(url, download=False)
            vitem = ListItem(label=url, path=resolved)
            vitem.is_folder = False
            vitem.set_is_playable = True
            vitem.set_info(type='video', info_labels={'Title': url})
            vitem.add_stream_info(stream_type='video', stream_values={})
            plugin.set_resolved_url(resolved)
            return plugin.play_video(vitem)
    except:
        plugin.notify(msg="Failed to resolve {0} to a playable video.".format(url))
    return None

if __name__ == '__main__':
    plugin.run()
    mode = int(plugin.get_setting(key='viewmode'))
    if mode is not None and mode >= 0:
        VIEWMODE = mode
    plugin.set_view_mode(view_mode_id=VIEWMODE)
    plugin.set_content('movies')
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:32,代码来源:addon.py

示例2: len

# 需要导入模块: from xbmcswift2 import Plugin [as 别名]
# 或者: from xbmcswift2.Plugin import set_content [as 别名]
    except:
        plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)

    if len(resolved) > 1:
        plugin.set_resolved_url(resolved)
        item = ListItem.from_dict(path=resolved)
        return item
    else:
        plugin.set_resolved_url(url) #url)
        #plugurl = 'plugin://plugin.video.live.streamspro/?url={0}'.format(urllib.quote_plus(url))
        #item = ListItem.from_dict(path=plugurl)
        #item.add_stream_info('video', stream_values={})
        #item.set_is_playable(True)
        #plugin.notify(msg="RESOLVE FAIL: {0}".format(url.split('.', 1)[-1]),title="Trying {0}".format(item.path.split('.', 1)[-1]), delay=2000)
        return None


if __name__ == '__main__':
    hostname = ''
    hostname = plugin.get_setting('setHostname')
    if len(hostname) > 1:
        hostname = hostname.strip()
        hostname = hostname.strip('/')
        if str(hostname).startswith('http'):
            __BASEURL__ = hostname
        else:
            __BASEURL__ = 'https://' + hostname
    plugin.run()
    plugin.set_content('episodes')
    plugin.set_view_mode(0)
开发者ID:moedje,项目名称:kodi-repo-gaymods,代码行数:32,代码来源:old_addon.py

示例3: show_search_results

# 需要导入模块: from xbmcswift2 import Plugin [as 别名]
# 或者: from xbmcswift2.Plugin import set_content [as 别名]
def show_search_results(query, index='1'):
    return api.search_items(query, index)


@plugin.route('/favorites')
def show_favorites():
    return api.get_favorites()


@plugin.route('/favorites/add/<title>/<station_id>')
def add_to_favorites(title, station_id):
    if api.add_favorite(title, station_id):
        plugin.notify(plugin.get_string(30122).encode('utf-8'))
    else:
        plugin.notify(plugin.get_string(30124).encode('utf-8'))


@plugin.route('/favorites/remove/<station_id>')
def remove_from_favorites(station_id):
    removed = api.remove_favorite(station_id)
    plugin.redirect(plugin.url_for('index'))
    if removed:
        plugin.notify(plugin.get_string(30123).encode('utf-8'))


if __name__ == '__main__':
    plugin.run()
    plugin.set_content('songs')
    # cache = plugin.get_storage('favorites')
    # cache.clear()
开发者ID:gedisony,项目名称:repo-plugins,代码行数:32,代码来源:addon.py


注:本文中的xbmcswift2.Plugin.set_content方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。