Exemplo n.º 1
0
    def execCommandForWO35(self, command):
        tvModel = TvModel()
        try:
            session = self.tvTransport.open_session()
            session.exec_command(command + '\n')
            if 'reboot' in command:
                return tvModel
            session.recv_exit_status()
            while session.recv_ready():
                byteText = session.recv(8000)
            message = byteText.decode(encoding='UTF-8')
            if '\"returnValue\":true' in message.replace(" ", ""):
                tvModel.resultType = RESULT_SUCCESS
                tvModel.resultValue = message
            else:
                tvModel.resultType = RESULT_FAIL
                tvModel.message = MESSAGE_ERROR + command + '\n' + message

        except Exception as e:
            print('*** execCommandForWO35, Caught exception: %s: %s' %
                  (e.__class__, e))
            traceback.print_exc()
            tvModel.message = MESSAGE_ERROR + str(e)
            tvModel.resultType = RESULT_FAIL

        return tvModel
Exemplo n.º 2
0
    def doScreenCapture_OSD(self, ip, fileName):
        result = TvModel()
        isConnected = self.tvController.connect(ip)
        if isConnected:
            # result = self.tvController.execCommand(LunaCommands.doScreenCapture(self, fileName))
            os.system("/tmp/usb/sda/sda1/gmd")
            time.sleep(0.5)
            result = TvModel()
            result = self.tvController.downloadFile("/var/log/*.png")
            if result.resultValue == False:
                os.system("cp /var/log/*.png /tmp/usb/sda/sda1/")
                result.resultValue = True
            self.tvController.disconnect()

        return result