Beispiel #1
0
 def set_wizard_button_2(self, label, modul, action):
     try:
         self.buttons[4]['modul'] = modul
         self.buttons[4]['action'] = action
         self.getControl(self.buttons[4]['id']).setLabel(label)
         self.getControl(self.buttons[4]['id']).setVisible(True)
         self.getControl(self.buttons[4]['id']).controlLeft(
             self.getControl(self.buttons[3]['id']))
         self.getControl(self.buttons[4]['id']).controlDown(
             self.getControl(self.buttons[1]['id']))
         self.getControl(self.buttons[4]['id']).controlRight(
             self.getControl(self.buttons[1]['id']))
         self.getControl(self.buttons[1]['id']).controlUp(
             self.getControl(self.buttons[4]['id']))
         self.getControl(self.buttons[1]['id']).controlLeft(
             self.getControl(self.buttons[4]['id']))
         self.getControl(self.buttons[2]['id']).controlUp(
             self.getControl(self.buttons[4]['id']))
         self.getControl(self.buttons[2]['id']).controlRight(
             self.getControl(self.buttons[1]['id']))
         self.getControl(self.buttons[3]['id']).controlRight(
             self.getControl(self.buttons[4]['id']))
     except Exception as e:
         oe.dbg_log('oeWindows.wizard::set_wizard_button_2()',
                    'ERROR: (' + repr(e) + ')')
Beispiel #2
0
 def showButton(self, number, name):
     try:
         button = self.getControl(self.buttons[number]['id'])
         button.setLabel(oe._(name))
         button.setVisible(True)
     except Exception as e:
         oe.dbg_log(f'oeWindows.wizard::showButton({str(number)})', f'ERROR: ({repr(e)})')
Beispiel #3
0
 def get_rpi_eeprom(self, device):
     values = []
     if os.path.exists(self.RPI_FLASHING_TRIGGER):
         with open(self.RPI_FLASHING_TRIGGER, 'r') as trigger:
             values = trigger.read().split('\n')
     oe.dbg_log('updates::get_rpi_eeprom', f'values: {values}', oe.LOGDEBUG)
     return 'true' if (f'{device}="yes"') in values else 'false'
 def get_channels(self):
     channels = []
     oe.dbg_log('updates::get_channels', str(self.update_json), oe.LOGDEBUG)
     if not self.update_json is None:
         for channel in self.update_json:
             channels.append(channel)
     return sorted(list(set(channels)), key=cmp_to_key(self.custom_sort_train))
Beispiel #5
0
 def onInit(self):
     self.visible = True
     try:
         if self.isChild:
             self.setFocusId(self.guiMenList)
             self.onFocus(self.guiMenList)
             return
         self.setProperty('arch', oe.ARCHITECTURE)
         self.setProperty('distri', oe.DISTRIBUTION)
         self.setProperty('version', oe.VERSION)
         self.setProperty('build', oe.BUILD)
         oe.winOeMain = self
         for strModule in sorted(oe.dictModules, key=lambda x: list(oe.dictModules[x].menu.keys())):
             module = oe.dictModules[strModule]
             oe.dbg_log('init module', strModule, oe.LOGDEBUG)
             if module.ENABLED:
                 if hasattr(module, 'do_init'):
                     Thread(target=module.do_init(), args=()).start()
                 for men in module.menu:
                     if 'listTyp' in module.menu[men] and 'menuLoader' in module.menu[men]:
                         dictProperties = {
                             'modul': strModule,
                             'listTyp': oe.listObject[module.menu[men]['listTyp']],
                             'menuLoader': module.menu[men]['menuLoader'],
                             }
                         if 'InfoText' in module.menu[men]:
                             dictProperties['InfoText'] = oe._(module.menu[men]['InfoText'])
                         self.addMenuItem(module.menu[men]['name'], dictProperties)
         self.setFocusId(self.guiMenList)
         self.onFocus(self.guiMenList)
     except Exception as e:
         oe.dbg_log('oeWindows.mainWindow::onInit', f'ERROR: ({repr(e)})')
Beispiel #6
0
 def onInit(self):
     self.visible = True
     try:
         self.setProperty('arch', oe.ARCHITECTURE)
         self.setProperty('distri', oe.DISTRIBUTION)
         self.setProperty('version', oe.VERSION)
         self.setProperty('build', oe.BUILD)
         oe.dictModules['system'].do_init()
         self.getControl(self.wizWinTitle).setLabel(oe._(32300))
         self.getControl(self.buttons[3]['id']).setVisible(False)
         self.getControl(self.buttons[4]['id']).setVisible(False)
         self.getControl(self.radiobuttons[1]['id']).setVisible(False)
         self.getControl(self.radiobuttons[2]['id']).setVisible(False)
         self.getControl(self.buttons[2]['id']).setVisible(False)
         if oe.BOOT_STATUS == "SAFE":
           self.set_wizard_title(f"[COLOR red][B]{oe._(32393)}[/B][/COLOR]")
           self.set_wizard_text(oe._(32394))
         else:
           self.set_wizard_title(oe._(32301))
           self.set_wizard_text(oe._(32302))
           oe.winOeMain.set_wizard_button_title(oe._(32310))
           cur_lang = xbmc.getLanguage()
           oe.winOeMain.set_wizard_button_1(cur_lang, self, 'wizard_set_language')
         self.showButton(1, 32303)
         self.setFocusId(self.buttons[1]['id'])
     except Exception as e:
         oe.dbg_log('oeWindows.wizard::onInit()', f'ERROR: ({repr(e)})')
