Exemple #1
0
 def wrapper(*args, **kwds):
     if xbmcgui.getCurrentWindowId() == WEATHER_WINDOW_ID or xbmcgui.getCurrentWindowId() == SETTINGS_WINDOW_ID:
         xbmc.executebuiltin( "ActivateWindow(busydialog)" )
     try:
         return f(*args, **kwds)
     finally:
         xbmc.executebuiltin( "Dialog.Close(busydialog)" )
Exemple #2
0
	def writeMsg(self, line1, line2, line3, count=0):
		
		if self.windowID != xbmcgui.getCurrentWindowId():
			self.windowID = xbmcgui.getCurrentWindowId()
			if xbmcgui.getCurrentWindowId() in ALLOWEDWINDOWS:			
			 self.paintProgress()
		
		#check if action was canceled from RCB						  
		scrapeOnStartupAction = util.getSettings().getSetting(util.SETTING_RCB_SCRAPEONSTARTUPACTION)
		if (scrapeOnStartupAction == 'cancel'):
			self.label.setLabel("%d %% - %s" % (100, 'Update canceled'))
			return False
		
		if not self.label:
		  return True  
		elif (count > 0):
			percent = int(count * (float(100) / self.itemCount))
			self.header.setLabel(line1)
			self.label.setLabel("%d %% - %s" % (percent, line2))
			self.progress.setPercent(percent)
		else:			
			self.window.remove(self.image)
			self.window.remove(self.header)
			self.window.remove(self.label)
			self.window.remove(self.progress)
			
		return True
def refresh_slideshow(driveid, item_id, child_count, waitForSlideshow):
    onedrive = onedrives[driveid]
    if waitForSlideshow:
        print 'Waiting up to 10 minutes until the slideshow of folder ' + item_id + ' starts...'
        current_time = time.time()
        max_waiting_time = current_time + 10 * 60
        while not cancelOperation(onedrive) and xbmcgui.getCurrentWindowId() != 12007 and max_waiting_time > current_time:
            if monitor.waitForAbort(2):
                break
            current_time = time.time()
        print_slideshow_info(onedrive)
    interval = addon.getSetting('slideshow_refresh_interval')
    print 'Waiting up to ' + interval + ' minute(s) to check if it is needed to refresh the slideshow of folder ' + item_id + '...'
    current_time = time.time()
    target_time = current_time + int(interval) * 60
    while not cancelOperation(onedrive) and target_time > current_time and xbmcgui.getCurrentWindowId() == 12007:
        if monitor.waitForAbort(10):
            break
        current_time = time.time()
    print_slideshow_info(onedrive)
    if not cancelOperation(onedrive) and xbmcgui.getCurrentWindowId() == 12007:
        try:
            start_auto_refreshed_slideshow(driveid, item_id, child_count)
        except Exception as e:
            print 'Slideshow fails to auto refresh. Will be restarted when possible. Error: '
            if isinstance(e, OneDriveException):
                try:
                    print ''.join(traceback.format_exception(type(e.origin), e.origin, e.tb))
                except:
                    traceback.print_exc()
            else:
                traceback.print_exc()
            refresh_slideshow(driveid, item_id, -1, waitForSlideshow)
    else:
        print 'Slideshow is not running anymore or abort requested.'
 def isChangeTheme(self):
     id = xbmc.getInfoLabel('ListItem.Property(ItemGUID)')
     WINDOW = xbmcgui.Window( 10025 )
     if id == '' and xbmcgui.getCurrentWindowId() == 10025:    
        id =  WINDOW.getProperty("ItemGUID")
     if id == '' and xbmcgui.getCurrentWindowId() == 10000:    
        id =  xbmcgui.Window( 10000 ).getProperty("ItemGUID")
     if id != "":
         if self.volume == '':
             self.volume = self.getVolume()
         # we have something to start with
         addonSettings = xbmcaddon.Addon(id='plugin.video.xbmb3c') 
         if addonSettings.getSetting('useThemeMusic') == "true" or addonSettings.getSetting('useThemeMovies') == "true" :
           # cool theme music is on continue
           if id == self.themeId:
               # same as before now do we need to restart 
               if ((addonSettings.getSetting('loopThemeMusic') == "true"  and self.playingMovie == False) or (addonSettings.getSetting('loopThemeMovies') == "true" and self.playingMovie == True))  and xbmc.Player().isPlaying() == False:
                   self.logMsg("isChangeTheme restart true")
                   return True
           if id != self.themeId:
               # new id return true
               self.logMsg("isChangeTheme new id restart true")
               return True  
           
     # still here return False
     self.logMsg("isChangeTheme restart false") 
     return False 
 def isPlayingZone(self):
     if "plugin://plugin.video.xbmb3c" in xbmc.getInfoLabel( "ListItem.Path" ):
         return True
     if xbmcgui.getCurrentWindowId() == 10025 or xbmcgui.getCurrentWindowId() == 10000:
         return True 
     
     # Any other area is deemed to be a non play area
     return False 
Exemple #6
0
 def _read_dir(self, dir):  
     #xbmc.executebuiltin("Notification(Drawers, Reading: %s, 3000, C:/Users/Programming/AppData/Roaming/Kodi/addons/plugin.video.drawers/icon.png)" % dir  ) 
     viewmode = xbmcgui.Window(xbmcgui.getCurrentWindowId()).getFocusId()
     data = self._get_json().Files.GetDirectory(directory=dir, properties=file_info)
     if xbmcgui.Window(xbmcgui.getCurrentWindowId()).getFocusId() != viewmode:
         xbmc.executebuiltin('Container.setViewmode(%d)' % viewmode)
     if data is None or not data.has_key('files'):
         return []
     return [clean(d) for d in data['files']]
Exemple #7
0
 def onFocus(self, controlID):
      # self.getControl(32204).setEnabled(0)
     WINDOW = xbmcgui.Window(xbmcgui.getCurrentWindowId())
     if __bLogging__ == "true":xbmc.log("SPY Window " +str(xbmcgui.getCurrentWindowId()))
     self.playmates = WINDOW.getProperty("playmates")
     if WINDOW.getProperty("playmates") != "":
         # try:
          self.players = WINDOW.getProperty("playmates")
     if __bLogging__ == "true":xbmc.log("SPY retrieved property" +str(self.playmates))
