I have no experience in python or addon developing but I know a bit java.
What I’m trying to do is to list the srt files of a directory and by select in one of them to add the subtitle to the video or stream is currently playing. Very similar behaviour as “search for subtitle” option in sound/subtitles setting. I’ve managed until now, after a lot of trial and error and searching in wiki and google, to display the list with the srt files. I used the video addon tutorial as base and this is my code so far:
addon = xbmcaddon.Addon()
addonname = addon.getAddonInfo('name')
addon_handle = int(sys.argv[1])
xbmcplugin.setContent(addon_handle, 'videos')
mypath="/media/videos/subs/"
dir = os.listdir(mypath)
listing = []
for files in dir:
if files.endswith(".srt"):
li = xbmcgui.ListItem(files, iconImage='DefaultAddonSubtitles.png')
listing.append((mypath, li))
xbmcplugin.addDirectoryItems(addon_handle, listing, len(listing))
xbmcplugin.endOfDirectory(addon_handle)
How now can I add the subtitle from the list to video which playing?