Beispiel #7
0
 def set_wizard_radiobutton_2(self, label, modul, action, selected=False):
     try:
         self.radiobuttons[2]['modul'] = modul
         self.radiobuttons[2]['action'] = action
         self.getControl(self.radiobuttons[2]['id']).setLabel(label)
         self.getControl(self.radiobuttons[2]['id']).setVisible(True)
         self.getControl(self.radiobuttons[2]['id']).controlLeft(
             self.getControl(self.radiobuttons[1]['id']))
         self.getControl(self.radiobuttons[2]['id']).controlDown(
             self.getControl(self.buttons[1]['id']))
         self.getControl(self.radiobuttons[2]['id']).controlRight(
             self.getControl(self.buttons[1]['id']))
         self.getControl(self.buttons[1]['id']).controlUp(
             self.getControl(self.radiobuttons[2]['id']))
         self.getControl(self.buttons[1]['id']).controlLeft(
             self.getControl(self.buttons[2]['id']))
         self.getControl(self.buttons[2]['id']).controlUp(
             self.getControl(self.radiobuttons[1]['id']))
         self.getControl(self.buttons[2]['id']).controlRight(
             self.getControl(self.buttons[1]['id']))
         self.getControl(self.radiobuttons[1]['id']).controlRight(
             self.getControl(self.radiobuttons[2]['id']))
         self.getControl(self.radiobuttons[2]['id']).setSelected(selected)
     except Exception as e:
         oe.dbg_log('oeWindows.wizard::set_wizard_button_2()',
                    f'ERROR: ({repr(e)})')
 def get_hardware_flags_dtflag(self):
     if os.path.exists('/usr/bin/dtflag'):
         dtflag = oe.execute('/usr/bin/dtflag', get_result=1).rstrip('\x00\n')
     else:
         dtflag = "unknown"
     oe.dbg_log('system::get_hardware_flags_dtflag', f'ARM board: {dtflag}', oe.LOGDEBUG)
     return dtflag
Beispiel #9
0
 def addMenuItem(self, strName, dictProperties):
     try:
         lstItem = xbmcgui.ListItem(label=oe._(strName))
         for strProp in dictProperties:
             lstItem.setProperty(strProp, str(dictProperties[strProp]))
         self.getControl(self.guiMenList).addItem(lstItem)
     except Exception as e:
         oe.dbg_log(f'oeWindows.mainWindow::addMenuItem({str(strName)})', f'ERROR: ({repr(e)})')
 def get_hardware_flags(self):
     if oe.PROJECT == "Generic":
         return self.get_hardware_flags_x86_64()
     elif oe.ARCHITECTURE.split('.')[1] in ['aarch64', 'arm' ]:
         return self.get_hardware_flags_dtflag()
     else:
         oe.dbg_log('updates::get_hardware_flags', f'Project is {oe.PROJECT}, no hardware flag available', oe.LOGDEBUG)
         return ''
Beispiel #11
0
 def adapter_info(self, adapter, name):
     adapter_interface = dbus.Interface(
         oe.dbusSystemBus.get_object('org.bluez', adapter.object_path),
         'org.freedesktop.DBus.Properties')
     res = adapter_interface.Get('org.bluez.Adapter1', name)
     adapter_interface = None
     oe.dbg_log('bluetooth::adapter_info', 'exit_function', oe.LOGDEBUG)
     return res
Beispiel #12
0
 def addConfigItem(self, strName, dictProperties, strType):
     try:
         lstItem = xbmcgui.ListItem(label=strName)
         for strProp in dictProperties:
             lstItem.setProperty(strProp, str(dictProperties[strProp]))
         self.getControl(int(strType)).addItem(lstItem)
         return lstItem
     except Exception as e:
         oe.dbg_log(f'oeWindows.wizard::addConfigItem({strName})', f'ERROR: ({repr(e)})')
