(2017-06-08, 16:23)ewwink Wrote: yes, you can apply it to any subtitle service, just find the code where .srt will be appended to playlist then convert it.
example:
Code:
from resources.lib.srt2ass import srt2ass
......
for sub in subs:
sub = srt2ass(sub) # convert .srt to .ass
listitem = xbmcgui.ListItem(label=sub)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sub, listitem=listitem, isFolder=False)
Thanks, can confirm it works great with OpenSubtitles plugin in Kodi v18 (Leia) alpha.
For those requesting OpenSubtitles version, you can do this quite easily by e.g. copying (or preferably symlinking)
srt2ass.py from the folder "
service.subtitles.subtitleBackground/resources/lib/" to "
service.subtitles.opensubtitles/" in your Kodi addon folder. Then in the file
service.py in "
service.subtitles.opensubtitles/", find near the end:
python:
elif params['action'] == 'download':
subs = Download(params["ID"], params["link"],params["format"])
for sub in subs:
listitem = xbmcgui.ListItem(label=sub)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=sub,listitem=listitem,isFolder=False)
and change it to
python:
elif params['action'] == 'download':
from srt2ass import srt2ass
subs = Download(params["ID"], params["link"],params["format"])
for sub in subs:
sub = srt2ass(sub) # convert .srt to .ass
listitem = xbmcgui.ListItem(label=sub)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=sub,listitem=listitem,isFolder=False)
Not taking any responsibility for this, this is just what I did a few minutes ago.