2017-03-10, 17:41
Introduction
Sublib is a KODI / XBMC library that significantly reduces the effort on developing subtitle addons, it has built in features for
- Automatic parsing of media information
- Automatic parsing of filename information
- Automatic navigation for kodi call
- Ability to use subtitles in archives (zip/rar)
- Automatically match media with the packed subtitles using regexes
- It has an internal archive browser if no match is possible, and lets the user select the file inside the archive. (This is different than dialog.browse().)
- Automatically priotrize the subtitles according to users language settings.
- Allows the service also to priotrize its own matching
- Automatic integration for, listitem language icons, cc, and sync infolabels
- It is written in OOP fashion an expects sublib.service to be inherited.
[13.03.2017 UPDATE]
- Allow for iso639-2, -3 languages, those languages will be on the list regardless KODI settings, since kodi does not support the selection of them (ie: hawaian)
[20.03.2017 UPDATE]
- Fix for HTMLParser module throws exception on narrow python builds on unescape method
- Finetune string parser
Quickstart
To use it in your subtitle addon first you have make it depend on script.module.sublib. Then you have to write your own service in total composed from 2 methods as show in below simple example.
to see it in action simply initialize your class in the module that your "lib" attribute points in your addon.xml
Thats all.
You can see api documentation on
https://github.com/hbiyik/script.module.sublib
Sublib is a KODI / XBMC library that significantly reduces the effort on developing subtitle addons, it has built in features for
- Automatic parsing of media information
- Automatic parsing of filename information
- Automatic navigation for kodi call
- Ability to use subtitles in archives (zip/rar)
- Automatically match media with the packed subtitles using regexes
- It has an internal archive browser if no match is possible, and lets the user select the file inside the archive. (This is different than dialog.browse().)
- Automatically priotrize the subtitles according to users language settings.
- Allows the service also to priotrize its own matching
- Automatic integration for, listitem language icons, cc, and sync infolabels
- It is written in OOP fashion an expects sublib.service to be inherited.
[13.03.2017 UPDATE]
- Allow for iso639-2, -3 languages, those languages will be on the list regardless KODI settings, since kodi does not support the selection of them (ie: hawaian)
[20.03.2017 UPDATE]
- Fix for HTMLParser module throws exception on narrow python builds on unescape method
- Finetune string parser
Quickstart
To use it in your subtitle addon first you have make it depend on script.module.sublib. Then you have to write your own service in total composed from 2 methods as show in below simple example.
PHP Code:
import sublib
import os
class mysubtitlesite(sublib.service):
def search(self):
print self.item
sub = self.sub("Test Subtitle", "en")
sub.download("http://a.com/b/c.srt")
self.addsub(sub)
def download(self, link)
fname = os.path.join(self.path, "test.srt")
with open(fname, "w") as f:
f.write(self.download(link))
self.addfile(fname)
PHP Code:
import myservice
myservice.mysubtitlesite()
You can see api documentation on
https://github.com/hbiyik/script.module.sublib