Beispiel #13
0
def startChromium(args):
  oe.execute('chmod +x ' + __path__ + 'chromium')
  oe.execute('chmod +x ' + __path__ + 'chromium.bin')
  oe.execute('chmod 4755 ' + __path__ + 'chrome-sandbox')

  try:
    window_mode = {
      'maximized': '--start-maximized',
      'kiosk': '--kiosk',
      'none': '',
    }

    raster_mode = {
      'default': '',
      'off': '--disable-accelerated-2d-canvas --disable-gpu-compositing',
      'force': '--enable-gpu-rasterization --enable-accelerated-2d-canvas --ignore-gpu-blacklist',
    }

    new_env = os.environ.copy()
    vaapi_mode = __addon__.getSetting('VAAPI_MODE')
    gpu_accel_mode = ''
    if vaapi_mode == 'intel':
      new_env['LIBVA_DRIVERS_PATH'] = '/usr/lib/va'
      new_env['LIBVA_DRIVER_NAME'] = 'i965'
    elif vaapi_mode == 'amd':
      new_env['LIBVA_DRIVERS_PATH'] = os.path.join(__addon__.getAddonInfo('path'), 'lib')
      new_env['LIBVA_DRIVER_NAME'] = 'vdpau'
    elif vaapi_mode == 'nvidia':
      new_env['LIBVA_DRIVERS_PATH'] = os.path.join(__addon__.getAddonInfo('path'), 'lib')
      new_env['LIBVA_DRIVER_NAME'] = 'vdpau'
      gpu_accel_mode = '--allow-no-sandbox-job --disable-gpu-sandbox'
    else:
      new_env['LIBGL_ALWAYS_SOFTWARE'] = '1'

    flash_plugin = ''
    if os.path.exists(__path__ + 'PepperFlash/libpepflashplayer.so'):
      flash_plugin = '--ppapi-flash-path=' + __path__ + 'PepperFlash/libpepflashplayer.so'

    if __addon__.getSetting('USE_CUST_AUDIODEVICE') == 'true':
      alsa_device = __addon__.getSetting('CUST_AUDIODEVICE_STR')
    else:
      alsa_device = getAudioDevice()
    alsa_param = ''
    if not alsa_device == None and not alsa_device == '':
      alsa_param = '--alsa-output-device=' + alsa_device

    chrome_params = window_mode.get(__addon__.getSetting('WINDOW_MODE')) + ' ' + \
                    raster_mode.get(__addon__.getSetting('RASTER_MODE')) + ' ' + \
                    flash_plugin + ' ' + \
                    gpu_accel_mode + ' ' + \
                    alsa_param + ' ' + \
                    args + ' ' + \
                    __addon__.getSetting('HOMEPAGE')
    subprocess.call(__path__ + 'chromium ' + chrome_params, shell=True, env=new_env)
  except Exception, e:
    oe.dbg_log('chromium', unicode(e))
