示例#1
0
    def onSettingsChanged(self):

        if self.run:

            if debugsetting():
                self.run = False
                debug('Debug settings changed')
                setsetting('debugcheck', value=setting('debug'))
                global closedebug
                closedebug = boolsetting('debug')
                debug('Debug initalized')
                if not closedebug:
                    debug('Debug stopped', force=True)

            if OSusersetting():
                self.run = False
                debug('OS User settings changed')
                if OSuser():
                    xbmc.executebuiltin(
                        'Notification("SubLoader", "%s", "%s",)' %
                        (localize(32033), 4000))
                    setsetting('OSusercheck', value=setting('OSuser'))
                    setsetting('OSpasswordcheck', value=setting('OSpassword'))
                    debug('OS Login: successful')
                else:
                    xbmc.executebuiltin(
                        'Notification("SubLoader", "%s", "%s",)' %
                        (localize(32034), 4000))
                    setsetting('OSusercheck', value='nouser')
                    setsetting('OSpasswordcheck', value='nopassword')
                    debug('OS Login: unsuccessful')

        else:
            xbmc.sleep(1000)
            self.run = True
示例#2
0
def wordsexclusion():

	if setting('excludewords'):
		words = setting('excludewords').split(',')
		if all(videopath().find (v) <= -1 for v in words):
			return True
		else:
			debug('Excluded: the video path have excluded words %s' % words)
			return False
	else:
		return True
示例#3
0
def addonexclusion():

	if setting('excludeaddon'):
		exaddon = setting('excludeaddon').split(',')
		if all(videosource().find (v) <= -1 for v in exaddon):
			return True
		else:
			debug('Excluded: the source addon is excluded %s' % exaddon)
			return False
	else:
		return True
示例#4
0
def OSserver():
        user = ""
        password = ""
        ua = "kodi_%s_v%s" % (name().lower(), version())
        if boolsetting('OScustomuser'):
                if setting ('OSuser') != '' or setting('OSpassword') != '':
                        user = setting('OSuser')
                        password = setting('OSpassword')
                else:
                        user = "******"
                        password = "******"
        return OpenSubtitles.LogIn(user, password, 'en', ua)
示例#5
0
def pathexclusion():

	debug('Content path: %s' % videopath())
	if videopath().find("http://") > -1 or videopath().find("https://") > -1:
		debug('Content source: %s' % videosource())

	if not videopath():
		return False

	if (videopath().find("pvr://") > -1) and boolsetting('excludelivetv'):
		debug('Video is playing via Live TV, which is currently set as excluded location.')
		return False

	if (videopath().find("http://") > -1 or videopath().find("https://") > -1) and boolsetting('excludehttp'):
		debug('Video is playing via HTTP or HTTPS source, which is currently set as excluded location.')
		return False

	path = setting('path')
	if path and boolsetting('excludepath'):
		if (videopath().find(path) > -1):
			debug('Video is playing from %s, which is currently set as excluded path 1.' % path)
			return False

	path2 = setting('path2')
	if path2 and boolsetting('excludepath2'):
		if (videopath().find(path2) > -1):
			debug('Video is playing from %s, which is currently set as excluded path 2.' % path2)
			return False

	path3 = setting('path3')
	if path3 and boolsetting('excludepath3'):
		if (videopath().find(path3) > -1):
			debug('Video is playing from %s, which is currently set as excluded path 3.' % path3)
			return False

	path4 = setting('path4')
	if path4 and boolsetting('excludepath4'):
		if (videopath().find(path4) > -1):
			debug('Video is playing from %s, which is currently set as excluded path 4.' % path4)
			return False

	path5 = setting('path5')
	if path5 and boolsetting('excludepath5'):
		if (videopath().find(path5) > -1):
			debug('Video is playing from %s, which is currently set as excluded path 5.' % path5)
			return False

	return True
 def __time(self):
     self.current = 0
     self.time = self.getTotalTime()
     if not int(setting("assume")) == 100:
         while self.isPlaying():
             self.current = self.getTime()
             monitor.waitForAbort(2)
 def onPlayBackStopped(self):
     if self.playing:
         percent = self.current * 100 / self.time
         minimum = float(setting("assume"))
         if minimum <= percent:
             self.playing.ended()
         self.playing = None