Exemple #8
0
def getCurrentWindowId():
    winID = xbmcgui.getCurrentWindowId()
    tries = 10

    while winID == 10000 and tries > 0:
        xbmc.sleep(100)
        tries -= 1
        winID = xbmcgui.getCurrentWindowId()

    return winID if winID != 10000 else 10025
 def _get_queued_video_info(self):
     try:
         xbmc.log("_get_queued_video_info()", xbmc.LOGNOTICE)
         # clear then queue the currently selected video
         xbmc.executebuiltin("Playlist.Clear")
         xbmc.executebuiltin("Action(Queue,%d)" % (xbmcgui.getCurrentWindowId() - 10000,))
         xbmc.log("Action(Queue,%d)" % (xbmcgui.getCurrentWindowId() - 10000,), xbmc.LOGNOTICE)
         # we need to sleep so the video gets queued properly
         xbmc.sleep(300)
         # create a video playlist
         self.playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
         # get movie name
         movie_title = self.playlist[0].getdescription()
         # this is used to skip trailer for current movie selection
         movie = os.path.splitext(os.path.basename(self.playlist[0].getfilename()))[0]
         # format our records start and end
         xbmc.executehttpapi("SetResponseFormat()")
         xbmc.executehttpapi("SetResponseFormat(OpenField,)")
         # TODO: verify the first is the best audio
         # setup the sql, we limit to 1 record as there can be multiple entries in streamdetails
         sql = (
             "SELECT movie.c12, movie.c14, streamdetails.strAudioCodec FROM movie, streamdetails WHERE movie.idFile=streamdetails.idFile AND streamdetails.iStreamType=1 AND c00='%s' LIMIT 1"
             % (movie_title.replace("'", "''"),)
         )
         xbmc.log("SQL: %s" % (sql,), xbmc.LOGNOTICE)
         # query database for info dummy is needed as there are two </field> formatters
         mpaa, genre, audio, dummy = xbmc.executehttpapi("QueryVideoDatabase(%s)" % quote_plus(sql)).split(
             "</field>"
         )
         # TODO: add a check and new sql for videos queued from files mode, or try an nfo
         # calculate rating
         mpaa = mpaa.split(" ")[1 - (len(mpaa.split(" ")) == 1)]
         mpaa = (mpaa, "NR")[mpaa not in ("G", "PG", "PG-13", "R", "NC-17", "Unrated")]
     except:
         movie_title = mpaa = audio = genre = movie = ""
     # spew queued video info to log
     xbmc.log("-" * 70, xbmc.LOGNOTICE)
     xbmc.log("Title: %s" % (movie_title,), xbmc.LOGNOTICE)
     xbmc.log("Path: %s" % (movie,), xbmc.LOGNOTICE)
     xbmc.log("Genre: %s" % (genre,), xbmc.LOGNOTICE)
     xbmc.log("MPAA: %s" % (mpaa,), xbmc.LOGNOTICE)
     xbmc.log("Audio: %s" % (audio,), xbmc.LOGNOTICE)
     if _S_("audio_videos_folder"):
         xbmc.log(
             "- Folder: %s"
             % (
                 xbmc.translatePath(_S_("audio_videos_folder"))
                 + {"dca": "DTS", "ac3": "Dolby"}.get(audio, "Other")
                 + xbmc.translatePath(_S_("audio_videos_folder"))[-1],
             ),
             xbmc.LOGNOTICE,
         )
     xbmc.log("-" * 70, xbmc.LOGNOTICE)
     # return results
     return mpaa, audio, genre, movie
Exemple #10
0
 def wrapper(*args, **kwds):
     try:
         return f(*args, **kwds)
     except Exception as e:
         e.args = map(str, e.args)
         log(traceback.format_exc(), xbmc.LOGSEVERE)
         if len(e.args) == 0 or e.args[0] == '':
             e.args = ('Error',)
         if len(e.args) == 1:
             e.args = e.args + ('See log file for details',)
         if xbmcgui.getCurrentWindowId() == WEATHER_WINDOW_ID or xbmcgui.getCurrentWindowId() == SETTINGS_WINDOW_ID:
             args = (e.args[0].title(),) + e.args[1:4]
             DIALOG.ok(*args)#@UndefinedVariable
Exemple #11
0
    def onInit(self):  # pylint: disable=invalid-name
        self.window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
        self.season_list = self.window.getControl(210)
        self.weeks_list = self.window.getControl(220)
        self.games_list = self.window.getControl(230)
        self.live_list = self.window.getControl(240)

        if self.list_refill:
            self.season_list.reset()
            self.season_list.addItems(self.season_items)
            self.weeks_list.reset()
            self.weeks_list.addItems(self.weeks_items)
            self.games_list.reset()
            self.games_list.addItems(self.games_items)
            self.live_list.reset()
            self.live_list.addItems(self.live_items)
        else:
            self.window.setProperty('NW_clicked', 'false')
            self.window.setProperty('GP_clicked', 'false')

        hide_busy_dialog()

        try:
            self.setFocus(self.window.getControl(self.focusId))
        except:
            logger.error('Focus not possible: %s' % self.focusId)
 def __init__( self, params, account_settings ):
     self._account_settings = account_settings
     self._client = XBMCDropBoxClient(access_token=self._account_settings.access_token)
     #get Settings
     self._filterFiles = ('true' == ADDON.getSetting('filefilter').lower())
     self._useStreamingURLs = ('true' == ADDON.getSetting('streammedia').lower())
     self._enabledSync = self._account_settings.synchronisation
     self._localSyncPath = self._account_settings.syncpath
     self._remoteSyncPath = self._account_settings.remotepath
     cache_path = get_cache_path( self._account_settings.account_name )
     self._shadowPath = cache_path + '/shadow/'
     self._thumbPath = cache_path + '/thumb/'
     #form default url
     self._nrOfMediaItems = int( params.get('media_items', '%s'%MAX_MEDIA_ITEMS_TO_LOAD_ONCE) )
     self._module = params.get('module', '')
     self._contentType = params.get('content_type', 'executable')
     self._current_path = urllib.unquote( params.get('path', DROPBOX_SEP) ).decode("utf-8")
     #Add sorting options
     xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_TITLE)
     xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
     xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_FILE)
     #Set/change 'SessionId' to let the other FolderBrowser know that it has to quit... 
     self._session = str( uuid.uuid4() ) #generate unique session id
     self.win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
     self.win.setProperty('SessionId', self._session)
     xbmc.sleep(100)
 def run(self):
     monitorclosedids = self.monitorclose.keys()
     monitorbothids = self.monitoropen.keys() + monitorclosedids
     closedid = None
     openedids = []
     while not self._abort_evt.is_set():
         ids = [xbmcgui.getCurrentWindowId()]
         for id in ids:
             if id in monitorbothids:
                 if id in monitorclosedids:
                     closedid = id
                 else:
                     if id not in openedids:
                         if self.opensend:
                             self.monitoropen[id]([str(id)])
                         else:
                             self.monitoropen[id]([])
                         openedids.append(id)
             else:
                 if closedid is not None:
                     if id != closedid:
                         if self.closesend:
                             self.monitorclose[closedid]([str(id)])
                         else:
                             self.monitorclose[closedid]([])
                         closedid = None
                 openedids=[]
         xbmc.sleep(self.interval)
