[BETA] script.module.sublib – Subtitle library to create subtitle addons easily

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.

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(selflink)
            
fname os.path.join(self.path"test.srt")
            
with open(fname"w") as f:
                
f.write(self.download(link))
            
self.addfile(fname

to see it in action simply initialize your class in the module that your “lib” attribute points in your addon.xml

PHP Code:
import myservice

myservice.mysubtitlesite() 

Thats all.

You can see api documentation on
https://github.com/hbiyik/script.module.sublib

it is quite straight forward and easy. Current i am beta testing to support it , please test planetdp addon and check everything is fine. Currently i am testing on both windows and android device everything seems to be fine since.