subtitle.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:service.subtitles.brokensubs 作者: iamninja 项目源码 文件源码
def append_subtitle(subname, lang_name, language, params, sync=False, h_impaired=False):
    """Add the subtitle to the list of subtitles to show"""
    listitem = xbmcgui.ListItem(
        # Languange name to display under the lang logo (for example english)
        label=lang_name,
        # Subtitle name (for example 'Lost 1x01 720p')
        label2=subname,
        # Languange 2 letter name (for example en)
        thumbnailImage=xbmc.convertLanguage(language, xbmc.ISO_639_1))

    # Subtitles synced with the video
    listitem.setProperty("sync", 'true' if sync else 'false')
    # Hearing impaired subs
    listitem.setProperty("hearing_imp", 'true' if h_impaired else 'false')

    # Create the url to the plugin that will handle the subtitle download
    url = "plugin://{url}/?{params}".format(
        url=SCRIPT_ID, params=urllib.urlencode(params))
    # Add the subtitle to the list
    xbmcplugin.addDirectoryItem(
        handle=HANDLE, url=url, listitem=listitem, isFolder=False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号