Exemple #14
0
    def onInit(self):  # pylint: disable=invalid-name
        self.window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
        self.season_list = self.window.getControl(210)
        self.weeks_list = self.window.getControl(220)
        self.games_list = self.window.getControl(230)
        self.live_list = self.window.getControl(240)

        if gpr.subscription == "domestic":
            self.window.setProperty("domestic", "true")

        if self.list_refill:
            self.season_list.reset()
            self.season_list.addItems(self.season_items)
            self.weeks_list.reset()
            self.weeks_list.addItems(self.weeks_items)
            self.games_list.reset()
            self.games_list.addItems(self.games_items)
            self.live_list.reset()
            self.live_list.addItems(self.live_items)
        else:
            self.window.setProperty("NW_clicked", "false")
            self.window.setProperty("GP_clicked", "false")

        xbmc.executebuiltin("Dialog.Close(busydialog)")

        try:
            self.setFocus(self.window.getControl(self.focusId))
        except:
            addon_log("Focus not possible: %s" % self.focusId)
Exemple #15
0
	def paintProgress(self):
		
		self.windowID = xbmcgui.getCurrentWindowId()
		self.window = xbmcgui.Window(self.windowID)
		self.image = xbmcgui.ControlImage(880, 630, 400, 60, "InfoMessagePanel.png", colorDiffuse='0xC0C0C0C0')
		self.window.addControl(self.image)
		self.image.setVisible(False)
		animations = [('Conditional', 'effect=slide start=1280,0 time=2000 condition=Control.IsVisible(%d)' % self.image.getId())]
		self.image.setAnimations(animations)
		
		self.header = xbmcgui.ControlLabel(900, 635, 400, 60, 'Scraping RCB', font='font10_title', textColor='0xFFEB9E17')
		self.window.addControl(self.header)
		self.header.setVisible(False)
		self.header.setAnimations(animations)
		
		self.label = xbmcgui.ControlLabel(900, 655, 400, 60, 'Scraping RCB', font='font10')
		self.window.addControl(self.label)
		self.label.setVisible(False)
		self.label.setAnimations(animations)

		self.progress = xbmcgui.ControlProgress(900, 675, 370, 8)
		self.window.addControl(self.progress)
		self.progress.setVisible(False)
		self.progress.setAnimations(animations)
		
		self.label.setVisible(True)
		self.image.setVisible(True)
		self.progress.setVisible(True)
		self.header.setVisible(True)
    def startManualBackup(self):
        #self.value = self.control.getValue()
        self.value = self.getXbianValue()
        AT = self.APPLYTEXT
        if self.value[1] == 'File':
            self.value[2] = 'file:' + self.value[2]
            dest = xbianConfig('xbiancopy', 'imgdest', 'exp')[0]
            self.APPLYTEXT = _('Write backup to %s?') % ('...' + dest[len(dest)-57:] if len(dest) > 60 else dest, )
            confirm = False
            self.keep = self.value[4]
        else:
            self.APPLYTEXT = _('This will erase ALL data on %s, continue?') % (
                self.value[2], )
            confirm = True
            self.keep = 0

        if self.askConfirmation(confirm):
            xbianConfig('xbiancopy', 'start', '/dev/root', self.value[2])
            dlg = dialogWaitBackground(
                _('XBian System Backup'), [_('Please wait while creating backup file')],
                self.checkcopyFinish,
                SYSTEMLOGFILE,
                skinvar='backuprunning',
                id=xbmcgui.getCurrentWindowId(),
                onFinishedCB=self.oncopyFinished)
            dlg.show()
        self.APPLYTEXT = AT
        return ''
    def __init__(self):
        self._parse_argv()

        self.tokens = {}
        sortLetterList = list()
        # 0 if false, 1 if true
        hasParentItem = xbmc.getCondVisibility('System.GetBool(filelists.showparentdiritems)')
        ignoreArticles = xbmc.getCondVisibility('System.GetBool(filelists.ignorethewhensorting)')
        wid = xbmcgui.getCurrentWindowId()
        currentWindow = xbmcgui.Window(wid)

        # get sort tokens from advancedsettings.xml
        f = xbmcvfs.File(xbmc.translatePath('special://userdata/advancedsettings.xml'))
        advancedsettings = f.read()
        f.close()

        if advancedsettings:
            root = ET.fromstring(advancedsettings)
            sorttokens = root.find('sorttokens')
            # user specified tokens, proceed to create dictionary
            if sorttokens is not None:
                self.tokens = { token.text.encode('utf-8') : u'' for token in sorttokens.findall('token') }

        if self.TYPE == "scroll":
            xbmcplugin.setResolvedUrl(handle=self.handle, succeeded=False, listitem=xbmcgui.ListItem())
            containerId = self._get_view_mode()
            targetList = currentWindow.getControl(containerId)
            targetList.selectItem(int(self.pos))
            currentWindow.setFocus(targetList)
        elif self.path:
            xbmcplugin.setContent(self.handle, 'files')
            self._parse_files(sortLetterList, hasParentItem, ignoreArticles)
            xbmcplugin.addDirectoryItems(self.handle, sortLetterList)
            xbmcplugin.endOfDirectory(handle=self.handle)
        return
Exemple #18
0
def activateWindowCommand(cmd):
    cmds = cmd.split(',', 1)

    #special case for filemanager
    if '10003' in cmds[0] or 'filemanager' in cmds[0].lower():
        xbmc.executebuiltin(cmd)
        return   

    plugin   = None
    activate = None

    if len(cmds) == 1:
        activate = cmds[0]
    else:
        activate = cmds[0]+',return)'
        plugin   = cmds[1][:-1]

    #check if it is a different window and if so activate it
    id = str(xbmcgui.getCurrentWindowId())    

    if id not in activate:
        xbmc.executebuiltin(activate)

    if plugin:
        parent = getParentCommand(plugin)
        if parent:
            xbmc.executebuiltin('Container.Update(%s)' % parent)
            xbmc.sleep(500)
        xbmc.executebuiltin('Container.Update(%s)' % plugin)
