Load subtitle
#1
Hi
I want to load a external subtitle to a stream but i don't know how.

Code:
def play(finalurl):
        ok=xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(finalurl).setSubtitles(wtpath + '/sub/how.srt')
        addLink('Reiniciar Stream',finalurl,'')

I used setSubtitles but in log it says:

Code:
01:51:15 T:2568   ERROR: Error Type: <type 'exceptions.AttributeError'>
01:51:15 T:2568   ERROR: Error Contents: 'NoneType' object has no attribute 'setSubtitles'

Please help me Smile
Sorry for my bad english. Big Grin
Reply
#2
The error is because the .play() method returns None, you you can't call setSubtitles on that.

You need to do it serial:

PHP Code:
player xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER)
player.play(finalurl)
# maybe loop here and wait for the player started playback
player.setSubtitles(wtpa​th '/sub/how.srt'
My GitHub. My Add-ons:
Image
Reply
#3
would it be better to add the subtitles before you start playback?
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#4
Thank you for your help. It's solved Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Load subtitle 0