示例#8
0
def subexclusion():

	if boolsetting('excludesub'):
		langs = []
		langs.append(utils.langdict[setting('excludesublang1')])
		if not setting('excludesublang2') == "-----":
			langs.append(utils.langdict[setting('excludesublang2')])
		if not setting('excludesublang3') == "-----":
			langs.append(utils.langdict[setting('excludesublang3')])
		availablesubs = xbmc.Player().getAvailableSubtitleStreams()
		debug('Available sub languages: %s' % availablesubs)
		availablesubs = " ".join(availablesubs)
		if any(x in availablesubs for x in langs):
			debug('Subtitle is already present')
			return False
		return True
	return True
示例#9
0
    def onAVStarted(self):
        self.run = True
        delay = int(setting('delay')) * 1000

        if self.run:
            xbmc.sleep(delay)
            if xbmc.Player().isPlayingVideo() and globalexclusion():
                self.run = False
                if setting('default') == '0':
                    debug('Default: automatic subtitles')
                    loadsub()
                elif setting('default') == '1':
                    debug('Default: opening search dialog')
                    xbmc.executebuiltin('ActivateWindow(SubtitleSearch)')
                else:
                    debug('Default: do nothing...')
            else:
                self.run = False
示例#10
0
def timeexclusion():

	time = xbmc.Player().getTotalTime()
	debug('Total time: %s' % str(datetime.timedelta(seconds=round(time))))
	timeexcluded = int(setting('excludetime'))*60
	if time > timeexcluded:
		return True
	else:
		debug('Excluded: the content time is lower than the exclusion')
		return False
示例#11
0
def audioexclusion():

	if boolsetting('excludeaudio'):
		langs = []
		langs.append(utils.langdict[setting('excludeaudiolang1')])
		if not setting('excludeaudiolang2') == "-----":
			langs.append(utils.langdict[setting('excludeaudiolang2')])
		if not setting('excludeaudiolang3') == "-----":
			langs.append(utils.langdict[setting('excludeaudiolang3')])
		availableaudio = xbmc.Player().getAvailableAudioStreams()
		debug('Available audio streams: %s' % availableaudio)
		availableaudio = " ".join(availableaudio)
		if any(x in availableaudio for x in langs):
			debug('Excluded: the audio language is excluded')
			return False
		if "und" in availableaudio and not boolsetting('audiound'):
			debug('Excluded: undertermined audio')
			return False
		return True
	return True
示例#12
0
    def onAVStarted(self):
        self.run = True
        delay = int(setting('delay')) * 1000

        if self.run:
            xbmc.sleep(delay)
            if xbmc.Player().isPlayingVideo() and globalexclusion():
                self.run = False
                if setting('default') == '0':
                    debug('Default: automatic subtitles')
                    loadsub()


#					xbmc.executebuiltin('XBMC.RunScript(special://home/addons/service.subloader/resources/lib/testes.py)')
                elif setting('default') == '1':
                    debug('Default: opening search dialog')
                    xbmc.executebuiltin('XBMC.ActivateWindow(SubtitleSearch)')
                else:
                    debug('Default: do nothing...')
            else:
                self.run = False
示例#13
0
 def __time(self):
     try:
         self.current = self.getTime()
         self.total_time = self.getTotalTime()
         if not int(setting('assume')) == 100:
             while self.isPlaying():
                 if self.total_time == 0:
                     self.total_time = self.getTotalTime()
                 self.current = self.getTime()
                 if monitor.waitForAbort(5):
                     break
         log("AfterWatchPlayer.__time: self.current=%d, self.total_time=%d"
             % (self.current, self.total_time))
     except Exception:
         if debug.get():
             log(debug.traceback.print_exc(), xbmc.LOGERROR)