Exemple #19
0
    def isClose(self):
        # Check if the base class has detected a need to close
        needToClose = SonosControllerWindow.isClose(self)

        # There are cases where the user could have changed the screen being
        # displayed, for example, if they have the following in their keymap:
        #   <keymap>
        #     <global>
        #       <keyboard>
        #         <f5>ActivateWindow(0)</f5>
        #       </keyboard>
        #     </global>
        #   </keymap>
        # This could cause a change in window, such as loading the home screen
        # however we do not get a call to close - as the Sonos window will be
        # still running in the back-ground - just not showing on the screen
        # If the user then exits, the keymap file will be left, so we will
        # automatically close the window in this case
        # Note: This is not an issue with the normal controller - as it is a
        # dialog window, so will always remain in view
        if (not needToClose) and (self.windowId != -1):
            # Get the current window
            showingWindowId = xbmcgui.getCurrentWindowId()
            # Check if the window is no longer showing
            if showingWindowId != self.windowId:
                log("SonosArtistSlideshow: Detected change in window, sonos window = %d, new window = %d" % (self.windowId, showingWindowId))
                return True

        return needToClose
    def setupWindow( self ):
        error = 0
        # get the id for the current 'active' window as an integer.
        # http://wiki.xbmc.org/index.php?title=Window_IDs
        try: currentWindowId = xbmcgui.getCurrentWindowId()
        except: currentWindowId = self.window

        if hasattr( self.button, "isSelected" ):
            self.canceled = self.button.isSelected()
        if hasattr( self.window, "getProperty" ):
            self.canceled = self.canceled  or ( self.window.getProperty( "DialogAddonScan.Cancel" ) == "true" )
        if hasattr( self.window, "setProperty" ):
            self.window.setProperty( "DialogAddonScan.Hide", "false")

        #if self.window is None and hasattr( currentWindowId, "__int__" ):
        #    self.window = xbmcgui.Window( currentWindowId )
        if hasattr( currentWindowId, "__int__" ) and currentWindowId != self.windowId:
            self.removeControls()
            self.windowId = currentWindowId
            self.window = xbmcgui.Window( self.windowId )
            self.initialize()

        if not self.window or not hasattr( self.window, "addControl" ):
            self.removeControls()
            error = 1

        self.window.setProperty( "DialogAddonScan.Hide", "false" )
        if error:
            raise xbmcguiWindowError( "xbmcgui.Window(%s)" % repr( currentWindowId ) )

        self.window.setProperty( "DialogAddonScan.IsAlive", "true" )
Exemple #21
0
    def show(self):
        log("SonosArtistSlideshow: About to show window")
        # First show the window
        SonosControllerWindow.show(self)

        # Work out how many lines there are on the screen to show lyrics
        if Settings.isLyricsInfoLayout():
            lyricControl = self.getControl(SonosArtistSlideshow.LYRICS)
            if lyricControl is not None:
                listitem = xbmcgui.ListItem()
                while xbmc.getInfoLabel('Container(%s).NumPages' % SonosArtistSlideshow.LYRICS) != '2':
                    lyricControl.addItem(listitem)
                    xbmc.sleep(10)
                self.lyricListLinesCount = lyricControl.size() - 1
                lyricControl.reset()

        self.windowId = xbmcgui.getCurrentWindowId()

        log("SonosArtistSlideshow: After show window %s" % self.windowId)

        # Set the sonos icon
        if not Settings.hideSonosLogo():
            xbmcgui.Window(self.windowId).setProperty('SonosAddonIcon', __icon__)

        # Set option to make the artist slideshow full screen
        if Settings.fullScreenArtistSlideshow():
            xbmcgui.Window(self.windowId).setProperty('SonosAddonSlideshowFullscreen', "true")

        # Now make sure that Artist Slideshow is running
        self.athread = threading.Thread(target=self.runArtistSlideshow)
        self.athread.setDaemon(True)
        self.athread.start()
        log("SonosArtistSlideshow: ArtistSlideShow thread started")
 def enable(self, service, status):
     xbmc.log('XBian-config : Enable service %s to %s' % (service, status), xbmc.LOGDEBUG)
     self.label = service
     self.control.setLabel(self.label)
     self.control.setValue(status)
     self.control.setEnabled(True)
     setvisiblecondition(self.visiblekey, True, xbmcgui.getCurrentWindowId())
    def startManualBackup(self):
        #self.value = self.control.getValue()
        self.value = self.getXbianValue()
        if self.value[0] == 1 and getSetting('advancedmode') == '1':
            dest = xbianConfig('xbiancopy', 'homedest', 'exp')[0]
            self.keep = self.value[3]
        else:
            dest ='/xbmc-backup/%s_backup_home_%s.img.gz' % (os.uname()[1], datetime.datetime.now().strftime("%d-%m-%y"))
            self.keep = 0

        AT = self.APPLYTEXT
        self.APPLYTEXT = _('Write backup to %s?') % ('...' + dest[len(dest)-57:] if len(dest) > 60 else dest, )
        confirm = False
        if self.askConfirmation(confirm):
            xbianConfig('xbiancopy', 'homestart', dest)
            msg = [
                _('It can take several minutes depending on size of your /home directory'),
                _('If file is created under /xbian-backup, it is also accessible through smb share'),
                _('Until finished, there will be just temp folder. Once ready, .img.gz file will appear.'),
                _('You can copy the file directly to you computer (the file will be deleted during boot!)'),
                _('To restore your /home folder, just copy .img.gz file to /xbian-backup/put_to_restore folder.'),
            ]
            dlg = dialogWaitBackground(
                _('Backup /home to file'),
                msg,
                self.checkcopyFinish,
                skinvar='backuprunning',
                id=xbmcgui.getCurrentWindowId(),
                onFinishedCB=self.oncopyFinished)
            dlg.show()
        self.APPLYTEXT = AT
        return ''
Exemple #24
0
    def checkWindow(self,newN):
        winID = xbmcgui.getCurrentWindowId()
        dialogID = xbmcgui.getCurrentWindowDialogId()
        if dialogID != 9999: winID = dialogID
        if winID == self.winID: return newN
        self.winID = winID
        self.updateWindowReader()
        if util.DEBUG:
            util.LOG('Window ID: {0} Handler: {1} File: {2}'.format(winID,self.windowReader.ID,xbmc.getInfoLabel('Window.Property(xmlfile)')))

        name = self.windowReader.getName()
        if name:
            self.sayText(u'{0}: {1}'.format(T(32105),name),interrupt=not newN)
            self.insertPause()
        else:
            self.sayText(u' ',interrupt=not newN)

        heading = self.windowReader.getHeading()
        if heading:
            self.sayText(heading)
            self.insertPause()

        texts = self.windowReader.getWindowTexts()
        if texts:
            self.insertPause()
            for t in texts:
                self.sayText(t)
                self.insertPause()
        return True