Beispiel #14
0
def startChromium(args):
  oe.execute('chmod +x ' + __path__ + 'chromium')
  oe.execute('chmod +x ' + __path__ + 'chromium.bin')
  oe.execute('chmod 4755 ' + __path__ + 'chrome-sandbox')

  try:
    window_mode = {
      'maximized': '--start-maximized',
      'kiosk': '--kiosk',
      'none': '',
    }

    raster_mode = {
      'default': '',
      'off': '--disable-accelerated-2d-canvas --disable-gpu-compositing',
      'force': '--enable-gpu-rasterization --enable-accelerated-2d-canvas --ignore-gpu-blacklist',
    }

    new_env = os.environ.copy()
    vaapi_mode = __addon__.getSetting('VAAPI_MODE')
    gpu_accel_mode = ''
    if vaapi_mode == 'intel':
      new_env['LIBVA_DRIVERS_PATH'] = '/usr/lib/va'
      new_env['LIBVA_DRIVER_NAME'] = 'i965'
    elif vaapi_mode == 'amd':
      new_env['LIBVA_DRIVERS_PATH'] = os.path.join(__addon__.getAddonInfo('path'), 'lib')
      new_env['LIBVA_DRIVER_NAME'] = 'vdpau'
    elif vaapi_mode == 'nvidia':
      new_env['LIBVA_DRIVERS_PATH'] = os.path.join(__addon__.getAddonInfo('path'), 'lib')
      new_env['LIBVA_DRIVER_NAME'] = 'vdpau'
      gpu_accel_mode = '--allow-no-sandbox-job --disable-gpu-sandbox'
    else:
      new_env['LIBGL_ALWAYS_SOFTWARE'] = '1'

    flash_plugin = ''
    if os.path.exists(__path__ + 'PepperFlash/libpepflashplayer.so'):
      flash_plugin = '--ppapi-flash-path=' + __path__ + 'PepperFlash/libpepflashplayer.so'

    if __addon__.getSetting('USE_CUST_AUDIODEVICE') == 'true':
      alsa_device = __addon__.getSetting('CUST_AUDIODEVICE_STR')
    else:
      alsa_device = getAudioDevice()
    alsa_param = ''
    if not alsa_device == None and not alsa_device == '':
      alsa_param = '--alsa-output-device=' + alsa_device

    chrome_params = window_mode.get(__addon__.getSetting('WINDOW_MODE')) + ' ' + \
                    raster_mode.get(__addon__.getSetting('RASTER_MODE')) + ' ' + \
                    flash_plugin + ' ' + \
                    gpu_accel_mode + ' ' + \
                    alsa_param + ' ' + \
                    args + ' ' + \
                    __addon__.getSetting('HOMEPAGE')
    subprocess.call(__path__ + 'chromium ' + chrome_params, shell=True, env=new_env)
  except Exception, e:
    oe.dbg_log('chromium', unicode(e))
 def set_auto_update(self, listItem=None):
     if not listItem == None:
         self.set_value(listItem)
     if not hasattr(self, 'update_disabled'):
         if not hasattr(self, 'update_thread'):
             self.update_thread = updateThread(oe)
             self.update_thread.start()
         else:
             self.update_thread.wait_evt.set()
         oe.dbg_log('updates::set_auto_update', str(self.struct['update']['settings']['AutoUpdate']['value']), oe.LOGINFO)
    def load_values(self):
        # Hardware flags
        self.hardware_flags = self.get_hardware_flags()
        oe.dbg_log('system::load_values', f'loaded hardware_flag {self.hardware_flags}', oe.LOGDEBUG)

        # AutoUpdate

        value = oe.read_setting('updates', 'AutoUpdate')
        if not value is None:
            self.struct['update']['settings']['AutoUpdate']['value'] = value
        value = oe.read_setting('updates', 'SubmitStats')
        if not value is None:
            self.struct['update']['settings']['SubmitStats']['value'] = value
        value = oe.read_setting('updates', 'UpdateNotify')
        if not value is None:
            self.struct['update']['settings']['UpdateNotify']['value'] = value
        if os.path.isfile(f'{self.LOCAL_UPDATE_DIR}/SYSTEM'):
            self.update_in_progress = True

        # Manual Update

        value = oe.read_setting('updates', 'Channel')
        if not value is None:
            self.struct['update']['settings']['Channel']['value'] = value
        value = oe.read_setting('updates', 'ShowCustomChannels')
        if not value is None:
            self.struct['update']['settings']['ShowCustomChannels']['value'] = value

        value = oe.read_setting('updates', 'CustomChannel1')
        if not value is None:
            self.struct['update']['settings']['CustomChannel1']['value'] = value
        value = oe.read_setting('updates', 'CustomChannel2')
        if not value is None:
            self.struct['update']['settings']['CustomChannel2']['value'] = value
        value = oe.read_setting('updates', 'CustomChannel3')
        if not value is None:
            self.struct['update']['settings']['CustomChannel3']['value'] = value

        self.update_json = self.build_json()

        self.struct['update']['settings']['Channel']['values'] = self.get_channels()
        self.struct['update']['settings']['Build']['values'] = self.get_available_builds()

        # RPi4 EEPROM updating
        if oe.RPI_CPU_VER == '3':
            self.rpi_flashing_state = self.get_rpi_flashing_state()
            if self.rpi_flashing_state['incompatible']:
                self.struct['rpieeprom']['hidden'] = 'true'
            else:
                self.struct['rpieeprom']['settings']['bootloader']['value'] = self.get_rpi_eeprom('BOOTLOADER')
                self.struct['rpieeprom']['settings']['bootloader']['name'] = f"{oe._(32024)} ({self.rpi_flashing_state['bootloader']['state']})"
                self.struct['rpieeprom']['settings']['vl805']['value'] = self.get_rpi_eeprom('VL805')
                self.struct['rpieeprom']['settings']['vl805']['name'] = f"{oe._(32026)} ({self.rpi_flashing_state['vl805']['state']})"
        else:
            self.struct['rpieeprom']['hidden'] = 'true'
