def SetupAccount(): utils.checkOS() os = utils.GetSetting('OS') if os == 'MacOS': utils.dialogOK('It appears you are running on Mac OS.', '', 'You may need administrator access to run VPNicity.') sudo = utils.dialogKB( '', "Enter the 'User Account' password for your computer.") ADDON.setSetting('SUDO', 'true') ADDON.setSetting('SUDOPASS', sudo) utils.dialogOK('We will now finish your installation.', 'Please double check your settings after we are done.', 'Thank you!') xbmc.executebuiltin( 'XBMC.RunScript(special://home/addons/plugin.program.vpnicity/install.py)' ) if 'OpenELEC' in os: utils.dialogOK('It appears you are running on OpenELEC.', 'We will now finish your installation.', 'Please double check your settings after we are done.') xbmc.executebuiltin( 'XBMC.RunScript(/storage/.kodi/addons/plugin.program.vpnicity/install.py)' ) else: return
def checkInstalled(): import path exists = path.getPath(utils.GetSetting('OS'), silent=True) if not exists: if utils.yesno('Do you want to install the VPN application now'): import install install.install(silent=False)
def onSettingsChanged(self): self.populateAddons() context = utils.GetSetting('CONTEXT') == 'true' if self.context != context: self.context = context UpdateKeymap()
def getPreviousTime(): utils.log('================== in getPreviousTime ==================') time_object = utils.GetSetting('LOGIN_TIME') if time_object == '': time_object = '2001-01-01 00:00:00' previousTime = parseTime(time_object) return previousTime
def UpdateKeymap(): DeleteKeymap() if utils.GetSetting('CONTEXT') == 'true': src = os.path.join(HOME, 'resources', 'keymaps', KEYMAP) dst = os.path.join(xbmc.translatePath('special://userdata/keymaps'), KEYMAP) try: import shutil shutil.copy(src, dst) except: pass xbmc.sleep(1000) xbmc.executebuiltin('Action(reloadkeymaps)')
def populateAddons(self): self.addons = [] for i in range(10): addon = utils.GetSetting('ADDON_%d' % i) if len(addon) > 0: country, abrv = getCountry(i) self.addons.append([addon, country, abrv]) index = 0 for addon in self.addons: if len(addon[0]) > 0 and len(addon[1]) > 0: utils.SetSetting('ADDON_%d' % index, addon[0]) utils.SetSetting('VPN_%d' % index, addon[1]) index += 1 for i in range(index, 10): utils.SetSetting('ADDON_%d' % i, '') utils.SetSetting('VPN_%d' % i, '')
def getCountry(index): country = '' abrv = '' try: country = utils.GetSetting('VPN_%d' % index) if country.lower() == '-remove-' or country == '': utils.SetSetting('ADDON_%d' % index, '') utils.SetSetting('VPN_%d' % index, '') return '', '' filename = os.path.join(PROFILE, 'countries', country) file = open(filename, 'r') abrv = file.read() file.close() except: pass return country.strip(), abrv.strip().lower()
'SE': 'Sweden', 'UK': 'United Kingdom', 'US': 'United States' } URL = utils.getBaseUrl() ADDON = utils.ADDON HOME = utils.HOME PROFILE = utils.PROFILE TITLE = utils.TITLE RESPONSE = os.path.join(PROFILE, 'openvpn.log') import quicknet LOGINURL = utils.LOGINURL USERNAME = utils.GetSetting('USER') PASSWORD = utils.GetSetting('PASS') class MyVPN(): def __init__(self, items): self.server = items[0] self.capacity = int(items[1]) self.city = items[2] self.abrv = items[3] self.icon = self.abrv.lower() self.ip = items[5] self.status = int(items[6]) self.visible = items[7] == '1' self.country = self.abrv if COUNTRIES.has_key(self.country):
def __init__(self): xbmc.Monitor.__init__(self) self.addon = '' self.context = utils.GetSetting('CONTEXT') == 'true' self.context = not self.context self.onSettingsChanged()