def unlock(account_settings):
    unlocked = True
    win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
    if (account_settings.passcode != ''):
        #create windows property name
        win_prop_name = urllib.quote(account_settings.account_name.encode("utf-8") + 'Unlocked')
        unlockTimeout = account_settings.passcodetimeout * 60 # to minutes
        #get last unlocked time
        try:
            unlockedTime = float( win.getProperty(win_prop_name) )
        except ValueError:
            unlockedTime = 0.0
        #unlocked = True when timeout not expired
        unlocked = (time.time() < (unlockedTime + unlockTimeout) )
        if not unlocked:
            log('Unlock with passcode required...')
            keyboard = xbmc.Keyboard('', LANGUAGE_STRING(30013))
            keyboard.setHiddenInput(True)
            keyboard.doModal()
            if keyboard.isConfirmed() and keyboard.getText() == account_settings.passcode:
                unlocked = True
            else:
                #Wrong passcode
                dialog = xbmcgui.Dialog()
                dialog.ok(ADDON_NAME, LANGUAGE_STRING(30014) )
        if unlocked:
            #update the unlock time
            win.setProperty(win_prop_name, '%s'%time.time() )
    return unlocked
 def _next_slide( self, slide=1, final_slide=False ):
     # cancel timer if it's running
     if self.slide_timer is not None:
         self.slide_timer.cancel()
     # increment/decrement count
     self.image_count += slide
     # check for invalid count, TODO: make sure you don't want to reset timer
     # check to see if playlist has come to an end
     if not xbmc.Player().isPlayingAudio() and int(self.settings[ "trivia_music" ]) > 0:
             #build_music_playlist()
             xbmc.Player().play( self.music_playlist )
     else:
         pass
     if self.image_count < 0:
         self.image_count = 0
     # if no more slides, exit
     if self.image_count > len( self.slide_playlist ) -1:
         self._exit_trivia()
     else:     
         # set the property the image control uses
         xbmcgui.Window( xbmcgui.getCurrentWindowId() ).setProperty( "Slide", self.slide_playlist[ self.image_count ] )
         # add id to watched file TODO: maybe don't add if not user preference
         self.watched += [ xbmc.getCacheThumbName( self.slide_playlist[ self.image_count ] ) ]
         # start slide timer
         self._get_slide_timer()
Exemple #27
0
 def onInit(self):
     if not self.initialized:
         self.initialized = True
         self.win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
         
         # Buttons
         self.playButton = self.getControl(250)
         self.playSkipButton = self.getControl(251)
         self.deleteButton = self.getControl(252)
         self.rerecordButton = self.getControl(253)
         self.firstInQueueButton = self.getControl(254)
         self.refreshButton = self.getControl(255)
         self.editScheduleButton = self.getControl(256)
         self.advancedButton = self.getControl(257)
         
         self.dispatcher = {
             self.playButton.getId()        : self.play,
             self.playSkipButton.getId()    : self.playWithCommSkip,
             self.deleteButton.getId()      : self.delete,
             self.rerecordButton.getId()    : self.rerecord,
             self.firstInQueueButton.getId(): self.moveToFrontOfJobQueue,
             self.refreshButton.getId()     : self.refresh,
             self.editScheduleButton.getId(): self.editSchedule,
             301:self.doCommFlag,
             302:self.doTranscode,
             303:self.doUserJob1,
             304:self.doUserJob2,
             305:self.doUserJob3,
             306:self.doUserJob4,
             307:self.doRefreshFanart
         }
         self.render()
Exemple #28
0
 def view(self, content):
     try:
         skin = xbmc.getSkinDir()
         skinPath = xbmc.translatePath('special://skin/')
         xml = os.path.join(skinPath,'addon.xml')
         file = xbmcvfs.File(xml)
         read = file.read().replace('\n','')
         file.close()
         try: src = re.compile('defaultresolution="(.+?)"').findall(read)[0]
         except: src = re.compile('<res.+?folder="(.+?)"').findall(read)[0]
         src = os.path.join(skinPath, src)
         if xbmcgui.getCurrentWindowId() == 10501: src = os.path.join(src, 'MyMusicSongs.xml')
         else: src = os.path.join(src, 'MyMusicNav.xml')
         file = xbmcvfs.File(src)
         read = file.read().replace('\n','')
         file.close()
         views = re.compile('<views>(.+?)</views>').findall(read)[0]
         views = [int(x) for x in views.split(',')]
         for view in views:
             label = xbmc.getInfoLabel('Control.GetLabel(%s)' % (view))
             if not (label == '' or label is None): break
         file = xbmcvfs.File(viewData)
         read = file.read()
         file.close()
         file = open(viewData, 'w')
         for line in re.compile('(".+?\n)').findall(read):
             if not line.startswith('"%s"|"%s"|"' % (skin, content)): file.write(line)
         file.write('"%s"|"%s"|"%s"\n' % (skin, content, str(view)))
         file.close()
         viewName = xbmc.getInfoLabel('Container.Viewmode')
         index().infoDialog('%s%s%s' % (language(30301).encode("utf-8"), viewName, language(30302).encode("utf-8")))
     except:
         return