示例#14
0
 def onPlayBackStopped(self):
     try:
         if hasattr(self, 'playing') and self.playing:
             minimum = float(setting('assume'))
             if hasattr(self,
                        'total_time') and self.total_time > 0 and hasattr(
                            self, 'current') and self.current > 0:
                 percent = self.current * 100 / self.total_time
             else:
                 percent = 0
             if minimum <= percent:
                 self.playing.ended()
             log("AfterWatchPlayer.onPlayBackStopped: percent=%d, self.total_time=%d, self.current=%d"
                 % (percent, self.total_time, self.current))
     except Exception:
         if debug.get():
             log(debug.traceback.print_exc(), xbmc.LOGERROR)
     finally:
         self.playing = None
def warning(module, count):
	proceed = True
	threshold = int(setting('fm_warn'))
	if count > threshold:
		proceed = xbmcgui.Dialog().yesno(info('name'), lang(30588) % (module, count))
	return proceed
示例#16
0
def OSusersetting():
        if boolsetting('OScustomuser') and (setting('OSuser') != setting('OSusercheck') or setting('OSpassword') != setting('OSpasswordcheck')):
                return True
        return False
def proceed(title, subtitle):
	proceed = True
	if setting('confirm') == 'true':
		proceed = xbmcgui.Dialog().yesno(info('name'), title, lang(30526) % subtitle)
	return proceed