Beispiel #17
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)
Beispiel #18
0
 def build_menu(self, struct, fltr=[], optional='0'):
     try:
         self.getControl(1100).reset()
         m_menu = []
         for category in sorted(struct, key=lambda x: struct[x]['order']):
             if not 'hidden' in struct[category]:
                 if fltr == []:
                     m_entry = {}
                     m_entry['name'] = oe._(struct[category]['name'])
                     m_entry['properties'] = {'typ': 'separator'}
                     m_entry['list'] = 1100
                     m_menu.append(m_entry)
                 else:
                     if category not in fltr:
                         continue
                 for entry in sorted(struct[category]['settings'], key=lambda x: struct[category]['settings'][x]['order']):
                     setting = struct[category]['settings'][entry]
                     if not 'hidden' in setting:
                         dictProperties = {
                             'value': setting['value'],
                             'typ': setting['type'],
                             'entry': entry,
                             'category': category,
                             'action': setting['action'],
                             }
                         if 'InfoText' in setting:
                             dictProperties['InfoText'] = oe._(setting['InfoText'])
                         if 'validate' in setting:
                             dictProperties['validate'] = setting['validate']
                         if 'values' in setting:
                             dictProperties['values'] = '|'.join(setting['values'])
                         if isinstance(setting['name'], str):
                             name = setting['name']
                         else:
                             name = oe._(setting['name'])
                             dictProperties['menuname'] = oe._(setting['name'])
                         m_entry = {}
                         if not 'parent' in setting:
                             m_entry['name'] = name
                             m_entry['properties'] = dictProperties
                             m_entry['list'] = 1100
                             m_menu.append(m_entry)
                         else:
                             if struct[category]['settings'][setting['parent']['entry']]['value'] in setting['parent']['value']:
                                 if not 'optional' in setting or 'optional' in setting and optional != '0':
                                     m_entry['name'] = name
                                     m_entry['properties'] = dictProperties
                                     m_entry['list'] = 1100
                                     m_menu.append(m_entry)
         for m_entry in m_menu:
             self.addConfigItem(m_entry['name'], m_entry['properties'], m_entry['list'])
     except Exception as e:
         oe.dbg_log('oeWindows.mainWindow::build_menu', f'ERROR: ({repr(e)})')
 def remove_device(self, listItem=None):
     if listItem is None:
         listItem = oe.winOeMain.getControl(
             oe.listObject['btlist']).getSelectedItem()
     if listItem is None:
         return
     oe.dbg_log('bluetooth::remove_device->entry::',
                listItem.getProperty('entry'), oe.LOGDEBUG)
     path = listItem.getProperty('entry')
     dbus_bluez.adapter_remove_device(self.dbusBluezAdapter, path)
     self.disable_device_standby(listItem)
     self.menu_connections()
 def set_rpi_eeprom(self):
     bootloader = (self.struct['rpieeprom']['settings']['bootloader']['value'] == 'true')
     vl805 = (self.struct['rpieeprom']['settings']['vl805']['value'] == 'true')
     oe.dbg_log('updates::set_rpi_eeprom', f'states: [{bootloader}], [{vl805}]', oe.LOGDEBUG)
     if bootloader or vl805:
         values = []
         values.append('BOOTLOADER="%s"' % ('yes' if bootloader else 'no'))
         values.append('VL805="%s"' % ('yes' if vl805 else 'no'))
         with open(self.RPI_FLASHING_TRIGGER, 'w') as trigger:
             trigger.write('\n'.join(values))
     else:
         if os.path.exists(self.RPI_FLASHING_TRIGGER):
             os.remove(self.RPI_FLASHING_TRIGGER)
Beispiel #21
0
 def adapter_powered(self, adapter, state=1):
     if int(self.adapter_info(self.dbusBluezAdapter, 'Powered')) != state:
         oe.dbg_log('bluetooth::adapter_powered',
                    'set state (' + str(state) + ')', oe.LOGDEBUG)
         adapter_interface = dbus.Interface(
             oe.dbusSystemBus.get_object('org.bluez', adapter.object_path),
             'org.freedesktop.DBus.Properties')
         adapter_interface.Set(
             'org.bluez.Adapter1', 'Alias',
             dbus.String(os.environ.get('HOSTNAME', 'libreelec')))
         adapter_interface.Set('org.bluez.Adapter1', 'Powered',
                               dbus.Boolean(state))
         adapter_interface = None
Beispiel #22
0
 def get_hardware_flags_x86_64(self):
     gpu_props = {}
     gpu_driver = ""
     gpu_card = self.get_gpu_card()
     oe.dbg_log('updates::get_hardware_flags_x86_64',
                f'Using card: {gpu_card}', oe.LOGDEBUG)
     gpu_path = oe.execute(
         f'/usr/bin/udevadm info --name=/dev/dri/{gpu_card} --query path 2>/dev/null',
         get_result=1).replace('\n', '')
     oe.dbg_log('updates::get_hardware_flags_x86_64',
                f'gpu path: {gpu_path}', oe.LOGDEBUG)
     if gpu_path:
         drv_path = os.path.dirname(os.path.dirname(gpu_path))
         props = oe.execute(
             f'/usr/bin/udevadm info --path={drv_path} --query=property 2>/dev/null',
             get_result=1)
         if props:
             for key, value in [
                     x.strip().split('=') for x in props.strip().split('\n')
             ]:
                 gpu_props[key] = value
         oe.dbg_log('updates::get_gpu_type', f'gpu props: {gpu_props}',
                    oe.LOGDEBUG)
         gpu_driver = gpu_props.get("DRIVER", "")
     if not gpu_driver:
         gpu_driver = oe.execute(
             'lspci -k | grep -m1 -A999 "VGA compatible controller" | grep -m1 "Kernel driver in use" | cut -d" " -f5',
             get_result=1).replace('\n', '')
     if gpu_driver == 'nvidia' and os.path.realpath(
             '/var/lib/nvidia_drv.so').endswith('nvidia-legacy_drv.so'):
         gpu_driver = 'nvidia-legacy'
     oe.dbg_log('updates::get_hardware_flags_x86_64',
                f'gpu driver: {gpu_driver}', oe.LOGDEBUG)
     return gpu_driver if gpu_driver else "unknown"
 def authorize_push(self, transfer):
     xbmcDialog = xbmcgui.Dialog()
     properties = self.transfer_get_all_properties(transfer)
     answer = xbmcDialog.yesno('Bluetooth',
                               f"{oe._(32381)}\n\n{properties['Name']}")
     oe.dbg_log('bluetooth::obexAgent::AuthorizePush::answer=',
                repr(answer), oe.LOGDEBUG)
     if answer != 1:
         self.reject('Not Authorized')
     self.parent.download_path = transfer
     self.parent.download_file = properties['Name']
     self.parent.download_size = properties['Size'] / 1024
     if 'Type' in properties:
         self.parent.download_type = properties['Type']
     else:
         self.parent.download_type = None
     return properties['Name']