Exemple #29
0
    def onInit(self):
        if not self.win:
            self.win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
            self.programsListBox = self.getControl(600)
            self.refreshButton = self.getControl(251)

            self.render()
    def onInit(self):
        self.window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
        self.season_list = self.window.getControl(210)
        self.weeks_list = self.window.getControl(220)
        self.games_list = self.window.getControl(230)
        self.live_list = self.window.getControl(240)

        if gpr.subscription == 'gamepass':
            self.window.setProperty('gamepass', 'true')

        if self.list_refill:
            self.season_list.reset()
            self.season_list.addItems(self.season_items)
            self.weeks_list.reset()
            self.weeks_list.addItems(self.weeks_items)
            self.games_list.reset()
            self.games_list.addItems(self.games_items)
            self.live_list.reset()
            self.live_list.addItems(self.live_items)
        else:
            self.window.setProperty('NW_clicked', 'false')
            self.window.setProperty('GP_clicked', 'false')

        xbmc.executebuiltin("Dialog.Close(busydialog)")

        try:
            self.setFocus(self.window.getControl(self.focusId))
        except:
            addon_log('Focus not possible: %s' %self.focusId)
    def build_main_menu_listing(self, video_list_ids, user_list_order, actions,
                                build_url):
        """Builds the video lists (my list, continue watching, etc.) Kodi screen

        Parameters
        ----------
        video_list_ids : :obj:`dict` of :obj:`str`
            List of video lists

        user_list_order : :obj:`list` of :obj:`str`
            Ordered user lists, to determine what should be displayed in the main menue

        actions : :obj:`dict` of :obj:`str`
            Dictionary of actions to build subsequent routes

        build_url : :obj:`fn`
            Function to build the subsequent routes

        Returns
        -------
        bool
            List could be build
        """
        preselect_items = []
        for category in user_list_order:
            for video_list_id in video_list_ids['user']:
                if video_list_ids['user'][video_list_id]['name'] == category:
                    label = video_list_ids['user'][video_list_id][
                        'displayName']
                    if category == 'netflixOriginals':
                        label = label.capitalize()
                    li = xbmcgui.ListItem(label=label,
                                          iconImage=self.default_fanart)
                    li.setProperty('fanart_image', self.default_fanart)
                    # determine action route
                    action = actions['default']
                    if category in actions.keys():
                        action = actions[category]
                    # determine if the item should be selected
                    preselect_items.append(
                        (False,
                         True)[category == self.get_main_menu_selection()])
                    url = build_url({
                        'action': action,
                        'video_list_id': video_list_id,
                        'type': category
                    })
                    xbmcplugin.addDirectoryItem(handle=self.plugin_handle,
                                                url=url,
                                                listitem=li,
                                                isFolder=True)

        # add recommendations/genres as subfolders (save us some space on the home page)
        i18n_ids = {
            'recommendations': self.get_local_string(30001),
            'genres': self.get_local_string(30010)
        }
        for type in i18n_ids.keys():
            # determine if the lists have contents
            if len(video_list_ids[type]) > 0:
                # determine action route
                action = actions['default']
                if type in actions.keys():
                    action = actions[type]
                # determine if the item should be selected
                preselect_items.append(
                    (False, True)[type == self.get_main_menu_selection()])
                li_rec = xbmcgui.ListItem(label=i18n_ids[type],
                                          iconImage=self.default_fanart)
                li_rec.setProperty('fanart_image', self.default_fanart)
                url_rec = build_url({'action': action, 'type': type})
                xbmcplugin.addDirectoryItem(handle=self.plugin_handle,
                                            url=url_rec,
                                            listitem=li_rec,
                                            isFolder=True)

        # add search as subfolder
        action = actions['default']
        if 'search' in actions.keys():
            action = actions[type]
        li_rec = xbmcgui.ListItem(label=self.get_local_string(30011),
                                  iconImage=self.default_fanart)
        li_rec.setProperty('fanart_image', self.default_fanart)
        url_rec = build_url({'action': action, 'type': 'search'})
        xbmcplugin.addDirectoryItem(handle=self.plugin_handle,
                                    url=url_rec,
                                    listitem=li_rec,
                                    isFolder=True)

        # no srting & close
        xbmcplugin.addSortMethod(handle=self.plugin_handle,
                                 sortMethod=xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.endOfDirectory(self.plugin_handle)
        self.set_custom_view(VIEW_FOLDER)

        # (re)select the previously selected main menu entry
        idx = 1
        for item in preselect_items:
            idx += 1
            preselected_list_item = idx if item else None
        preselected_list_item = idx + 1 if self.get_main_menu_selection(
        ) == 'search' else preselected_list_item
        if preselected_list_item != None:
            xbmc.executebuiltin(
                'ActivateWindowAndFocus(%s, %s)' %
                (str(
                    xbmcgui.Window(xbmcgui.getCurrentWindowId()).getFocusId()),
                 str(preselected_list_item)))
        return True
Exemple #32
0
def play_video(video_id,
               client_data,
               stream_type,
               season_id=None,
               compilation_id=None,
               retries=0):

    from .mpd_parser import mpd_parser as mpd_parser
    from xbmc import getCondVisibility
    xbmc_helper().log_debug('play_video: video_id {} - try no: {}', video_id,
                            retries)
    succeeded = False
    list_item = ListItem()

    if not xbmc_helper().addon_enabled(CONST['INPUTSTREAM_ADDON']):
        xbmc_helper().dialog_id('MSG_INPUSTREAM_NOT_ENABLED')
        exit(0)

    if not getCondVisibility('System.Platform.Android'):
        from inputstreamhelper import Helper
        is_helper = Helper('mpd', drm='com.widevine.alpha')
        if not is_helper.check_inputstream():
            xbmc_helper().dialog_id('MSG_WIDEVINE_NOT_FOUND')
            exit(0)
    try:
        from .submodules.libjoyn_video import get_video_data
        video_data = get_video_data(video_id, loads(client_data), stream_type,
                                    season_id, compilation_id)

        xbmc_helper().log_debug('Got video data: {}',
                                video_data.get('licenseUrl'))

        parser = video_data.get('parser', None)
        if parser is not None:

            list_item.setContentLookup(False)
            list_item.setProperty('inputstreamaddon',
                                  CONST['INPUTSTREAM_ADDON'])
            list_item.setProperty('inputstream', CONST['INPUTSTREAM_ADDON'])
            # DASH
            if isinstance(parser, mpd_parser):
                list_item.setMimeType('application/dash+xml')
                list_item.setProperty(
                    compat._format('{}.manifest_type',
                                   CONST['INPUTSTREAM_ADDON']), 'mpd')
                if parser.mpd_filepath is not None:
                    list_item.setPath(
                        parser.mpd_filepath
                        if not getCondVisibility('System.Platform.Windows')
                        and not getCondVisibility('System.Platform.UWP') else
                        parser.mpd_filepath.replace('\\', '/'))
                elif parser.mpd_url is not None:
                    list_item.setPath(lib_joyn().add_user_agent_http_header(
                        parser.mpd_url))
                else:
                    raise ValueError(
                        compat._format(
                            'Could not find a valid DASH Manifest - parser: {}',
                            vars(mpd_parser)))

                drm = video_data.get('drm', '')
                license_key = video_data.get('licenseUrl', None)
                license_cert = video_data.get('certificateUrl', None)
                xbmc_helper().log_debug('drm: {} key: {} cert: {}', drm,
                                        license_key, license_cert)

                if license_key is not None:
                    if drm.lower() == 'widevine':
                        xbmc_helper().log_notice('Using Widevine as DRM')

                        list_item.setProperty(
                            compat._format('{}.license_type',
                                           CONST['INPUTSTREAM_ADDON']),
                            'com.widevine.alpha')
                        list_item.setProperty(
                            compat._format('{}.license_key',
                                           CONST['INPUTSTREAM_ADDON']),
                            compat._format(
                                '{}|{}|R{{SSM}}|', license_key,
                                request_helper.get_header_string({
                                    'User-Agent':
                                    lib_joyn().config.get('USER_AGENT'),
                                    'Content-Type':
                                    'application/octet-stream'
                                })))
                        list_item.setProperty(
                            compat._format('{}.stream_headers',
                                           CONST['INPUTSTREAM_ADDON']),
                            request_helper.get_header_string({
                                'User-Agent':
                                lib_joyn().config['USER_AGENT']
                            }))

                        if license_cert is not None and xbmc_helper(
                        ).get_bool_setting('checkdrmcert') is True:
                            xbmc_helper().log_debug('Set DRM cert: {}',
                                                    license_cert)
                            list_item.setProperty(
                                compat._format('{}.server_certificate',
                                               CONST['INPUTSTREAM_ADDON']),
                                lib_joyn().add_user_agent_http_header(
                                    license_cert))

                    elif drm.lower() == 'playready':
                        xbmc_helper().log_notice('Using PlayReady as DRM')
                        list_item.setProperty(
                            compat._format('{}.license_type',
                                           CONST['INPUTSTREAM_ADDON']),
                            'com.microsoft.playready')
                        list_item.setProperty(
                            compat._format('{}.license_key',
                                           CONST['INPUTSTREAM_ADDON']),
                            compat._format(
                                '{}|{}|R{{SSM}}|', license_key,
                                request_helper.get_header_string({
                                    'User-Agent':
                                    CONST['EDGE_UA'],
                                    'Content-Type':
                                    'text/xml',
                                    'SOAPAction':
                                    'http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense'
                                })))

                        list_item.setProperty(
                            compat._format('{}.stream_headers',
                                           CONST['INPUTSTREAM_ADDON']),
                            request_helper.get_header_string(
                                {'User-Agent': CONST['EDGE_UA']}))
                    else:
                        raise ValueError(
                            compat._format('Unsupported DRM {}', drm))

            if stream_type == 'LIVE':
                list_item.setProperty(
                    compat._format('{}.manifest_update_parameter',
                                   CONST['INPUTSTREAM_ADDON']), 'full')

                if xbmc_helper().get_bool_setting(
                        'fix_livestream_audio_sync') is True:
                    mpd_timeshift_buffer = parser.get_timeshift_buffer_secs()
                    if mpd_timeshift_buffer is not None:
                        xbmc_helper().log_debug(
                            'Got timeshiftbuffer from mpd: {}',
                            mpd_timeshift_buffer)
                        live_stream_length = mpd_timeshift_buffer
                    else:
                        live_stream_length = xbmc_helper().get_int_setting(
                            'livestream_total_length')

                    live_stream_resume_pos = live_stream_length - xbmc_helper(
                    ).get_int_setting('livestream_offset')

                    list_item.setProperty('TotalTime',
                                          str(float(live_stream_length)))
                    list_item.setProperty('ResumeTime',
                                          str(float(live_stream_resume_pos)))
                    xbmc_helper().log_debug(
                        'Tried fixing livestream audio sync issue - total time: {} - resume pos {}',
                        live_stream_length, live_stream_resume_pos)

            succeeded = True

            from .submodules.plugin_lastseen import add_lastseen
            if 'season_id' in video_data.keys(
            ) and video_data['season_id'] is not None:
                add_lastseen(season_id=video_data['season_id'],
                             max_lastseen=CONST['LASTSEEN_ITEM_COUNT'])
            elif 'compilation_id' in video_data.keys(
            ) and video_data['compilation_id'] is not None:
                add_lastseen(compilation_id=video_data['compilation_id'],
                             max_lastseen=CONST['LASTSEEN_ITEM_COUNT'])

        else:
            raise ValueError(compat._format('Could not get parser: {}',
                                            parser))

    except Exception as e:
        if retries < CONST.get('MAX_VIDEO_TRIES'):
            xbmc_helper().log_notice(
                'Getting videostream / manifest failed with Exception: {} - current try {} of {}',
                e, retries, CONST.get('MAX_VIDEO_TRIES'))
            play_video(video_id,
                       client_data,
                       stream_type,
                       season_id=season_id,
                       compilation_id=compilation_id,
                       retries=(retries + 1))
        else:
            succeeded = False
            xbmc_helper().log_error(
                'Getting videostream / manifest failed with Exception: {}', e)
            xbmc_helper().notification(
                compat._format(xbmc_helper().translation('ERROR'),
                               'Video-Stream'),
                xbmc_helper().translation('MSG_ERROR_NO_VIDEOSTEAM'))
        pass

    if succeeded is True and stream_type == 'VOD':
        from xbmcgui import Window, getCurrentWindowId
        Window(getCurrentWindowId()).setProperty('joyn_video_id', video_id)

    setResolvedUrl(pluginhandle, succeeded, list_item)
Exemple #33
0
def getCurrentViewId():
    win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
    return str(win.getFocusId())
 def invalidate_memcache(self):
     """Invalidates the memory cache"""
     xbmcgui.Window(xbmcgui.getCurrentWindowId()).setProperty(
         'memcache', pickle.dumps({}))
Exemple #35
0
def doMenu(mode):
    utils.log('**** Context Menu Information ****')

    window = xbmcgui.getCurrentWindowId()

    DEBUG = ADDON.getSetting('DEBUG') == 'true'
    if DEBUG:
        utils.DialogOK('Current Window ID %d' % window)

    utils.log('Capture window\t: %d' % window)

    #active = [0, 1, 2, 3, 25, 40, 500, 501, 502, 601, 2005]
    #if window-10000 not in active:
    #    doStandard(useScript=False)
    #    return

    if window > 12999:
        doStandard(useScript=False)
        return

    # to prevent master profile setting being used in other profiles
    if mode == 0 and ADDON.getSetting('CONTEXT') != 'true':
        doStandard(useScript=False)
        return

    folder = xbmc.getInfoLabel('Container.FolderPath')
    path   = xbmc.getInfoLabel('ListItem.FolderPath')

    #ignore if in Super Favourites
    if (ADDONID in folder) or (ADDONID in path):
        doStandard(useScript=False)
        return

    if mode == 0 and whitelisted():
        doStandard(useScript=False)
        return
        
    choice   = 0
    label    = xbmc.getInfoLabel('ListItem.Label')
    filename = xbmc.getInfoLabel('ListItem.FilenameAndPath')
    thumb    = xbmc.getInfoLabel('ListItem.Thumb')    
    icon     = xbmc.getInfoLabel('ListItem.ActualIcon')    
    #thumb   = xbmc.getInfoLabel('ListItem.Art(thumb)')
    playable = xbmc.getInfoLabel('ListItem.Property(IsPlayable)').lower() == 'true'
    #fanart   = xbmc.getInfoLabel('ListItem.Property(Fanart_Image)')
    fanart   = xbmc.getInfoLabel('ListItem.Art(fanart)')
    isFolder = xbmc.getCondVisibility('ListItem.IsFolder') == 1
    hasVideo = xbmc.getCondVisibility('Player.HasVideo') == 1
    desc     = getDescription()
   
    if not thumb:
        thumb = icon

    try:    file = xbmc.Player().getPlayingFile()
    except: file = None

    isStream = False
   
    #if hasattr(xbmc.Player(), 'isInternetStream'):
    #    isStream = xbmc.Player().isInternetStream()
    #elif file:
    if file:
        isStream = file.startswith('http')

    if window == 10003: #filemanager
        control = 0
        if xbmc.getCondVisibility('Control.HasFocus(20)') == 1:
            control = 20
        elif xbmc.getCondVisibility('Control.HasFocus(21)') == 1:
            control = 21

        if control == 0:
            return doStandard(useScript=False)

        label    = xbmc.getInfoLabel('Container(%d).ListItem.Label' % control)
        root     = xbmc.getInfoLabel('Container(%d).ListItem.Path'  % control)
        path     = root + label
        isFolder = True
        thumb    = 'DefaultFolder.png'
        #if not path.endswith(os.sep):
        #    path += os.sep

    if isFolder:
        path     = path.replace('\\', '\\\\')
        filename = filename.replace('\\', '\\\\')

    params                = {}
    params['label']       = label
    params['folder']      = folder
    params['path']        = path
    params['filename']    = filename
    params['thumb']       = thumb
    params['icon']        = icon
    params['fanart']      = fanart
    params['window']      = window
    params['isplayable']  = playable
    params['isfolder']    = isFolder
    params['file']        = file
    params['isstream']    = isStream
    params['description'] = desc
    params['hasVideo']    = hasVideo


    for key in params:
        utils.log('%s\t\t: %s' % (key, params[key]))

    menu       = []
    localAddon = None

    if MENU_QUICKLAUNCH:
        menu.append((GETTEXT(30219), _QUICKLAUNCH))

    plugins    = []
    try:
        plugins = getPlugins()
        addPlugins(menu, plugins, params, _EXTRABASE)
    except Exception, e:
        utils.log('Error adding plugins : %s' % str(e))
Exemple #36
0
    def onInit(self):
        if not self.win:
            log.debug('onInit')
            self.win = xbmcgui.Window(xbmcgui.getCurrentWindowId())

            # Nav Buttons
            self.testSettingsButton = self.getControl(253)
            self.clearCacheButton = self.getControl(405)

            self.streamingEnabledRadioButton = self.getControl(208)
            self.recordingsButton = self.getControl(205)

            # MythTV Settings
            if hasattr(self.settings, 'master') and self.settings.master:
                self.setWindowProperty(
                    'MasterBackendHostname',
                    '%s / %s' % (self.settings.master.hostname,
                                 self.settings.master.ipAddress))
                self.setWindowProperty('MasterBackendPort',
                                       str(self.settings.master.port))

            self.register(
                Setting(self.settings, 'streaming_enabled', bool, None,
                        self.getControl(208)))
            self.register(
                Setting(
                    self.settings, 'paths_recordedprefix', str,
                    ExternalizedSettingValidator(
                        MythSettings.verifyRecordingDirs),
                    self.getControl(205)))
            self.register(
                Setting(self.settings, 'confirm_on_delete', bool, None,
                        self.getControl(206)))
            self.register(
                Setting(self.settings, 'aggressive_caching', bool, None,
                        self.getControl(207)))

            # MySQL Settings
            self.register(
                Setting(
                    self.settings, 'mysql_host', str,
                    ExternalizedSettingValidator(MythSettings.verifyMySQLHost),
                    self.getControl(301)))
            self.register(
                Setting(
                    self.settings, 'mysql_port', int,
                    ExternalizedSettingValidator(MythSettings.verifyMySQLPort),
                    self.getControl(302)))
            self.register(
                Setting(
                    self.settings, 'mysql_database', str,
                    ExternalizedSettingValidator(
                        MythSettings.verifyMySQLDatabase),
                    self.getControl(303)))
            self.register(
                Setting(
                    self.settings, 'mysql_user', str,
                    ExternalizedSettingValidator(MythSettings.verifyMySQLUser),
                    self.getControl(304)))
            self.register(
                Setting(self.settings, 'mysql_password', str, None,
                        self.getControl(305)))

            # Fanart Settings
            self.register(
                Setting(self.settings, 'fanart_tvdb', bool, None,
                        self.getControl(401)))
            self.register(
                Setting(self.settings, 'fanart_tvrage', bool, None,
                        self.getControl(406)))
            self.register(
                Setting(self.settings, 'fanart_tmdb', bool, None,
                        self.getControl(402)))
            self.register(
                Setting(self.settings, 'fanart_imdb', bool, None,
                        self.getControl(403)))
            self.register(
                Setting(self.settings, 'fanart_google', bool, None,
                        self.getControl(404)))

            # Advanced Settings
            self.register(
                Setting(self.settings, 'logging_enabled', bool, None,
                        self.getControl(502)))
            self.register(
                Setting(self.settings, 'feeds_twitter', str, None,
                        self.getControl(503)))
            self.setWindowProperty(
                'debugLogLocation',
                self.translator.get(m.DEBUG_LOG_LOCATION) %
                self.platform.getDebugLog())

            # Playback settings
            self.advanced.get = self.advanced.getSetting
            self.advanced.put = self.advanced.setSetting
            self.register(
                Setting(self.advanced, 'video/timeseekforward', Seconds, None,
                        self.getControl(602)))
            self.register(
                Setting(self.advanced, 'video/timeseekbackward',
                        NegativeSeconds, None, self.getControl(603)))
            self.register(
                Setting(self.advanced, 'video/timeseekforwardbig', Seconds,
                        None, self.getControl(604)))
            self.register(
                Setting(self.advanced, 'video/timeseekbackwardbig',
                        NegativeSeconds, None, self.getControl(605)))

            self.render()