Пример #1
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
Пример #2
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)" )
Пример #3
0
 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 
Пример #4
0
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.'
Пример #5
0
 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 
Пример #6
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))
Пример #7
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']]
Пример #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
Пример #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
Пример #11
0
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
Пример #12
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)
Пример #13
0
    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" )
Пример #14
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
Пример #15
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()
Пример #16
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)
Пример #17
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)
Пример #18
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 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)
Пример #20
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()
Пример #21
0
    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)
Пример #22
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 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, 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)
Пример #25
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
    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 ''
 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()
 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())
Пример #29
0
    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
Пример #30
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")