Ejemplo n.º 1
0
    def check_updates_v2(self, force=False):
        if hasattr(self, 'update_in_progress'):
            oe.dbg_log('updates::check_updates_v2', 'Update in progress (exit)', oe.LOGDEBUG)
            return
        if self.struct['update']['settings']['SubmitStats']['value'] == '1':
            systemid = oe.SYSTEMID
        else:
            systemid = "NOSTATS"
        if oe.BUILDER_VERSION:
            version = oe.BUILDER_VERSION
        else:
            version = oe.VERSION
        url = f'{self.UPDATE_REQUEST_URL}?i={oe.url_quote(systemid)}&d={oe.url_quote(oe.DISTRIBUTION)}&pa={oe.url_quote(oe.ARCHITECTURE)}&v={oe.url_quote(version)}&f={oe.url_quote(self.hardware_flags)}'
        if oe.BUILDER_NAME:
           url += f'&b={oe.url_quote(oe.BUILDER_NAME)}'

        oe.dbg_log('updates::check_updates_v2', f'URL: {url}', oe.LOGDEBUG)
        update_json = oe.load_url(url)
        oe.dbg_log('updates::check_updates_v2', f'RESULT: {repr(update_json)}', oe.LOGDEBUG)
        if update_json != '':
            update_json = json.loads(update_json)
            self.last_update_check = time.time()
            if 'update' in update_json['data'] and 'folder' in update_json['data']:
                self.update_file = self.UPDATE_DOWNLOAD_URL % (update_json['data']['folder'], update_json['data']['update'])
                if self.struct['update']['settings']['UpdateNotify']['value'] == '1':
                    oe.notify(oe._(32363), oe._(32364))
                if self.struct['update']['settings']['AutoUpdate']['value'] == 'auto' and force == False:
                    self.update_in_progress = True
                    self.do_autoupdate(None, True)
Ejemplo n.º 2
0
def download():
    try:
        if not os.path.isdir(__tmp__):
            os.mkdir(__tmp__)
        if not os.path.exists(__tmp__ + __file__):
            oe.download_file(__url__, __tmp__ + __file__)
    except Exception, e:
        oe.notify('Chromium', 'Could not download file')
Ejemplo n.º 3
0
def download():
  try:
    if not os.path.isdir(__tmp__):
      os.mkdir(__tmp__)
    if not os.path.exists(__tmp__ + __file__):
      oe.download_file(__url__, __tmp__ + __file__)
  except Exception, e:
    oe.notify('Chromium', 'Could not download file')
Ejemplo n.º 4
0
 def get_config_file(self):
     config_file = __addon__.getSetting('config_file')
     if config_file == '':
         oe.notify('OpenVPN', 'No Configuration File Selected', icon='eth')
         oe.set_busy(0)
         exit(1)
     else:
         return config_file
 def get_config_file(self):
     config_file = __addon__.getSetting('config_file')
     if config_file == '':
         oe.notify('OpenVPN', 'No Configuration File Selected', icon='eth')
         oe.set_busy(0)
         exit(1)
     else:
         return config_file
Ejemplo n.º 6
0
 def start(self):
     oe.notify('OpenVPN', 'Establishing Connection', icon='eth')
     oe.execute(
         '/storage/.kodi/addons/service.network.openvpn/bin/openvpn --daemon --writepid /var/run/openvpn.pid --log /var/log/openvpn.log --config '
         + self.get_config_file() + ' ' + self.get_custom_options())
     time.sleep(3)
     if self.status():
         oe.notify('OpenVPN', 'Connection Established', icon='eth')
Ejemplo n.º 7
0
 def dbus_error_handler(self, error):
     oe.dbg_log('bluetooth::dbus_error_handler::error', repr(error),
                oe.LOGDEBUG)
     err_message = error.get_dbus_message()
     oe.dbg_log('bluetooth::dbus_error_handler::err_message',
                repr(err_message), oe.LOGDEBUG)
     oe.notify('Bluetooth error', err_message.split('.')[0], 'bt')
     if hasattr(self, 'pinkey_window'):
         self.close_pinkey_window()
     oe.dbg_log('bluetooth::dbus_error_handler',
                'ERROR: (' + err_message + ')', oe.LOGERROR)
Ejemplo n.º 8
0
 def run(self):
     while self.stopped == False:
         if not xbmc.Player().isPlaying():
             oe.dictModules['updates'].check_updates_v2()
         if not hasattr(oe.dictModules['updates'], 'update_in_progress'):
             self.wait_evt.wait(21600)
         else:
             oe.notify(oe._(32363), oe._(32364))
             self.wait_evt.wait(3600)
         self.wait_evt.clear()
     oe.dbg_log('updates::updateThread', 'Stopped', oe.LOGINFO)
