<s> import os <EOL> import xbmc , xbmcaddon <EOL> __settings__ = xbmcaddon . Addon ( id = '<STR_LIT>' ) <EOL> __icon__ = xbmcaddon . Addon ( id = '<STR_LIT>' ) . getAddonInfo ( '<STR_LIT>' ) <EOL> translate = __settings__ . getLocalizedString <EOL> enable_debug = True <EOL> language = xbmc . getLanguage <EOL> class Mode2 : <EOL> UPDATE = <NUM_LIT:100> <EOL> VIEW = <NUM_LIT> <EOL> PLAY = <NUM_LIT> <EOL> QUEUE = <NUM_LIT> <EOL> DOWNLOAD = <NUM_LIT> <EOL> EXECUTE = <NUM_LIT> <EOL> ADDTOFAVOURITES = <NUM_LIT> <EOL> REMOVEFROMFAVOURITES = <NUM_LIT> <EOL> EDITITEM = <NUM_LIT> <EOL> ADDITEM = <NUM_LIT> <EOL> DOWNLOADCUSTOMMODULE = <NUM_LIT> <EOL> REMOVEFROMCUSTOMMODULES = <NUM_LIT> <EOL> INSTALLADDON = <NUM_LIT> <EOL> CHROME = <NUM_LIT> <EOL> class Mode3 : <EOL> UPDATE = <NUM_LIT:200> <EOL> VIEW = <NUM_LIT> <EOL> PLAY = <NUM_LIT> <EOL> QUEUE = <NUM_LIT> <EOL> DOWNLOAD = <NUM_LIT> <EOL> EXECUTE = <NUM_LIT> <EOL> ADDTOFAVOURITES = <NUM_LIT> <EOL> REMOVEFROMFAVOURITES = <NUM_LIT> <EOL> EDITITEM = <NUM_LIT> <EOL> ADDITEM = <NUM_LIT> <EOL> DOWNLOADCUSTOMMODULE = <NUM_LIT> <EOL> REMOVEFROMCUSTOMMODULES = <NUM_LIT> <EOL> INSTALLADDON = <NUM_LIT> <EOL> CHROME = <NUM_LIT> <EOL> """<STR_LIT>""" <EOL> def log ( msg , level = xbmc . LOGNOTICE ) : <EOL> plugin = "<STR_LIT>" <EOL> msg = msg . encode ( '<STR_LIT:utf-8>' ) <EOL> xbmc . log ( "<STR_LIT>" % ( plugin , msg . __str__ ( ) ) , level ) <EOL> print ( "<STR_LIT>" % ( plugin , msg . __str__ ( ) ) ) <EOL> def getSetting ( name ) : <EOL> return __settings__ . getSetting ( name ) <EOL> def setSetting ( name , value ) : <EOL> __settings__ . setSetting ( id = name , value = value ) <EOL> def showNotification ( title , message , timeout = <NUM_LIT> , icon = __icon__ ) : <EOL> def clean ( s ) : <EOL> return str ( s . encode ( '<STR_LIT:utf-8>' , '<STR_LIT:ignore>' ) ) <EOL> command = '<STR_LIT>' <EOL> if icon : <EOL> command = '<STR_LIT>' % ( clean ( title ) , clean ( message ) , timeout , icon ) <EOL> else : <EOL> command = '<STR_LIT>' % ( clean ( title ) , clean ( message ) , timeout ) <EOL> xbmc . executebuiltin ( command ) <EOL> def runPlugin ( url ) : <EOL> xbmc . executebuiltin ( '<STR_LIT>' + url + '<STR_LIT:)>' ) <EOL> from dialogs . dialogQuestion import DialogQuestion <EOL> from dialogs . dialogBrowser import DialogBrowser <EOL> from dialogs . dialogInfo import DialogInfo <EOL> from dialogs . dialogError import DialogError <EOL> from utils . xbmcUtils import getKeyboard <EOL> from utils import fileUtils as fu <EOL> def ask ( question ) : <EOL> diaQuestion = DialogQuestion ( ) <EOL> return diaQuestion . ask ( question ) <EOL> def showInfo ( message ) : <EOL> diaInfo = DialogInfo ( ) <EOL> diaInfo . show ( message ) <EOL> def showError ( message ) : <EOL> diaError = DialogError ( ) <EOL> diaError . show ( message ) <EOL> def browseFolders ( head ) : <EOL> diaFolder = DialogBrowser ( ) <EOL> return diaFolder . browseFolders ( head ) <EOL> def showOSK ( defaultText = '<STR_LIT>' , title = '<STR_LIT>' , hidden = False ) : <EOL> return getKeyboard ( defaultText , title , hidden ) <EOL> from utils . regexUtils import parseTextToGroups <EOL> from utils . webUtils import CachedWebRequest <EOL> import cookielib <EOL> def getHTML ( url , form_data = '<STR_LIT>' , referer = '<STR_LIT>' , xml = False , mobile = False , ignoreCache = False , demystify = False ) : <EOL> cookiePath = xbmc . translatePath ( os . path . join ( Paths . cacheDir , '<STR_LIT>' ) ) <EOL> request = CachedWebRequest ( cookiePath , Paths . cacheDir ) <EOL> return request . getSource ( url , form_data , referer , xml , mobile , ignoreCache , demystify ) <EOL> def getCookies ( cookieName , domain ) : <EOL> cookiePath = xbmc . translatePath ( os . path . join ( Paths . cacheDir , '<STR_LIT>' ) ) <EOL> def load_cookies_from_lwp ( filename ) : <EOL> lwp_cookiejar = cookielib . LWPCookieJar ( ) <EOL> lwp_cookiejar . load ( filename , ignore_discard = True ) <EOL> return lwp_cookiejar <EOL> for cookie in load_cookies_from_lwp ( cookiePath ) : <EOL> if domain in cookie . domain and cookieName in cookie . name : <EOL> return cookie . value <EOL> def parseWebsite ( source , regex , referer = '<STR_LIT>' , variables = [ ] ) : <EOL> def parseWebsiteToGroups ( url , regex , referer = '<STR_LIT>' ) : <EOL> data = getHTML ( url , None , referer ) <EOL> return parseTextToGroups ( data , regex ) <EOL> groups = parseWebsiteToGroups ( source , regex , referer ) <EOL> if variables == [ ] : <EOL> if groups : <EOL> return groups [ <NUM_LIT:0> ] <EOL> else : <EOL> return '<STR_LIT>' <EOL> else : <EOL> resultArr = { } <EOL> i = <NUM_LIT:0> <EOL> for v in variables : <EOL> if groups : <EOL> resultArr [ v ] = groups [ i ] <EOL> else : <EOL> resultArr [ v ] = '<STR_LIT>' <EOL> i += <NUM_LIT:1> <EOL> return resultArr <EOL> def clearCache ( ) : <EOL> cacheDir = Paths . cacheDir <EOL> if not os . path . exists ( cacheDir ) : <EOL> os . mkdir ( cacheDir , <NUM_LIT:0> <NUM_LIT> ) <EOL> print ( '<STR_LIT>' + str ( cacheDir ) ) <EOL> else : <EOL> fu . clearDirectory ( cacheDir ) <EOL> print ( '<STR_LIT>' ) <EOL> class Paths : <EOL> rootDir = xbmc . translatePath ( __settings__ . getAddonInfo ( '<STR_LIT:path>' ) ) . decode ( '<STR_LIT:utf-8>' ) <EOL> resDir = os . path . join ( rootDir , '<STR_LIT>' ) <EOL> imgDir = os . path . join ( resDir , '<STR_LIT>' ) <EOL> modulesDir = os . path . join ( resDir , '<STR_LIT>' ) <EOL> catchersDir = os . path . join ( resDir , '<STR_LIT>' ) <EOL> dictsDir = os . path . join ( resDir , '<STR_LIT>' ) <EOL> pluginFanart = os . path . join ( rootDir , '<STR_LIT>' ) <EOL> pluginFanart1 = os . path . join ( rootDir , '<STR_LIT>' ) <EOL> defaultVideoIcon = os . path . join ( imgDir , '<STR_LIT>' ) <EOL> defaultCategoryIcon = os . path . join ( imgDir , '<STR_LIT>' ) <EOL> pluginDataDir = xbmc . translatePath ( __settings__ . getAddonInfo ( '<STR_LIT>' ) ) . decode ( '<STR_LIT:utf-8>' ) <EOL> print ( "<STR_LIT>" , pluginDataDir ) <EOL> cacheDir = os . path . join ( pluginDataDir , '<STR_LIT>' ) <EOL> favouritesFolder = os . path . join ( pluginDataDir , '<STR_LIT>' ) <EOL> favouritesFile = os . path . join ( favouritesFolder , '<STR_LIT>' ) <EOL> customModulesDir = os . path . join ( pluginDataDir , '<STR_LIT>' ) <EOL> customModulesFile = os . path . join ( customModulesDir , '<STR_LIT>' ) <EOL> catchersRepo = '<STR_LIT>' <EOL> modulesRepo = '<STR_LIT>' <EOL> customModulesRepo = '<STR_LIT>' <EOL> xbmcFavouritesFile = xbmc . translatePath ( '<STR_LIT>' ) </s>