Beispiel #24
0
 def DisplayPinCode(self, device, pincode):
     try:
         oe.dbg_log('bluetooth::btAgent::DisplayPinCode', 'enter_function',
                    oe.LOGDEBUG)
         oe.dbg_log('bluetooth::btAgent::DisplayPinCode::device=',
                    repr(device), oe.LOGDEBUG)
         oe.dbg_log('bluetooth::btAgent::DisplayPinCode::pincode=',
                    repr(pincode), oe.LOGDEBUG)
         if hasattr(self.parent, 'pinkey_window'):
             self.parent.close_pinkey_window()
         self.parent.open_pinkey_window(runtime=30)
         self.parent.pinkey_window.device = device
         self.parent.pinkey_window.set_label1(f'PIN code: {pincode}')
         oe.dbg_log('bluetooth::btAgent::DisplayPinCode', 'exit_function',
                    oe.LOGDEBUG)
     except Exception as e:
         oe.dbg_log('bluetooth::btAgent::DisplayPinCode',
                    'ERROR: (' + repr(e) + ')', oe.LOGERROR)
Beispiel #25
0
 def onAction(self, action):
     try:
         focusId = self.getFocusId()
         actionId = int(action.getId())
         if focusId == 2222:
             if actionId == 61453:
                 return
         if actionId in oe.CANCEL:
             self.visible = False
             self.close()
         if focusId == self.guiList:
             curPos = self.getControl(focusId).getSelectedPosition()
             listSize = self.getControl(focusId).size()
             newPos = curPos
             nextItem = self.getControl(focusId).getListItem(newPos)
             if (curPos != self.lastGuiList or nextItem.getProperty('typ')
                     == 'separator') and actionId in [
                         2,
                         3,
                         4,
                     ]:
                 while nextItem.getProperty('typ') == 'separator':
                     if actionId == 2:
                         newPos = newPos + 1
                     if actionId == 3:
                         newPos = newPos - 1
                     if actionId == 4:
                         newPos = newPos + 1
                     if newPos <= 0:
                         newPos = listSize - 1
                     if newPos >= listSize:
                         newPos = 0
                     nextItem = self.getControl(focusId).getListItem(newPos)
                 self.lastGuiList = newPos
                 self.getControl(focusId).selectItem(newPos)
                 self.setProperty('InfoText',
                                  nextItem.getProperty('InfoText'))
         if focusId == self.guiMenList:
             self.setFocusId(focusId)
     except Exception as e:
         oe.dbg_log(f'oeWindows.mainWindow::onAction({str(action)})',
                    f'ERROR: ({repr(e)})')
         if actionId in oe.CANCEL:
             self.close()
Beispiel #26
0
 def RequestPinCode(self, device):
     try:
         oe.dbg_log('bluetooth::btAgent::RequestPinCode', 'enter_function',
                    oe.LOGDEBUG)
         oe.dbg_log('bluetooth::btAgent::RequestPinCode::device=',
                    repr(device), oe.LOGDEBUG)
         oe.input_request = True
         xbmcKeyboard = xbmc.Keyboard('', 'Enter PIN code')
         xbmcKeyboard.doModal()
         pincode = xbmcKeyboard.getText()
         self.busy()
         oe.dbg_log('bluetooth::btAgent::RequestPinCode',
                    'return->' + pincode, oe.LOGDEBUG)
         oe.dbg_log('bluetooth::btAgent::RequestPinCode', 'exit_function',
                    oe.LOGDEBUG)
         return dbus.String(pincode)
     except Exception as e:
         oe.dbg_log('bluetooth::btAgent::RequestPinCode',
                    'ERROR: (' + repr(e) + ')', oe.LOGERROR)
Beispiel #27
0
def startchrome(args):
  try:
    new_env = os.environ.copy()
    new_env['VAAPI_MODE'] = __addon__.getSetting('VAAPI_MODE')
    new_env['WINDOW_MODE'] = __addon__.getSetting('WINDOW_MODE')
    new_env['RASTER_MODE'] = __addon__.getSetting('RASTER_MODE')

    new_env['ALSA_DEVICE'] = ''
    if __addon__.getSetting('USE_CUST_AUDIODEVICE') == 'true':
      alsa_device = __addon__.getSetting('CUST_AUDIODEVICE_STR')
    else:
      alsa_device = getAudioDevice()
    if not alsa_device == None and not alsa_device == '':
      new_env['ALSA_DEVICE'] = alsa_device

    chrome_params = args + ' ' + \
                    __addon__.getSetting('HOMEPAGE')
    subprocess.call(__path__ + 'chrome-start ' + chrome_params, shell=True, env=new_env)
  except Exception, e:
    oe.dbg_log('chrome', unicode(e))