Ejemplo n.º 9
0
 def wizard_set_ssh(self):
     if self.struct['ssh']['settings']['ssh_autostart']['value'] == '1':
         self.struct['ssh']['settings']['ssh_autostart']['value'] = '0'
     else:
         self.struct['ssh']['settings']['ssh_autostart']['value'] = '1'
     # ssh button does nothing if "ssh" set on kernel commandline
     with open(self.KERNEL_CMD, 'r') as cmd_file:
         cmd_args = cmd_file.read().split(' ')
     if 'ssh' in cmd_args:
         oe.notify('ssh', 'ssh enabled as boot parameter. can not disable')
     self.initialize_ssh()
     self.load_values()
     if self.struct['ssh']['settings']['ssh_autostart']['value'] == '1':
         self.wizard_sshpasswd()
     self.set_wizard_buttons()
Ejemplo n.º 10
0
 def do_autoupdate(self, listItem=None, silent=False):
     if hasattr(self, 'update_file'):
         if not os.path.exists(self.LOCAL_UPDATE_DIR):
             os.makedirs(self.LOCAL_UPDATE_DIR)
         downloaded = oe.download_file(self.update_file, oe.TEMP + 'update_file', silent)
         if not downloaded is None:
             self.update_file = self.update_file.split('/')[-1]
             if self.struct['update']['settings']['UpdateNotify']['value'] == '1':
                 oe.notify(oe._(32363), oe._(32366))
             shutil.move(oe.TEMP + 'update_file', self.LOCAL_UPDATE_DIR + self.update_file)
             os.sync()
             if silent == False:
                 oe.winOeMain.close()
                 oe.xbmcm.waitForAbort(1)
                 subprocess.call(['/usr/bin/systemctl', '--no-block', 'reboot'], close_fds=True)
         else:
             delattr(self, 'update_in_progress')
Ejemplo n.º 11
0
def install_widevine():
  try:
    download()
    oe.notify('Chromium', 'Extracting libwidevinecdm.so')
    if not os.path.isdir(__tmp__ + __tar__):
      oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__)
    oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __lib__)
    oe.copy_file(__tmp__ + __lib__, __path__ + __lib__.split('/')[-1])
    oe.notify('Chromium', 'Installation of libwidevinecdm.so succeeded')
  except Exception, e:
    oe.notify('Chromium', 'Installation of libwidevinecdm.so failed')
Ejemplo n.º 12
0
def install_widevine():
    try:
        download()
        oe.notify('Chromium', 'Extracting libwidevinecdm.so')
        if not os.path.isdir(__tmp__ + __tar__):
            oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__)
        oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' +
                   __lib__)
        oe.copy_file(__tmp__ + __lib__, __path__ + __lib__.split('/')[-1])
        oe.notify('Chromium', 'Installation of libwidevinecdm.so succeeded')
    except Exception, e:
        oe.notify('Chromium', 'Installation of libwidevinecdm.so failed')
Ejemplo n.º 13
0
def install_flash():
  try:
    download()
    oe.notify('Chromium', 'Extracting libpepflashplayer.so')
    if not os.path.isdir(__tmp__ + __tar__):
      oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__)
    oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __flash__)
    if not os.path.isdir(__path__ + 'PepperFlash'):
      os.mkdir(__path__ + 'PepperFlash')
    oe.copy_file(__tmp__ + __flash__, __path__ + 'PepperFlash/' + __flash__.split('/')[-1])
    oe.notify('Chromium', 'Installation of libpepflashplayer.so succeeded')
  except Exception, e:
    oe.notify('Chromium', 'Installation of libpepflashplayer.so failed')
Ejemplo n.º 14
0
def install_widevine():
  __url__   = 'https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb'
  __file__  = __url__.split('/')[-1]
  __tar__   = 'data.tar.xz'
  __tmp__   = '/tmp/widevine/'
  __lib__   = 'opt/google/chrome/libwidevinecdm.so'
  try:
    if not os.path.isdir(__tmp__):
      os.mkdir(__tmp__)
    if not os.path.exists(__tmp__ + __file__):
      oe.download_file(__url__, __tmp__ + __file__)
    if not os.path.exists(__tmp__ + __file__):
      oe.notify('Chromium', 'Could not download file')
    else:
      oe.notify('Chromium', 'Extracting libwidevinecdm.so')
    if not os.path.isdir(__tmp__ + __tar__):
      oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__)
    oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __lib__)
    oe.copy_file(__tmp__ + __lib__, __path__ + __lib__.split('/')[-1])
    oe.notify('Chromium', 'Installation of libwidevinecdm.so succeeded')
  except Exception, e:
    oe.notify('Chromium', 'Installation of libwidevinecdm.so failed')