示例#18
0
def loadsub():

    # Common ***************************************************************************************************************************************************************************************************

    try:
        if boolsetting('OScustomuser'):
            if setting('OSuser') != setting('OSusercheck') or setting(
                    'OSpassword') != setting('OSpasswordcheck'):
                xbmc.executebuiltin('Notification("SubLoader", "%s", "%s",)' %
                                    (localize(32034), 4000))
                raise Exception()

        addon = "service.subloader"  #alterar quando estiver tudo ligado
        localize = xbmcaddon.Addon(addon).getLocalizedString
        server = xc.Server('http://api.opensubtitles.org/xml-rpc', verbose=0)
        #               token = server.LogIn('', '', 'en', 'kodi_subloader_v0.1.3')['token']
        media = xbmc.Player().getVideoInfoTag().getMediaType()

        langDict = {
            'Afrikaans': 'afr',
            'Albanian': 'alb',
            'Arabic': 'ara',
            'Armenian': 'arm',
            'Basque': 'baq',
            'Bengali': 'ben',
            'Bosnian': 'bos',
            'Breton': 'bre',
            'Bulgarian': 'bul',
            'Burmese': 'bur',
            'Catalan': 'cat',
            'Chinese': 'chi',
            'Croatian': 'hrv',
            'Czech': 'cze',
            'Danish': 'dan',
            'Dutch': 'dut',
            'English': 'eng',
            'Esperanto': 'epo',
            'Estonian': 'est',
            'Finnish': 'fin',
            'French': 'fre',
            'Galician': 'glg',
            'Georgian': 'geo',
            'German': 'ger',
            'Greek': 'ell',
            'Hebrew': 'heb',
            'Hindi': 'hin',
            'Hungarian': 'hun',
            'Icelandic': 'ice',
            'Indonesian': 'ind',
            'Italian': 'ita',
            'Japanese': 'jpn',
            'Kazakh': 'kaz',
            'Khmer': 'khm',
            'Korean': 'kor',
            'Latvian': 'lav',
            'Lithuanian': 'lit',
            'Luxembourgish': 'ltz',
            'Macedonian': 'mac',
            'Malay': 'may',
            'Malayalam': 'mal',
            'Manipuri': 'mni',
            'Mongolian': 'mon',
            'Montenegrin': 'mne',
            'Norwegian': 'nor',
            'Occitan': 'oci',
            'Persian': 'per',
            'Polish': 'pol',
            'Portuguese': 'por',
            'Portuguese(Brazil)': 'pob',
            'Romanian': 'rum',
            'Russian': 'rus',
            'Serbian': 'scc',
            'Sinhalese': 'sin',
            'Slovak': 'slo',
            'Slovenian': 'slv',
            'Spanish': 'spa',
            'Swahili': 'swa',
            'Swedish': 'swe',
            'Syriac': 'syr',
            'Tagalog': 'tgl',
            'Tamil': 'tam',
            'Telugu': 'tel',
            'Thai': 'tha',
            'Turkish': 'tur',
            'Ukrainian': 'ukr',
            'Urdu': 'urd'
        }

        codePageDict = {
            'ara': 'cp1256',
            'ar': 'cp1256',
            'ell': 'cp1253',
            'el': 'cp1253',
            'heb': 'cp1255',
            'he': 'cp1255',
            'tur': 'cp1254',
            'tr': 'cp1254',
            'rus': 'cp1251',
            'ru': 'cp1251'
        }

        release = [
            'cam', 'camrip', 'telesync', 'ts', 'hdts', 'hc', 'hcrip', 'pdvd',
            'predvdrip', 'telecine', 'tc', 'hdtc', 'ppv', 'ppvrip', 'screener',
            'scr', 'dvdscr', 'dvdcreener', 'bdscr', 'line', 'dvd', 'dvdrip',
            'dvdr', 'dvdmux', 'dvdfull', 'hdtv', 'dsr', 'dsrip', 'satrip',
            'dthrip', 'dvbrip', 'pdtv', 'dtvrip', 'tvrip', 'hdtvrip', 'vod',
            'vodrip', 'vodr', 'webdl', 'webdlrip', 'web', 'hdrip', 'webrip',
            'webr', 'webcap', 'bluray', 'bdrip', 'brip', 'brrip', 'bdmv',
            'divx', 'xvid'
        ]

        secrelease = ['rip', 'dl', 'cap', 'blu', 'ray']

        langs = []

        filter = []

        #***********************************************************************************************************************************************************************************************************

        # Subtitle language ****************************************************************************************************************************************************************************************

        langs.append(langDict[setting('sublang1')])
        if not setting('sublang2') == "-----":
            langs.append(langDict[setting('sublang2')])
        if not setting('sublang3') == "-----":
            langs.append(langDict[setting('sublang3')])

        sublanguageid = ','.join(langs)

        #***********************************************************************************************************************************************************************************************************

        # Get release type *****************************************************************************************************************************************************************************************

        vidPath = (xbmc.Player().getPlayingFile()).lower()
        fmt = re.split('[.:;()[\]{}\\\\/\s\&€\#\=\$\?\!%\+\-_\*[0-9]', vidPath)
        fmt = [i for i in fmt if i in release]
        fmt = list(dict.fromkeys(fmt))
        fmtst = ''.join(fmt)
        fmtflex = ''

        if fmt:
            secvidPath = (vidPath.lower()).split(fmtst)[-1]
        else:
            secvidPath = vidPath

        secfmt = re.split('[.:;()[\]{}\\\\/\s\&€\#\=\$\?\!%\+\-_\*[0-9]',
                          secvidPath)
        secfmt = [i for i in secfmt if i in secrelease]
        secfmt = list(dict.fromkeys(secfmt))
        fmt = fmt + secfmt

        if fmt:
            fmtst = fmtst + (''.join(secfmt))
        else:
            if not setting('anysub') == 'true':
                if setting('notif') == 'true' and setting(
                        'subsearch') == 'true':
                    xbmc.executebuiltin(
                        'Notification("%s", "%s", "%s",)' %
                        (localize(32016), localize(32025), 5000))
                    raise Exception()
                else:
                    if setting('notif') == 'true':
                        xbmc.executebuiltin(
                            'Notification("%s", "%s", "%s",)' %
                            (localize(32026), localize(32025), 5000))
                        raise Exception()
                    else:
                        raise Exception()

        if fmtst == 'cam' or fmtst == 'camrip':
            fmt = ['cam-rip', 'cam.rip', 'cam rip', 'cam', 'camrip']
            fmtflex = [
                'cam-rip', 'cam.rip', 'cam rip', 'cam', 'camrip', 'telesync',
                'ts', 'hdts', 'hc', 'hcrip', 'pdvd', 'predvdrip'
            ]
        if fmtst == 'telesync' or fmtst == 'ts' or fmtst == 'hdts' or fmtst == 'hc' or fmtst == 'hcrip' or fmtst == 'pdvd' or fmtst == 'predvdrip':
            fmt = [
                'telesync', 'ts', 'hdts', 'hc', 'hcrip', 'pdvd', 'predvdrip'
            ]
            fmtflex = [
                'cam-rip', 'cam.rip', 'cam rip', 'cam', 'camrip', 'telesync',
                'ts', 'hdts', 'hc', 'hcrip', 'pdvd', 'predvdrip'
            ]
        if fmtst == 'telecine' or fmtst == 'tc' or fmtst == 'hdtc':
            fmt = ['telecine', 'tc', 'hdtc']
            fmtflex = fmt
        if fmtst == 'ppv' or fmtst == 'ppvrip':
            fmt = ['ppv', 'ppvrip']
            fmtflex = fmt
        if fmtst == 'screener' or fmtst == 'scr' or fmtst == 'dvdscr' or fmtst == 'dvdcreener' or fmtst == 'bdscr':
            fmt = ['screener', 'scr', 'dvdscr', 'dvdcreener', 'bdscr']
            fmtflex = [
                'screener', 'scr', 'dvdscr', 'dvdcreener', 'bdscr', 'dvd',
                'dvd-r', 'dvdrip', 'dvd rip', 'dvdr', 'dvdmux', 'dvdfull',
                'dvd5', 'dvd9', 'dvd-rip', 'dvd.rip', 'dvd-mux', 'dvd.mux',
                'dvd-5', 'dvd-9'
            ]
        if fmtst == 'line':
            fmt = ['r5', 'r5line', 'line', 'r5.line', 'r5-line', 'r5 line']
            fmtflex = fmt
        if fmtst == 'dvd' or fmtst == 'dvdrip' or fmtst == 'dvdr' or fmtst == 'dvdmux' or fmtst == 'dvdfull':
            fmt = [
                'dvd', 'dvd-r', 'dvdrip', 'dvdr', 'dvdmux', 'dvdfull', 'dvd5',
                'dvd9', 'dvd-rip', 'dvd rip', 'dvd.rip', 'dvd-mux', 'dvd.mux',
                'dvd-5', 'dvd-9'
            ]
            fmtflex = [
                'screener', 'scr', 'dvdscr', 'dvdcreener', 'bdscr', 'dvd',
                'dvd-r', 'dvdrip', 'dvd rip', 'dvdr', 'dvdmux', 'dvdfull',
                'dvd5', 'dvd9', 'dvd-rip', 'dvd.rip', 'dvd-mux', 'dvd.mux',
                'dvd-5', 'dvd-9'
            ]
        if fmtst == 'hdtv' or fmtst == 'dsr' or fmtst == 'dsrip' or fmtst == 'satrip' or fmtst == 'dthrip' or fmtst == 'dvbrip' or fmtst == 'pdtv' or fmtst == 'dtvrip' or fmtst == 'tvrip' or fmtst == 'hdtvrip':
            fmt = [
                'hdtv', 'dsr', 'dsrip', 'satrip', 'dthrip', 'dvbrip', 'pdtv',
                'dtvrip', 'tvrip', 'hdtvrip', 'hdtv-rip', 'hdtv.rip',
                'hdtv rip'
            ]
            fmtflex = fmt
        if fmtst == 'vob' or fmtst == 'vodrip' or fmtst == 'vodr':
            fmt = ['vob', 'vodrip', 'vod rip', 'vod.rip', 'vod-rip', 'vodr']
            fmtflex = fmt
        if fmtst == 'webdl' or fmtst == 'webdlrip' or fmtst == 'dl':
            fmt = ['web-dl', 'webdl', 'web.dl', 'web dl', 'webdlrip']
            fmtflex = [
                'web-dl', 'webdl', 'web.dl', 'web dl', 'webdlrip', 'webrip',
                'web-rip', 'web.rip', 'web rip', 'webr', 'web', 'webcap',
                'web-cap', 'web.cap', 'web cap', 'hdrip'
            ]
        if fmtst == 'webrip' or fmtst == 'webr' or fmtst == 'webcap' or fmtst == 'web' or fmtst == 'cap':
            fmt = [
                'webrip', 'web-rip', 'web.rip', 'web rip', 'webr', 'web',
                'webcap', 'web-cap', 'web.cap', 'web cap'
            ]
            fmtflex = [
                'web-dl', 'webdl', 'web.dl', 'web dl', 'webdlrip', 'webrip',
                'web-rip', 'web.rip', 'web rip', 'webr', 'web', 'webcap',
                'web-cap', 'web.cap', 'web cap', 'hdrip'
            ]
        if fmtst == 'bluray' or fmtst == 'blurayrip' or fmtst == 'blu' or fmtst == 'ray':
            fmt = ['blu', 'ray', 'bluray', 'blu-ray', 'blu.ray', 'blu ray']
            fmtflex = [
                'blu', 'ray', 'bluray', 'blu-ray', 'blu.ray', 'blu ray',
                'bdrip', 'bd-rip', 'bd.rip', 'bd rip', 'brrip', 'br-rip',
                'br.rip', 'br rip', 'brip', 'b-rip', 'b.rip', 'b rip', 'bdmv'
            ]
        if fmtst == 'bdrip' or fmtst == 'brip' or fmtst == 'brrip' or fmtst == 'bdmv':
            fmt = [
                'bdrip', 'bd-rip', 'bd.rip', 'bd rip', 'brrip', 'br-rip',
                'br.rip', 'br rip', 'brip', 'b-rip', 'b.rip', 'b rip', 'bdmv'
            ]
            fmtflex = [
                'blu', 'ray', 'bluray', 'blu-ray', 'blu.ray', 'blu ray',
                'bdrip', 'bd-rip', 'bd.rip', 'bd rip', 'brrip', 'br-rip',
                'br.rip', 'br rip', 'brip', 'b-rip', 'b.rip', 'b rip', 'bdmv'
            ]
        if fmtst == 'hdrip':
            fmt = ['hdrip', 'hd-rip', 'hd rip', 'hd.rip']
            fmtflex = [
                'web-dl', 'webdl', 'web.dl', 'web dl', 'webdlrip', 'hdrip',
                'webrip', 'web-rip', 'web.rip', 'web rip', 'webr', 'web',
                'webcap', 'web-cap', 'web.cap', 'web cap'
            ]

        filelocal = xbmc.getInfoLabel(
            'Player.Filenameandpath')  #funciona local
        filestr = vidPath.split('/')[-1]  #funciona em cache torrents

        if setting('notif') == 'true':
            xbmc.executebuiltin('Notification("%s", "%s", "%s",)' %
                                (fmtst, filestr, 4000))

