<s> '''<STR_LIT>''' <EOL> try : <EOL> from sqlite3 import dbapi2 as database <EOL> except : <EOL> from pysqlite2 import dbapi2 as database <EOL> import os , sys , re , json , urllib , urlparse , datetime , xbmc <EOL> from resources . lib . libraries import control <EOL> class libmovies : <EOL> def __init__ ( self ) : <EOL> self . library_folder = os . path . join ( control . transPath ( control . setting ( '<STR_LIT>' ) ) , '<STR_LIT>' ) <EOL> self . check_setting = control . setting ( '<STR_LIT>' ) or '<STR_LIT:false>' <EOL> self . library_setting = control . setting ( '<STR_LIT>' ) or '<STR_LIT:true>' <EOL> self . dupe_setting = control . setting ( '<STR_LIT>' ) or '<STR_LIT:true>' <EOL> self . infoDialog = False <EOL> def add ( self , name , title , year , imdb , tmdb , range = False ) : <EOL> if not control . condVisibility ( '<STR_LIT>' ) and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT> ) <EOL> self . infoDialog = True <EOL> try : <EOL> if not self . dupe_setting == '<STR_LIT:true>' : raise Exception ( ) <EOL> id = [ imdb , tmdb ] if not tmdb == '<STR_LIT:0>' else [ imdb ] <EOL> lib = control . jsonrpc ( '<STR_LIT>' % ( year , str ( int ( year ) + <NUM_LIT:1> ) , str ( int ( year ) - <NUM_LIT:1> ) ) ) <EOL> lib = unicode ( lib , '<STR_LIT:utf-8>' , errors = '<STR_LIT:ignore>' ) <EOL> lib = json . loads ( lib ) [ '<STR_LIT:result>' ] [ '<STR_LIT>' ] <EOL> lib = [ i for i in lib if str ( i [ '<STR_LIT>' ] ) in id or ( i [ '<STR_LIT>' ] . encode ( '<STR_LIT:utf-8>' ) == title and str ( i [ '<STR_LIT>' ] ) == year ) ] [ <NUM_LIT:0> ] <EOL> except : <EOL> lib = [ ] <EOL> try : <EOL> if not lib == [ ] : raise Exception ( ) <EOL> if self . check_setting == '<STR_LIT:true>' : <EOL> from resources . lib . sources import sources <EOL> src = sources ( ) . checkSources ( name , title , year , imdb , tmdb , '<STR_LIT:0>' , '<STR_LIT:0>' , None , None , None , '<STR_LIT:0>' , None ) <EOL> if src == False : raise Exception ( ) <EOL> self . strmFile ( { '<STR_LIT:name>' : name , '<STR_LIT:title>' : title , '<STR_LIT>' : year , '<STR_LIT>' : imdb , '<STR_LIT>' : tmdb } ) <EOL> except : <EOL> pass <EOL> if range == True : return <EOL> if self . infoDialog == True : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT:1> ) <EOL> if self . library_setting == '<STR_LIT:true>' and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . execute ( '<STR_LIT>' ) <EOL> def range ( self , url ) : <EOL> control . idle ( ) <EOL> yes = control . yesnoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> if not yes : return <EOL> if not control . condVisibility ( '<STR_LIT>' ) and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT> ) <EOL> self . infoDialog = True <EOL> from resources . lib . indexers import movies <EOL> items = movies . movies ( ) . get ( url , idx = False ) <EOL> if items == None : items = [ ] <EOL> for i in items : <EOL> try : <EOL> if xbmc . abortRequested == True : return sys . exit ( ) <EOL> self . add ( i [ '<STR_LIT:name>' ] , i [ '<STR_LIT:title>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , range = True ) <EOL> except : <EOL> pass <EOL> if self . infoDialog == True : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT:1> ) <EOL> if self . library_setting == '<STR_LIT:true>' and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . execute ( '<STR_LIT>' ) <EOL> def strmFile ( self , i ) : <EOL> try : <EOL> name , title , year , imdb , tmdb = i [ '<STR_LIT:name>' ] , i [ '<STR_LIT:title>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] <EOL> sysname , systitle = urllib . quote_plus ( name ) , urllib . quote_plus ( title ) <EOL> transname = name . translate ( None , '<STR_LIT>' ) . strip ( '<STR_LIT:.>' ) <EOL> content = '<STR_LIT>' % ( sys . argv [ <NUM_LIT:0> ] , sysname , systitle , year , imdb , tmdb ) <EOL> control . makeFile ( self . library_folder ) <EOL> folder = os . path . join ( self . library_folder , transname ) <EOL> control . makeFile ( folder ) <EOL> try : <EOL> if not '<STR_LIT>' in folder : raise Exception ( ) <EOL> from ftplib import FTP <EOL> ftparg = re . compile ( '<STR_LIT>' ) . findall ( folder ) <EOL> ftp = FTP ( ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:2> ] , ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] ) <EOL> try : ftp . cwd ( ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:4> ] ) <EOL> except : ftp . mkd ( ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:4> ] ) <EOL> ftp . quit ( ) <EOL> except : <EOL> pass <EOL> stream = os . path . join ( folder , transname + '<STR_LIT>' ) <EOL> file = control . openFile ( stream , '<STR_LIT:w>' ) <EOL> file . write ( str ( content ) ) <EOL> file . close ( ) <EOL> except : <EOL> pass <EOL> class libtvshows : <EOL> def __init__ ( self ) : <EOL> self . library_folder = os . path . join ( control . transPath ( control . setting ( '<STR_LIT>' ) ) , '<STR_LIT>' ) <EOL> self . version = control . version ( ) <EOL> self . check_setting = control . setting ( '<STR_LIT>' ) or '<STR_LIT:false>' <EOL> self . library_setting = control . setting ( '<STR_LIT>' ) or '<STR_LIT:true>' <EOL> self . dupe_setting = control . setting ( '<STR_LIT>' ) or '<STR_LIT:true>' <EOL> self . datetime = ( datetime . datetime . utcnow ( ) - datetime . timedelta ( hours = <NUM_LIT:5> ) ) <EOL> self . date = ( self . datetime - datetime . timedelta ( hours = <NUM_LIT> ) ) . strftime ( '<STR_LIT>' ) <EOL> self . infoDialog = False <EOL> self . block = False <EOL> def add ( self , tvshowtitle , year , imdb , tmdb , tvdb , tvrage , range = False ) : <EOL> if not control . condVisibility ( '<STR_LIT>' ) and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT> ) <EOL> self . infoDialog = True <EOL> from resources . lib . indexers import episodes <EOL> items = episodes . episodes ( ) . get ( tvshowtitle , year , imdb , tmdb , tvdb , tvrage , idx = False ) <EOL> try : items = [ { '<STR_LIT:name>' : i [ '<STR_LIT:name>' ] , '<STR_LIT:title>' : i [ '<STR_LIT:title>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT:date>' : i [ '<STR_LIT>' ] } for i in items ] <EOL> except : items = [ ] <EOL> try : <EOL> if not self . dupe_setting == '<STR_LIT:true>' : raise Exception ( ) <EOL> if items == [ ] : raise Exception ( ) <EOL> id = [ items [ <NUM_LIT:0> ] [ '<STR_LIT>' ] , items [ <NUM_LIT:0> ] [ '<STR_LIT>' ] ] <EOL> if not items [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == '<STR_LIT:0>' : id += [ items [ <NUM_LIT:0> ] [ '<STR_LIT>' ] ] <EOL> lib = control . jsonrpc ( '<STR_LIT>' ) <EOL> lib = unicode ( lib , '<STR_LIT:utf-8>' , errors = '<STR_LIT:ignore>' ) <EOL> lib = json . loads ( lib ) [ '<STR_LIT:result>' ] [ '<STR_LIT>' ] <EOL> lib = [ i [ '<STR_LIT:title>' ] . encode ( '<STR_LIT:utf-8>' ) for i in lib if str ( i [ '<STR_LIT>' ] ) in id or ( i [ '<STR_LIT:title>' ] . encode ( '<STR_LIT:utf-8>' ) == items [ <NUM_LIT:0> ] [ '<STR_LIT>' ] and str ( i [ '<STR_LIT>' ] ) == items [ <NUM_LIT:0> ] [ '<STR_LIT>' ] ) ] [ <NUM_LIT:0> ] <EOL> lib = control . jsonrpc ( '<STR_LIT>' % lib ) <EOL> lib = unicode ( lib , '<STR_LIT:utf-8>' , errors = '<STR_LIT:ignore>' ) <EOL> lib = json . loads ( lib ) [ '<STR_LIT:result>' ] [ '<STR_LIT>' ] <EOL> lib = [ '<STR_LIT>' % ( int ( i [ '<STR_LIT>' ] ) , int ( i [ '<STR_LIT>' ] ) ) for i in lib ] <EOL> items = [ i for i in items if not '<STR_LIT>' % ( int ( i [ '<STR_LIT>' ] ) , int ( i [ '<STR_LIT>' ] ) ) in lib ] <EOL> except : <EOL> pass <EOL> for i in items : <EOL> try : <EOL> if xbmc . abortRequested == True : return sys . exit ( ) <EOL> if self . check_setting == '<STR_LIT:true>' : <EOL> if i [ '<STR_LIT>' ] == '<STR_LIT:1>' : <EOL> self . block = True <EOL> from resources . lib . sources import sources <EOL> src = sources ( ) . checkSources ( i [ '<STR_LIT:name>' ] , i [ '<STR_LIT:title>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT:date>' ] ) <EOL> if src == True : self . block = False <EOL> if self . block == True : raise Exception ( ) <EOL> if int ( self . date ) <= int ( re . sub ( '<STR_LIT>' , '<STR_LIT>' , str ( i [ '<STR_LIT:date>' ] ) ) ) : <EOL> from resources . lib . sources import sources <EOL> src = sources ( ) . checkSources ( i [ '<STR_LIT:name>' ] , i [ '<STR_LIT:title>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT:date>' ] ) <EOL> if src == False : raise Exception ( ) <EOL> self . strmFile ( i ) <EOL> except : <EOL> pass <EOL> if range == True : return <EOL> if self . infoDialog == True : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT:1> ) <EOL> if self . library_setting == '<STR_LIT:true>' and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . execute ( '<STR_LIT>' ) <EOL> def range ( self , url ) : <EOL> control . idle ( ) <EOL> yes = control . yesnoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> if not yes : return <EOL> if not control . condVisibility ( '<STR_LIT>' ) and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT> ) <EOL> self . infoDialog = True <EOL> from resources . lib . indexers import tvshows <EOL> items = tvshows . tvshows ( ) . get ( url , idx = False ) <EOL> if items == None : items = [ ] <EOL> for i in items : <EOL> try : <EOL> if xbmc . abortRequested == True : return sys . exit ( ) <EOL> self . add ( i [ '<STR_LIT:title>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , range = True ) <EOL> except : <EOL> pass <EOL> if self . infoDialog == True : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT:1> ) <EOL> if self . library_setting == '<STR_LIT:true>' and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . execute ( '<STR_LIT>' ) <EOL> def strmFile ( self , i ) : <EOL> try : <EOL> name , title , year , imdb , tmdb , tvdb , tvrage , season , episode , tvshowtitle , alter , date = i [ '<STR_LIT:name>' ] , i [ '<STR_LIT:title>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT:date>' ] <EOL> episodename , episodetitle = urllib . quote_plus ( name ) , urllib . quote_plus ( title ) <EOL> systitle , syspremiered = urllib . quote_plus ( tvshowtitle ) , urllib . quote_plus ( date ) <EOL> if self . version >= <NUM_LIT:15> : <EOL> transname = '<STR_LIT>' % ( tvshowtitle . translate ( None , '<STR_LIT>' ) , year , int ( season ) , int ( episode ) ) <EOL> transtitle = '<STR_LIT>' % ( tvshowtitle . translate ( None , '<STR_LIT>' ) , year ) <EOL> else : <EOL> transname = name . translate ( None , '<STR_LIT>' ) . strip ( '<STR_LIT:.>' ) <EOL> transtitle = tvshowtitle . translate ( None , '<STR_LIT>' ) . strip ( '<STR_LIT:.>' ) <EOL> transseason = '<STR_LIT>' % season . translate ( None , '<STR_LIT>' ) . strip ( '<STR_LIT:.>' ) <EOL> content = '<STR_LIT>' % ( sys . argv [ <NUM_LIT:0> ] , episodename , episodetitle , year , imdb , tmdb , tvdb , tvrage , season , episode , systitle , alter , syspremiered ) <EOL> control . makeFile ( self . library_folder ) <EOL> folder = os . path . join ( self . library_folder , transtitle ) <EOL> control . makeFile ( folder ) <EOL> try : <EOL> if not '<STR_LIT>' in folder : raise Exception ( ) <EOL> from ftplib import FTP <EOL> ftparg = re . compile ( '<STR_LIT>' ) . findall ( folder ) <EOL> ftp = FTP ( ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:2> ] , ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] ) <EOL> try : ftp . cwd ( ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:4> ] ) <EOL> except : ftp . mkd ( ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:4> ] ) <EOL> ftp . quit ( ) <EOL> except : <EOL> pass <EOL> folder = os . path . join ( folder , transseason ) <EOL> control . makeFile ( folder ) <EOL> try : <EOL> if not '<STR_LIT>' in folder : raise Exception ( ) <EOL> from ftplib import FTP <EOL> ftparg = re . compile ( '<STR_LIT>' ) . findall ( folder ) <EOL> ftp = FTP ( ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:2> ] , ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] ) <EOL> try : ftp . cwd ( ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:4> ] ) <EOL> except : ftp . mkd ( ftparg [ <NUM_LIT:0> ] [ <NUM_LIT:4> ] ) <EOL> ftp . quit ( ) <EOL> except : <EOL> pass <EOL> stream = os . path . join ( folder , transname + '<STR_LIT>' ) <EOL> file = control . openFile ( stream , '<STR_LIT:w>' ) <EOL> file . write ( str ( content ) ) <EOL> file . close ( ) <EOL> except : <EOL> pass <EOL> class libepisodes : <EOL> def __init__ ( self ) : <EOL> self . library_folder = os . path . join ( control . transPath ( control . setting ( '<STR_LIT>' ) ) , '<STR_LIT>' ) <EOL> self . library_setting = control . setting ( '<STR_LIT>' ) or '<STR_LIT:true>' <EOL> self . property = '<STR_LIT>' % control . addonInfo ( '<STR_LIT:name>' ) . lower ( ) <EOL> self . datetime = ( datetime . datetime . utcnow ( ) - datetime . timedelta ( hours = <NUM_LIT:5> ) ) <EOL> self . date = ( self . datetime - datetime . timedelta ( hours = <NUM_LIT> ) ) . strftime ( '<STR_LIT>' ) <EOL> self . infoDialog = False <EOL> def update ( self , query = None , info = '<STR_LIT:true>' ) : <EOL> if not query == None : control . idle ( ) <EOL> try : <EOL> items = [ ] <EOL> season , episode = [ ] , [ ] <EOL> show = [ os . path . join ( self . library_folder , i ) for i in control . listDir ( self . library_folder ) [ <NUM_LIT:0> ] ] <EOL> for s in show : <EOL> try : season += [ os . path . join ( s , i ) for i in control . listDir ( s ) [ <NUM_LIT:0> ] ] <EOL> except : pass <EOL> for s in season : <EOL> try : episode . append ( [ os . path . join ( s , i ) for i in control . listDir ( s ) [ <NUM_LIT:1> ] if i . endswith ( '<STR_LIT>' ) ] [ - <NUM_LIT:1> ] ) <EOL> except : pass <EOL> for file in episode : <EOL> try : <EOL> file = control . openFile ( file ) <EOL> read = file . read ( ) <EOL> read = read . encode ( '<STR_LIT:utf-8>' ) <EOL> file . close ( ) <EOL> if not read . startswith ( sys . argv [ <NUM_LIT:0> ] ) : raise Exception ( ) <EOL> params = dict ( urlparse . parse_qsl ( read . replace ( '<STR_LIT:?>' , '<STR_LIT>' ) ) ) <EOL> try : tvshowtitle = params [ '<STR_LIT>' ] <EOL> except : tvshowtitle = None <EOL> try : tvshowtitle = params [ '<STR_LIT>' ] <EOL> except : pass <EOL> if tvshowtitle == None or tvshowtitle == '<STR_LIT>' : raise Exception ( ) <EOL> year , imdb , tvdb = params [ '<STR_LIT>' ] , params [ '<STR_LIT>' ] , params [ '<STR_LIT>' ] <EOL> imdb = '<STR_LIT>' + re . sub ( '<STR_LIT>' , '<STR_LIT>' , str ( imdb ) ) <EOL> try : tmdb = params [ '<STR_LIT>' ] <EOL> except : tmdb = '<STR_LIT:0>' <EOL> try : tvrage = params [ '<STR_LIT>' ] <EOL> except : tvrage = '<STR_LIT:0>' <EOL> items . append ( { '<STR_LIT>' : tvshowtitle , '<STR_LIT>' : year , '<STR_LIT>' : imdb , '<STR_LIT>' : tmdb , '<STR_LIT>' : tvdb , '<STR_LIT>' : tvrage } ) <EOL> except : <EOL> pass <EOL> items = [ i for x , i in enumerate ( items ) if i not in items [ x + <NUM_LIT:1> : ] ] <EOL> if len ( items ) == <NUM_LIT:0> : raise Exception ( ) <EOL> except : <EOL> return <EOL> try : <EOL> lib = control . jsonrpc ( '<STR_LIT>' ) <EOL> lib = unicode ( lib , '<STR_LIT:utf-8>' , errors = '<STR_LIT:ignore>' ) <EOL> lib = json . loads ( lib ) [ '<STR_LIT:result>' ] [ '<STR_LIT>' ] <EOL> except : <EOL> return <EOL> if info == '<STR_LIT:true>' and not control . condVisibility ( '<STR_LIT>' ) and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT> ) <EOL> self . infoDialog = True <EOL> try : <EOL> control . makeFile ( control . dataPath ) <EOL> dbcon = database . connect ( control . libcacheFile ) <EOL> dbcur = dbcon . cursor ( ) <EOL> dbcur . execute ( "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" ) <EOL> except : <EOL> return <EOL> try : <EOL> from resources . lib . indexers import episodes <EOL> except : <EOL> return <EOL> for item in items : <EOL> it = None <EOL> if xbmc . abortRequested == True : return sys . exit ( ) <EOL> try : <EOL> dbcur . execute ( "<STR_LIT>" % item [ '<STR_LIT>' ] ) <EOL> fetch = dbcur . fetchone ( ) <EOL> it = eval ( fetch [ <NUM_LIT:1> ] . encode ( '<STR_LIT:utf-8>' ) ) <EOL> except : <EOL> pass <EOL> try : <EOL> if not it == None : raise Exception ( ) <EOL> it = episodes . episodes ( ) . get ( item [ '<STR_LIT>' ] , item [ '<STR_LIT>' ] , item [ '<STR_LIT>' ] , item [ '<STR_LIT>' ] , item [ '<STR_LIT>' ] , item [ '<STR_LIT>' ] , idx = False ) <EOL> status = it [ <NUM_LIT:0> ] [ '<STR_LIT:status>' ] . lower ( ) <EOL> it = [ { '<STR_LIT:name>' : i [ '<STR_LIT:name>' ] , '<STR_LIT:title>' : i [ '<STR_LIT:title>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT>' : i [ '<STR_LIT>' ] , '<STR_LIT:date>' : i [ '<STR_LIT>' ] } for i in it ] <EOL> if status == '<STR_LIT>' : raise Exception ( ) <EOL> dbcur . execute ( "<STR_LIT>" , ( item [ '<STR_LIT>' ] , repr ( it ) ) ) <EOL> dbcon . commit ( ) <EOL> except : <EOL> pass <EOL> try : <EOL> id = [ item [ '<STR_LIT>' ] , item [ '<STR_LIT>' ] ] <EOL> if not item [ '<STR_LIT>' ] == '<STR_LIT:0>' : id += [ item [ '<STR_LIT>' ] ] <EOL> ep = [ x [ '<STR_LIT:title>' ] . encode ( '<STR_LIT:utf-8>' ) for x in lib if str ( x [ '<STR_LIT>' ] ) in id or ( x [ '<STR_LIT:title>' ] . encode ( '<STR_LIT:utf-8>' ) == item [ '<STR_LIT>' ] and str ( x [ '<STR_LIT>' ] ) == item [ '<STR_LIT>' ] ) ] [ <NUM_LIT:0> ] <EOL> ep = control . jsonrpc ( '<STR_LIT>' % ep ) <EOL> ep = unicode ( ep , '<STR_LIT:utf-8>' , errors = '<STR_LIT:ignore>' ) <EOL> ep = json . loads ( ep ) [ '<STR_LIT:result>' ] [ '<STR_LIT>' ] [ - <NUM_LIT:1> ] <EOL> num = [ x for x , y in enumerate ( it ) if str ( y [ '<STR_LIT>' ] ) == str ( ep [ '<STR_LIT>' ] ) and str ( y [ '<STR_LIT>' ] ) == str ( ep [ '<STR_LIT>' ] ) ] [ - <NUM_LIT:1> ] <EOL> it = [ y for x , y in enumerate ( it ) if x > num ] <EOL> if len ( it ) == <NUM_LIT:0> : continue <EOL> except : <EOL> continue <EOL> for i in it : <EOL> try : <EOL> if xbmc . abortRequested == True : return sys . exit ( ) <EOL> if int ( self . date ) <= int ( re . sub ( '<STR_LIT>' , '<STR_LIT>' , str ( i [ '<STR_LIT:date>' ] ) ) ) : <EOL> from resources . lib . sources import sources <EOL> src = sources ( ) . checkSources ( i [ '<STR_LIT:name>' ] , i [ '<STR_LIT:title>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT>' ] , i [ '<STR_LIT:date>' ] ) <EOL> if src == False : raise Exception ( ) <EOL> libtvshows ( ) . strmFile ( i ) <EOL> except : <EOL> pass <EOL> if self . infoDialog == True : <EOL> control . infoDialog ( control . lang ( <NUM_LIT> ) . encode ( '<STR_LIT:utf-8>' ) , time = <NUM_LIT:1> ) <EOL> if self . library_setting == '<STR_LIT:true>' and not control . condVisibility ( '<STR_LIT>' ) : <EOL> control . execute ( '<STR_LIT>' ) <EOL> def service ( self ) : <EOL> try : <EOL> control . makeFile ( control . dataPath ) <EOL> dbcon = database . connect ( control . libcacheFile ) <EOL> dbcur = dbcon . cursor ( ) <EOL> dbcur . execute ( "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" ) <EOL> dbcur . execute ( "<STR_LIT>" ) <EOL> fetch = dbcur . fetchone ( ) <EOL> if fetch == None : <EOL> serviceProperty = "<STR_LIT>" <EOL> dbcur . execute ( "<STR_LIT>" , ( '<STR_LIT>' , serviceProperty ) ) <EOL> dbcon . commit ( ) <EOL> else : <EOL> serviceProperty = str ( fetch [ <NUM_LIT:1> ] ) <EOL> dbcon . close ( ) <EOL> except : <EOL> try : return dbcon . close ( ) <EOL> except : return <EOL> try : control . window . setProperty ( self . property , serviceProperty ) <EOL> except : return <EOL> while ( not xbmc . abortRequested ) : <EOL> try : <EOL> serviceProperty = control . window . getProperty ( self . property ) <EOL> t1 = datetime . timedelta ( hours = <NUM_LIT:6> ) <EOL> t2 = datetime . datetime . strptime ( serviceProperty , '<STR_LIT>' ) <EOL> t3 = datetime . datetime . now ( ) <EOL> check = abs ( t3 - t2 ) > t1 <EOL> if check == False : raise Exception ( ) <EOL> if ( control . player . isPlaying ( ) or control . condVisibility ( '<STR_LIT>' ) ) : raise Exception ( ) <EOL> serviceProperty = datetime . datetime . now ( ) . strftime ( '<STR_LIT>' ) <EOL> control . window . setProperty ( self . property , serviceProperty ) <EOL> try : <EOL> dbcon = database . connect ( control . libcacheFile ) <EOL> dbcur = dbcon . cursor ( ) <EOL> dbcur . execute ( "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" ) <EOL> dbcur . execute ( "<STR_LIT>" ) <EOL> dbcur . execute ( "<STR_LIT>" , ( '<STR_LIT>' , serviceProperty ) ) <EOL> dbcon . commit ( ) <EOL> dbcon . close ( ) <EOL> except : <EOL> try : dbcon . close ( ) <EOL> except : pass <EOL> if not control . setting ( '<STR_LIT>' ) == '<STR_LIT:true>' : raise Exception ( ) <EOL> info = control . setting ( '<STR_LIT>' ) or '<STR_LIT:true>' <EOL> self . update ( None , info = info ) <EOL> except : <EOL> pass <EOL> control . sleep ( <NUM_LIT> ) </s>