Beispiel #28
0
 def RequestPasskey(self, device):
     try:
         oe.dbg_log('bluetooth::btAgent::RequestPasskey', 'enter_function',
                    oe.LOGDEBUG)
         oe.dbg_log('bluetooth::btAgent::RequestPasskey::device=',
                    repr(device), oe.LOGDEBUG)
         oe.input_request = True
         xbmcDialog = xbmcgui.Dialog()
         passkey = int(
             xbmcDialog.numeric(0, 'Enter passkey (number in 0-999999)',
                                '0'))
         oe.dbg_log('bluetooth::btAgent::RequestPasskey::passkey=',
                    repr(passkey), oe.LOGDEBUG)
         self.busy()
         oe.dbg_log('bluetooth::btAgent::RequestPasskey', 'exit_function',
                    oe.LOGDEBUG)
         return dbus.UInt32(passkey)
     except Exception as e:
         oe.dbg_log('bluetooth::btAgent::RequestPasskey',
                    'ERROR: (' + repr(e) + ')', oe.LOGERROR)
Beispiel #29
0
def startchrome(args):
  try:
    new_env = os.environ.copy()
    new_env['VAAPI_MODE'] = __addon__.getSetting('VAAPI_MODE')
    new_env['WINDOW_MODE'] = __addon__.getSetting('WINDOW_MODE')
    new_env['RASTER_MODE'] = __addon__.getSetting('RASTER_MODE')

    new_env['ALSA_DEVICE'] = ''
    if __addon__.getSetting('USE_CUST_AUDIODEVICE') == 'true':
      alsa_device = __addon__.getSetting('CUST_AUDIODEVICE_STR')
    else:
      alsa_device = getAudioDevice()
    if not alsa_device == None and not alsa_device == '':
      new_env['ALSA_DEVICE'] = alsa_device

    chrome_params = args + ' ' + \
                    __addon__.getSetting('HOMEPAGE')
    subprocess.call(__path__ + 'chrome-start ' + chrome_params, shell=True, env=new_env)
  except Exception, e:
    oe.dbg_log('chrome', unicode(e))
Beispiel #30
0
 def onFocus(self, controlID):
     try:
         if controlID in self.guiLists:
             currentEntry = self.getControl(controlID).getSelectedPosition()
             selectedEntry = self.getControl(controlID).getSelectedItem()
             if controlID == self.guiList:
                 self.setProperty('InfoText', selectedEntry.getProperty('InfoText'))
             if currentEntry != self.lastGuiList:
                 self.lastGuiList = currentEntry
                 if selectedEntry is not None:
                     strHoover = selectedEntry.getProperty('hooverValidate')
                     if strHoover != '':
                         if hasattr(oe.dictModules[selectedEntry.getProperty('modul')], strHoover):
                             self.emptyButtonLabels()
                             getattr(oe.dictModules[selectedEntry.getProperty('modul')], strHoover)(selectedEntry)
         if controlID == self.guiMenList:
             lastMenu = self.getControl(controlID).getSelectedPosition()
             selectedMenuItem = self.getControl(controlID).getSelectedItem()
             self.setProperty('InfoText', selectedMenuItem.getProperty('InfoText'))
             if lastMenu != self.lastMenu:
                 if self.lastListType == int(selectedMenuItem.getProperty('listTyp')):
                     self.getControl(int(selectedMenuItem.getProperty('listTyp'))).setAnimations([('conditional',
                             'effect=fade start=100 end=0 time=100 condition=True')])
                 self.getControl(1100).setAnimations([('conditional', 'effect=fade start=0 end=0 time=1 condition=True')])
                 self.getControl(1200).setAnimations([('conditional', 'effect=fade start=0 end=0 time=1 condition=True')])
                 self.getControl(1300).setAnimations([('conditional', 'effect=fade start=0 end=0 time=1 condition=True')])
                 self.getControl(1900).setAnimations([('conditional', 'effect=fade start=0 end=0 time=1 condition=True')])
                 self.lastModul = selectedMenuItem.getProperty('Modul')
                 self.lastMenu = lastMenu
                 for btn in self.buttons:
                     self.getControl(self.buttons[btn]['id']).setVisible(False)
                 strMenuLoader = selectedMenuItem.getProperty('menuLoader')
                 objList = self.getControl(int(selectedMenuItem.getProperty('listTyp')))
                 self.getControl(controlID).controlRight(objList)
                 if strMenuLoader != '':
                     if hasattr(oe.dictModules[selectedMenuItem.getProperty('modul')], strMenuLoader):
                         getattr(oe.dictModules[selectedMenuItem.getProperty('modul')], strMenuLoader)(selectedMenuItem)
                 self.getControl(int(selectedMenuItem.getProperty('listTyp'))).setAnimations([('conditional',
                         'effect=fade start=0 end=100 time=100 condition=true')])
     except Exception as e:
         oe.dbg_log(f'oeWindows.mainWindow::onFocus({repr(controlID)})', f'ERROR: ({repr(e)})')