#***********************************************************************************************************************************************************************************************************

# Get identifier and search result *************************************************************************************************************************************************************************

        imdb = xbmc.Player().getVideoInfoTag().getIMDBNumber()

        if imdb.ljust(2)[:2].strip() == 'tt':
            imdbid = re.sub('[^0-9]', '', imdb)
        else:
            imdbid = 'None'

        if media == 'episode':
            if imdbid != 'None':
                season = xbmc.Player().getVideoInfoTag().getSeason()
                episode = xbmc.Player().getVideoInfoTag().getEpisode()
                result = server.SearchSubtitles(OStoken(), [{
                    'sublanguageid': sublanguageid,
                    'imdbid': imdbid,
                    'season': season,
                    'episode': episode
                }])['data']
            else:
                season = xbmc.Player().getVideoInfoTag().getSeason()
                episode = xbmc.Player().getVideoInfoTag().getEpisode()
                query = (
                    xbmc.Player().getVideoInfoTag().getTVShowTitle()).lower()
                result = server.SearchSubtitles(OStoken(), [{
                    'sublanguageid': sublanguageid,
                    'query': query,
                    'season': season,
                    'episode': episode
                }])['data']
        else:
            if imdbid != 'None':
                result = server.SearchSubtitles(OStoken(), [{
                    'sublanguageid': sublanguageid,
                    'imdbid': imdbid
                }])['data']
            else:
                title = (xbmc.Player().getVideoInfoTag().getOriginalTitle()
                         ).lower()
                year = xbmc.Player().getVideoInfoTag().getYear()
                query = title + " " + str(year)
                result = server.SearchSubtitles(OStoken(), [{
                    'sublanguageid': sublanguageid,
                    'query': query
                }])['data']

