help with my first addon
#1
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:
Code:
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?
Reply
#2
Why do you need an addon for that? There's "Browse for subtitles..." option in Audio Settings dialog that allow you to set arbitrary subtitles for the current video.
Reply
#3
Yes, I know that. Because I would like to have access to a specific folder with one click. And also is a motive to learn about python and addon developing.
Reply
#4
You can use something like:

player = XBMCPlayer()
player.setSubtitles(fileName)

D.
Reply
#5
Thanks, I'll try it.
Reply

Logout Mark Read Team Forum Stats Members Help
help with my first addon0