Beispiel #31
0
 def RequestAuthorization(self, device):
     try:
         oe.dbg_log('bluetooth::btAgent::RequestAuthorization',
                    'enter_function', oe.LOGDEBUG)
         oe.dbg_log('bluetooth::btAgent::RequestAuthorization::device=',
                    repr(device), oe.LOGDEBUG)
         oe.input_request = True
         xbmcDialog = xbmcgui.Dialog()
         answer = xbmcDialog.yesno('Bluetooth', 'Accept pairing?')
         oe.dbg_log('bluetooth::btAgent::RequestAuthorization::answer=',
                    repr(answer), oe.LOGDEBUG)
         self.busy()
         oe.dbg_log('bluetooth::btAgent::RequestAuthorization',
                    'exit_function', oe.LOGDEBUG)
         if answer == 1:
             oe.dictModules['bluetooth'].trust_device(device)
             return
         raise Rejected('Pairing rejected')
     except Exception as e:
         oe.dbg_log('bluetooth::btAgent::RequestAuthorization',
                    'ERROR: (' + repr(e) + ')', oe.LOGERROR)
Beispiel #32
0
 def wizard_set_language(self):
     global lang_str
     global lang_new
     try:
         oe.dbg_log('oeWindows::wizard_set_language', 'enter_function', oe.LOGDEBUG)
         langCodes = {"Bulgarian":"resource.language.bg_bg","Czech":"resource.language.cs_cz","German":"resource.language.de_de","English":"resource.language.en_gb","Spanish":"resource.language.es_es","Basque":"resource.language.eu_es","Finnish":"resource.language.fi_fi","French":"resource.language.fr_fr","Hebrew":"resource.language.he_il","Hungarian":"resource.language.hu_hu","Italian":"resource.language.it_it","Lithuanian":"resource.language.lt_lt","Latvian":"resource.language.lv_lv","Norwegian":"resource.language.nb_no","Dutch":"resource.language.nl_nl","Polish":"resource.language.pl_pl","Portuguese (Brazil)":"resource.language.pt_br","Portuguese":"resource.language.pt_pt","Romanian":"resource.language.ro_ro","Russian":"resource.language.ru_ru","Slovak":"resource.language.sk_sk","Swedish":"resource.language.sv_se","Turkish":"resource.language.tr_tr","Ukrainian":"resource.language.uk_ua"}
         languagesList = sorted(list(langCodes.keys()))
         cur_lang = xbmc.getLanguage()
         for index, lang in enumerate(languagesList):
             if cur_lang in lang:
                 langIndex = index
                 break
             else:
                 pass
         selLanguage = xbmcDialog.select(oe._(32310), languagesList, preselect=langIndex)
         if selLanguage >= 0:
             langKey = languagesList[selLanguage]
             lang_new = langCodes[langKey]
             if lang_new == "resource.language.en_gb":
                 oe.write_setting("system", "language", "")
             else:
                 oe.write_setting("system", "language", str(lang_new))
             lang_str = 'SetGUILanguage(' + str(lang_new) + ')'
             self.getControl(self.wizWinTitle).setLabel(oe._(32300))
             self.set_wizard_title(oe._(32301))
             self.set_wizard_text(oe._(32302))
             oe.winOeMain.set_wizard_button_title(oe._(32310))
             oe.winOeMain.set_wizard_button_1(langKey, self, 'wizard_set_language')
             self.showButton(1, 32303)
             self.setFocusId(self.buttons[1]['id'])
         oe.dbg_log('oeWindows::wizard_set_language', 'exit_function', oe.LOGDEBUG)
     except Exception as e:
         oe.dbg_log('oeWindows::wizard_set_language', f'ERROR: ({repr(e)})')
Beispiel #33
0
    else:
      # not ALSA
      return None
  except:
    return None
  if dev.startswith("CARD="):
    dev = "plughw:" + dev
  return dev

if (not __addon__.getSetting("firstrun")):
  __addon__.setSetting("firstrun", "1")
  __addon__.openSettings()

try:
  args = ' '.join(sys.argv[1:])
except:
  args = ""

oe.dbg_log('chromium', "'" + unicode(args) + "'")

if args == 'widevine':
    widevine()
else:
  if not isRuning('chromium.bin'):
    pauseXbmc()
    startChromium(args)
    while isRuning('chromium.bin'):
      time.sleep(1)
    resumeXbmc()