#***********************************************************************************************************************************************************************************************************

# Filter and subtilte set **********************************************************************************************************************************************************************************

        result = [i for i in result
                  if i['SubSumCD'] == '1']  #ver aqui o non result

        for lang in langs:
            filter += [
                i for i in result if i['SubLanguageID'] == lang and any(
                    x in i['MovieReleaseName'].lower() for x in fmt)
            ]
        try:
            lang = filter[0]['SubLanguageID']
        except Exception:
            if setting('flex') == 'false':
                raise Exception()
            else:
                for lang in langs:
                    filter += [
                        i for i in result
                        if i['SubLanguageID'] == lang and any(
                            x in i['MovieReleaseName'].lower()
                            for x in fmtflex)
                    ]
                    try:
                        lang = filter[0]['SubLanguageID']
                    except Exception:
                        if setting('anysub') == 'true':
                            for lang in langs:
                                filter += [
                                    i for i in result
                                    if i['SubLanguageID'] == lang
                                ]
                        else:
                            raise Exception()

        content = [
            filter[0]['IDSubtitleFile'],
        ]
        content = server.DownloadSubtitles(OStoken(), content)
        content = base64.b64decode(content['data'][0]['data'])
        if py2:
            content = gzip.GzipFile(fileobj=StringIO.StringIO(content)).read()
            subtitle = xbmc.translatePath('special://temp/')
        else:
            content = gzip.GzipFile(fileobj=io.BytesIO(content)).read()
            subtitle = xbmcvfs.translatePath('special://temp/')

        subtitle = os.path.join(subtitle, 'TemporarySubs.%s.srt' % lang)
        file = xbmcvfs.File(subtitle, 'w')
        if py2:
            file.write(str(content))
        else:
            file.write(content)
        file.close()
        xbmc.sleep(1000)
        xbmc.Player().setSubtitles(subtitle)

        if setting('notif') == 'true':
            xbmc.sleep(4000)
            test = [
                filter[0]['MovieReleaseName'],
            ]
            xbmc.executebuiltin('Notification("%s", "%s", "%s",)' %
                                (lang, test, 4000))

#***********************************************************************************************************************************************************************************************************

# Fallback *************************************************************************************************************************************************************************************************
    except Exception:
        if setting('subsearch') == 'true':
            xbmc.executebuiltin('ActivateWindow(SubtitleSearch)')