def onPlayBackEndedOrStopped(self): # only switch on video files (not audio) if fsconfig.lastPlayedMediaType == 'video': if fsconfig.radioOnPlayStop60 or fsconfig.radioOnPlayStop50: # check current display mode setting currentOutputMode, currentAmlogicMode = fsutil.getDisplayMode() if currentOutputMode == 'unsupported': setModeStatus = 'Unsupported resolution: ' + currentAmlogicMode statusType = 'warn' elif currentOutputMode == 'invalid': setModeStatus = 'Error, unexpected mode: ' + currentAmlogicMode statusType = 'warn' else: # get current resolution resSplit = currentOutputMode.find('-') currentRes = currentOutputMode[0:resSplit] # set the output mode if fsconfig.radioOnPlayStop60: setModeStatus, statusType = fsutil.setDisplayMode(currentRes + '-60hz') else: setModeStatus, statusType = fsutil.setDisplayMode(currentRes + '-50hz') # display notification if statusType == 'warn': fsmsg.notifyQuickWarn('Frequency Switcher', setModeStatus) else: fsmsg.notifyInfo('Frequency Switcher', setModeStatus)
def onPlayBackEndedOrStopped(self): # only switch on video files (not audio) if fsconfig.lastPlayedMediaType == 'video': if fsconfig.radioOnPlayStop60 or fsconfig.radioOnPlayStop50 or fsconfig.radioOnPlayStop24 or fsconfig.radioOnPlayStop23: # check current display mode setting currentOutputMode, currentHiSiliconMode = fsutil.getDisplayMode( ) if currentOutputMode == 'unsupported': setModeStatus = 'Unsupported resolution: ' + currentHiSiliconMode statusType = 'warn' elif currentOutputMode == 'invalid': setModeStatus = 'Error, unexpected mode: ' + currentHiSiliconMode statusType = 'warn' else: # get current resolution resSplit = currentOutputMode.find('-') currentRes = currentOutputMode[0:resSplit] # set the output mode if fsconfig.radioOnPlayStop60: setModeStatus, statusType = fsutil.setDisplayMode( currentRes + '-60hz') elif fsconfig.radioOnPlayStop50: setModeStatus, statusType = fsutil.setDisplayMode( currentRes + '-50hz') elif fsconfig.radioOnPlayStop24: setModeStatus, statusType = fsutil.setDisplayMode( currentRes + '-24hz') else: setModeStatus, statusType = fsutil.setDisplayMode( currentRes + '-23hz') # display force 2D mode osPlatform, osVariant, osSDK = fsutil.getPlatformType() if osSDK == '24': os.system('echo 0 > /sdcard/mode3D') os.system('echo 3dmode 0 > /proc/msp/hdmi0') # display notification if statusType == 'warn': fsmsg.notifyQuickWarn('Frequency Switcher', setModeStatus) else: fsmsg.notifyInfo('Frequency Switcher', setModeStatus)
def onPlayBackEndedOrStopped(self): # only switch on video files (not audio) if fsconfig.lastPlayedMediaType == 'video': if fsconfig.radioOnPlayStop60 or fsconfig.radioOnPlayStop50 or fsconfig.radioOnPlayStop24 or fsconfig.radioOnPlayStop23: # check current display mode setting currentOutputMode, currentHiSiliconMode = fsutil.getDisplayMode() if currentOutputMode == 'unsupported': setModeStatus = 'Unsupported resolution: ' + currentHiSiliconMode statusType = 'warn' elif currentOutputMode == 'invalid': setModeStatus = 'Error, unexpected mode: ' + currentHiSiliconMode statusType = 'warn' else: # get current resolution resSplit = currentOutputMode.find('-') currentRes = currentOutputMode[0:resSplit] # set the output mode if fsconfig.radioOnPlayStop60: setModeStatus, statusType = fsutil.setDisplayMode(currentRes + '-60hz') elif fsconfig.radioOnPlayStop50: setModeStatus, statusType = fsutil.setDisplayMode(currentRes + '-50hz') elif fsconfig.radioOnPlayStop24: setModeStatus, statusType = fsutil.setDisplayMode(currentRes + '-24hz') else: setModeStatus, statusType = fsutil.setDisplayMode(currentRes + '-23hz') # display force 2D mode osPlatform, osVariant, osSDK = fsutil.getPlatformType() if osSDK == '24': os.system('echo 0 > /sdcard/mode3D') os.system('echo 3dmode 0 > /proc/msp/hdmi0') # display notification if statusType == 'warn': fsmsg.notifyQuickWarn('Frequency Switcher', setModeStatus) else: fsmsg.notifyInfo('Frequency Switcher', setModeStatus)
def run(): scriptMode = None # if the only argument is script name then run in setup mode if len(sys.argv) == 1: scriptMode = 'Setup' # otherwise select mode based on the first argument else: scriptArg = sys.argv[1] if scriptArg == '1080p-60hz': scriptMode = 'SetFreq' elif scriptArg == '1080p-50hz': scriptMode = 'SetFreq' elif scriptArg == '1080p-24hz': scriptMode = 'SetFreq' elif scriptArg == '720p-60hz': scriptMode = 'SetFreq' elif scriptArg == '720p-50hz': scriptMode = 'SetFreq' elif scriptArg == '720p-24hz': scriptMode = 'SetFreq' elif scriptArg == 'auto': scriptMode = 'AutoSet' elif scriptArg == 'info': scriptMode = 'ShowInfo' # create default settings (if they don't already exist) fsconfigutil.createAllSettingsFiles() # load settings loadSettingsStatus = fsconfigutil.loadSettings() if scriptMode == 'Setup': # Create and show main configuration window fsMainWindow = fswin.MainWindow('Frequency Switcher configuration') fsMainWindow.doModal() elif scriptMode == 'SetFreq': # set the output mode setModeStatus, statusType = fsutil.setDisplayMode(scriptArg) # display notification if statusType == 'warn': fsmsg.notifyQuickWarn('Frequency Switcher', setModeStatus) else: fsmsg.notifyInfo('Frequency Switcher', setModeStatus) elif scriptMode == 'AutoSet': # set the output mode automatically setModeStatus, statusType = fsutil.setDisplayModeAuto() # display notification if statusType == 'warn': fsmsg.notifyQuickWarn('Frequency Switcher', setModeStatus) else: fsmsg.notifyInfo('Frequency Switcher', setModeStatus) elif scriptMode == 'ShowInfo': fsconfigutil.loadActiveInfoSetting() # disable info panel if currently active if fsconfig.activeInfo: # check that the active info panel flag file is not old (occurs if XBMC crashes) if fsconfigutil.activeInfoFlagIsOld(): fswin.InfoPanel.showInfo() # flag file is new so deactivate panel else: fsconfig.activeInfo = False fsconfigutil.saveActiveInfoSetting() # show info panel if not currently active else: fswin.InfoPanel.showInfo() else: fsmsg.notifyInfo('Invalid script argument', scriptArg)
def run(): scriptMode = None # if the only argument is script name then run in setup mode if len(sys.argv) == 1: scriptMode = 'Setup' # otherwise select mode based on the first argument else: scriptArg = sys.argv[1] if scriptArg == '4k2k-60hz': scriptMode = 'SetFreq' elif scriptArg == '4k2k-50hz': scriptMode = 'SetFreq' elif scriptArg == '4k2k-30hz': scriptMode = 'SetFreq' elif scriptArg == '4k2k-25hz': scriptMode = 'SetFreq' elif scriptArg == '4k2k-24hz': scriptMode = 'SetFreq' elif scriptArg == '1080p-60hz': scriptMode = 'SetFreq' elif scriptArg == '1080p-50hz': scriptMode = 'SetFreq' elif scriptArg == '1080p-30hz': scriptMode = 'SetFreq' elif scriptArg == '1080p-25hz': scriptMode = 'SetFreq' elif scriptArg == '1080p-24hz': scriptMode = 'SetFreq' elif scriptArg == '720p-60hz': scriptMode = 'SetFreq' elif scriptArg == '720p-50hz': scriptMode = 'SetFreq' elif scriptArg == 'auto': scriptMode = 'AutoSet' elif scriptArg == 'info': scriptMode = 'ShowInfo' # create default settings (if they don't already exist) fsconfigutil.createAllSettingsFiles() # load settings loadSettingsStatus = fsconfigutil.loadSettings() if scriptMode == 'Setup': # Create and show main configuration window fsMainWindow = fswin.MainWindow('Frequency Switcher configuration') fsMainWindow.doModal() elif scriptMode == 'SetFreq': # set the output mode setModeStatus, statusType = fsutil.setDisplayMode(scriptArg) # display notification if statusType == 'warn': fsmsg.notifyQuickWarn('Frequency Switcher', setModeStatus) else: fsmsg.notifyInfo('Frequency Switcher', setModeStatus) elif scriptMode == 'AutoSet': # set the output mode automatically setModeStatus, statusType = fsutil.setDisplayModeAuto() # display notification if statusType == 'warn': fsmsg.notifyQuickWarn('Frequency Switcher', setModeStatus) else: fsmsg.notifyInfo('Frequency Switcher', setModeStatus) elif scriptMode == 'ShowInfo': fsconfigutil.loadActiveInfoSetting() # disable info panel if currently active if fsconfig.activeInfo: # check that the active info panel flag file is not old (occurs if XBMC crashes) if fsconfigutil.activeInfoFlagIsOld(): fswin.InfoPanel.showInfo() # flag file is new so deactivate panel else: fsconfig.activeInfo = False fsconfigutil.saveActiveInfoSetting() # show info panel if not currently active else: fswin.InfoPanel.showInfo() else: fsmsg.notifyInfo('Invalid script argument', scriptArg)