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)
评论列表
文章目录