# Embedded file name: ./lib/variables.py
import xbmcaddon
import xbmcgui
import xbmc
ADDON_ID = 'service.vavoo'
addon = xbmcaddon.Addon(ADDON_ID)
addonPath = addon.getAddonInfo('path').decode('utf-8')
addonVersion = addon.getAddonInfo('version')
WINDOW_HOME = xbmcgui.Window(10000)
API_URL = 'https://www.vavoo.tv/api/'
PRO_URL = 'https://www.vavoo.tv/pro'
SOFTWARE_URL = 'http://www.vavoo.tv/software'
class PASSWORD:
SALT, N, R, P, DK_LEN = ('C1k8l0jw8g8puGRauyKjcN0ofNp', 1024, 1, 1, 15)
INTERNET_CHECK_INTERVAL = (30, 90)
INTERNET_CHECK_HOSTS = [('8.8.8.8', 53), ('208.67.222.222', 53)]
LOGIN_CHECK_INTERVAL = (180, 360)
UPDATE_ASK_INTERVAL = 86400
UPDATE_DOWNLOAD_RETRY_INTERVAL = 3600
BACKEND_ERROR_SHOW_LOGSCREEN_TIME = 60
UNKNOWN_ERROR_SHOW_LOGSCREEN_TIME = 600
BUFFER_SIZE = 8192
if xbmc.getCondVisibility('system.platform.android'):
import re
import os
try:
m = re.match('^/data/app/([^-]+)-.*$', os.environ['XBMC_ANDROID_APK'])
except KeyError:
ANDROID_PACKAGE_NAME = 'KEYERROR'
else:
if m:
ANDROID_PACKAGE_NAME = m.group(1)
else:
ANDROID_PACKAGE_NAME = 'UNKNOWN'
else:
ANDROID_PACKAGE_NAME = ''
def getVavooVersion():
return xbmc.getInfoLabel('System.BuildVersion').split('-')[0]
def getVavooBranch():
try:
branch = xbmc.getInfoLabel('System.BuildVersion').split('-')[1]
except IndexError:
branch = 'master'
if not branch:
branch = 'master'
return branch
def isVavooDevice():
if xbmc.getCondVisibility('system.platform.android'):
try:
with open('/system/build.prop', 'r') as f:
content = f.read()
if 'ro.product.brand=VAVOO' in content and 'ro.vavoo.type=b' in content:
return True
except Exception:
pass
return False
IS_SERVICE_PROCESS = False
def assertServiceProcess():
if not IS_SERVICE_PROCESS:
raise RuntimeError('Calling function outside the service process')
def assertNotServiceProcess():
if IS_SERVICE_PROCESS:
raise RuntimeError('Calling function within the service process')
def localize(id):
return xbmc.getLocalizedString(id)
def getPlatformName():
if isVavooDevice():
return 'vavoo'
elif xbmc.getCondVisibility('system.platform.android'):
return 'android'
elif xbmc.getCondVisibility('system.platform.linux'):
return 'linux'
elif xbmc.getCondVisibility('system.platform.windows'):
return 'win32'
elif xbmc.getCondVisibility('system.platform.osx'):
return 'osx'
elif xbmc.getCondVisibility('system.platform.ios'):
return 'ios'
elif xbmc.getCondVisibility('system.platform.atv2'):
return 'atv2'
else:
return 'unknown'
def propStatus(log = None):
import vprop
data = {'ready': vprop.get('Ready'),
'token': vprop.get('Token'),
'ping_status': vprop.get('Ping_Status'),
'ruleset': vprop.get('Ruleset')}
if log:
xbmc.log('STATUS: %s: %s' % (log, data), xbmc.LOGERROR)
return data