Ejemplo n.º 15
0
def install_flash():
    __url__ = 'https://fpdownload.adobe.com/pub/flashplayer/pdc/24.0.0.186/flash_player_ppapi_linux.x86_64.tar.gz'
    __file__ = __url__.split('/')[-1]
    __tmp__ = '/tmp/pepperflash/'
    __lib__ = 'libpepflashplayer.so'
    try:
        if not os.path.isdir(__tmp__):
            os.mkdir(__tmp__)
        if not os.path.exists(__tmp__ + __file__):
            oe.download_file(__url__, __tmp__ + __file__)
        if not os.path.exists(__tmp__ + __file__):
            oe.notify('Chromium', 'Could not download file')
        else:
            oe.notify('Chromium', 'Extracting libpepflashplayer.so')
        if not os.path.isdir(__tmp__ + __file__):
            oe.execute('tar zxf ' + __tmp__ + __file__ + ' -C ' + __tmp__ + '')
        if not os.path.isdir(__path__ + 'PepperFlash'):
            os.mkdir(__path__ + 'PepperFlash')
        oe.copy_file(__tmp__ + __lib__, __path__ + 'PepperFlash/' + __lib__)
        oe.notify('Chromium', 'Installation of libpepflashplayer.so succeeded')
    except Exception, e:
        oe.notify('Chromium', 'Installation of libpepflashplayer.so failed')
Ejemplo n.º 16
0
def install_widevine():
  __url__   = 'https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb'
  __file__  = __url__.split('/')[-1]
  __tar__   = 'data.tar.xz'
  __tmp__   = '/tmp/widevine/'
  __lib__   = 'opt/google/chrome/libwidevinecdm.so'
  try:
    if not os.path.isdir(__tmp__):
      os.mkdir(__tmp__)
    if not os.path.exists(__tmp__ + __file__):
      oe.download_file(__url__, __tmp__ + __file__)
    if not os.path.exists(__tmp__ + __file__):
      oe.notify('Chromium', 'Could not download file')
    else:
      oe.notify('Chromium', 'Extracting libwidevinecdm.so')
    if not os.path.isdir(__tmp__ + __tar__):
      oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__)
    oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __lib__)
    oe.copy_file(__tmp__ + __lib__, __path__ + __lib__.split('/')[-1])
    oe.notify('Chromium', 'Installation of libwidevinecdm.so succeeded')
  except Exception, e:
    oe.notify('Chromium', 'Installation of libwidevinecdm.so failed')
Ejemplo n.º 17
0
def install_flash():
  __url__   = 'https://fpdownload.adobe.com/pub/flashplayer/pdc/24.0.0.186/flash_player_ppapi_linux.x86_64.tar.gz'
  __file__  = __url__.split('/')[-1]
  __tmp__   = '/tmp/pepperflash/'
  __lib__ = 'libpepflashplayer.so'
  try:
    if not os.path.isdir(__tmp__):
      os.mkdir(__tmp__)
    if not os.path.exists(__tmp__ + __file__):
      oe.download_file(__url__, __tmp__ + __file__)
    if not os.path.exists(__tmp__ + __file__):
      oe.notify('Chromium', 'Could not download file')
    else:
      oe.notify('Chromium', 'Extracting libpepflashplayer.so')
    if not os.path.isdir(__tmp__ + __file__):
      oe.execute('tar zxf ' + __tmp__ + __file__ + ' -C ' + __tmp__ + '')
    if not os.path.isdir(__path__ + 'PepperFlash'):
      os.mkdir(__path__ + 'PepperFlash')
    oe.copy_file(__tmp__ + __lib__, __path__ + 'PepperFlash/' + __lib__)
    oe.notify('Chromium', 'Installation of libpepflashplayer.so succeeded')
  except Exception, e:
    oe.notify('Chromium', 'Installation of libpepflashplayer.so failed')
Ejemplo n.º 18
0
def install_flash():
    try:
        download()
        oe.notify('Chromium', 'Extracting libpepflashplayer.so')
        if not os.path.isdir(__tmp__ + __tar__):
            oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__)
        oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' +
                   __flash__)
        if not os.path.isdir(__path__ + 'PepperFlash'):
            os.mkdir(__path__ + 'PepperFlash')
        oe.copy_file(__tmp__ + __flash__,
                     __path__ + 'PepperFlash/' + __flash__.split('/')[-1])
        oe.notify('Chromium', 'Installation of libpepflashplayer.so succeeded')
    except Exception, e:
        oe.notify('Chromium', 'Installation of libpepflashplayer.so failed')
 def stop(self):
     oe.notify('OpenVPN', 'Stopping Connection', icon='eth')
     oe.execute('pkill openvpn')
     time.sleep(3)
     if not self.status():
         oe.notify('OpenVPN', 'Connection Stopped', icon='eth')
Ejemplo n.º 20
0
 def stop(self):
     oe.notify('OpenVPN', 'Stopping Connection', icon='eth')
     oe.execute('pkill openvpn')
     time.sleep(3)
     if not self.status():
         oe.notify('OpenVPN', 'Connection Stopped', icon='eth')
Ejemplo n.º 21
0
 def start(self):
     oe.notify('OpenVPN', 'Establishing Connection', icon='eth')
     oe.execute('/storage/.kodi/addons/service.network.openvpn/bin/openvpn --daemon --writepid /var/run/openvpn.pid --log /var/log/openvpn.log --config ' + self.get_config_file() + ' ' + self.get_custom_options())
     time.sleep(3)
     if self.status():
         oe.notify('OpenVPN', 'Connection Established', icon='eth')