def downloadScreenCapture(self, width=256, height=256, type="PNG"):
    '''
            下载截图
    :param1   self        必须
    :param2   width    宽
    :param3    height   高
    :param3   type   截图类型
    :return     Res   type:dict{sn:True}   sn号:截图下载成功与否   
    :example Res = downloadScreenCapture(self,width=256,height=256,type="PNG")
    '''
    data = {"width": width, "height": height, "type": type}
    result = sendGetCommand(self,
                            Constant.WHAT_SCREEN_SHOT,
                            0,
                            Constant.ACTION_GET,
                            0,
                            data=data,
                            timeout=8,
                            describe="截图")
    ftpfiles = {}
    for key in result.keys():
        if result[key] == "FAILED" or result[key] == "ERROR":
            ftpfiles[key] = "FAILED"
        else:
            ftpfiles[key] = result[key]["path"].encode("utf-8")
    filedir = os.path.abspath("../file/screenCapture")
    Res = downloadFile(self,
                       user='******',
                       filepath=filedir,
                       ftpfiles=ftpfiles,
                       filetype='png')
    return Res
Exemple #2
0
def listCheck(self):
    '''
            清单回读
    :param1   self        必须
    :return  result     type:dict       
    :example result = ListCheck(self)
    '''
    result = sendGetCommand(self,
                            Constant.WHAT_PLAYLIST,
                            0x01,
                            Constant.ACTION_GET,
                            0,
                            data=None,
                            timeout=4,
                            describe="清单播放")
    print result
    self.identifier = []
    self.name = []
    self.thumbnailUrl = []
    self.statusCode = []
    self.source = []
    for playlist in range(len(result["programInfos"])):
        self.identifier.append(result["programInfos"][playlist]["identifier"])
        self.name.append(result["programInfos"][playlist]["name"])
        self.thumbnailUrl.append(
            result["programInfos"][playlist]["thumbnailUrl"])
        self.statusCode.append(result["programInfos"][playlist]["statusCode"])
        self.source.append(result["programInfos"][playlist]["source"])
    print self.identifier
    print self.name
    print self.thumbnailUrl
    print self.statusCode
    print self.source
    return result
def getVideoInfo(self):
    '''
             获取视频源相关配置信息
    :parma    self  必须
    :return    result  字典      key:sn号      value:state('OPEN' or 'CLOSE')
    :example    result = getVideoInfo(self)
    '''
    result = sendGetCommand(self, Constant.WHAT_VIDEO_CONTROL, Constant.TYPE_VIDEO_CONTROL,
                            Constant.ACTION_GET, 0, describe="getVideoInfo",
                            applyTo=["T2-4G", "T2", "T4", "T6", "T8"])
    return result
def getMd5(self, file):
    data = {}
    data["url"] = file
    result = sendGetCommand(self,
                            Constant.WHAT_FILE,
                            Constant.TYPE_MD5,
                            Constant.ACTION_GET,
                            0,
                            data=data,
                            timeout=5,
                            describe="获取md5值")
    return result
Exemple #5
0
def getScreenConfinfo(self,
                      portNumber=1,
                      width=64,
                      height=32,
                      xCount=1,
                      yCount=1,
                      xOffset=0,
                      yOffset=0,
                      orders=[1],
                      portIndex=0):
    '''
        获取配屏信息         
    :param1   self        必须
    :param2   portNumber  网口数量(1-2)
    :param3   width        接收卡大小宽度
    :param4   height       接收卡大小高度
    :param5   xCount       X方向上接收卡个数
    :param6   yCount       Y方向上接收卡个数
    :param7   xOffset      X轴偏移
    :param8   yOffset      Y轴偏移
    :param9   orders       连接顺序 (0-7)
    :param10  portIndex    网口序号(0-1)
    :return  flag bool型   获取信息与配置信息是否一致
    :example1 flag = screenConfinfo(self,portNumber=1,width=64,height=32,xCount=1,yCount=1,xOffset=0,yOffset=0,orders=[1],portIndex=0)
    :example2 flag = screenConfinfo(self,portNumber=2,width=64,height=32,xCount=1,yCount=1,xOffset=0,yOffset=0,orders=[1],portIndex=1)                    
'''
    RES = sendGetCommand(self,
                         Constant.WHAT_SCREEN_ATTRIBUTE,
                         Constant.TYPE_SCREEN_ATTR,
                         Constant.ACTION_GET,
                         0,
                         data=None,
                         timeout=5,
                         describe="screenConfinfo")
    print RES
    flag = True
    flagdict = {}
    for sn in self.sns:
        if  RES[sn]['screenAttributes'][0]["scanInfos"][0]['height']!=height and \
            RES[sn]['screenAttributes'][0]["scanInfos"][0]['width']!=width and \
            RES[sn]['screenAttributes'][0]['yOffset']!=yOffset and \
            RES[sn]['screenAttributes'][0]['xOffset']!=xOffset and \
            RES[sn]['screenAttributes'][0]['orders']!=orders and \
            RES[sn]['screenAttributes'][0]['xCount']!=xCount and  \
            RES[sn]['screenAttributes'][0]['yCount']!=yCount :
            flag = False
            flagdict[sn] = False
        else:
            flagdict[sn] = True
    print flagdict
    return flag
def getScreenPowerState(self):
    '''
             获取屏体的开关屏状态
    :parma    self  必须
    :return    result  字典      key:sn号      value:state('OPEN' or 'CLOSE')
    :example    result = getScreenPowerState(self)
    '''
    result = sendGetCommand(self,
                            Constant.WHAT_SCREEN_POWER,
                            Constant.TYPE_MANUAL,
                            Constant.ACTION_GET,
                            0,
                            describe="getScreenPowerState")
    return result
def getENVBrightnessInfo(self):
    '''
    获取环境亮度相关配置信息
    :parma    self  必须
    :return    result  字典      key:sn号      value:ratio
    :example    result = getENVBrightnessInfo(self)
    '''
    result = sendGetCommand(self,
                            Constant.WHAT_ENV_BRIGHTNESS,
                            0,
                            Constant.ACTION_GET,
                            0,
                            describe="getENVBrightnessInfo")
    return result
Exemple #8
0
def getHdimResolution(self):
    '''
            获取HDMI分辨率信息
    :parma    self  必须
    :return    result  字典      key:sn号      value:state('OPEN' or 'CLOSE')
    :example    result = getHdimResolution(self)
    '''
    result = sendGetCommand(self,
                            Constant.WHAT_VIDEO_CONTROL,
                            Constant.TYPE_EDID,
                            Constant.ACTION_GET,
                            0,
                            describe="getHdimResolution",
                            applyTo=["T2", "T2-4G", "T4", "T6", "T8"])
    return result
def getBindInfo(self):
    '''
    回读播放器绑定信息        
    :param1   self    必须
    :return  flag bool型   是否下发成功   
    :example flag=bind_VnnoxLite(self)
'''
    result = sendGetCommand(self,
                            Constant.WHAT_PLAYER_BINDING,
                            Constant.TYPE_VNNOX_BINDINFO,
                            Constant.ACTION_GET,
                            0,
                            data=None,
                            timeout=10,
                            describe="获取绑定信息")
    return result
Exemple #10
0
def getCustomResolution(self):
    '''
            获取自定义分辨率信息
    :parma    self  必须
    :return    result  字典      key:sn号      value:state('OPEN' or 'CLOSE')
    :example    result = getCustomResolution(self)
    '''
    data = {"displayMode": 1}
    result = sendGetCommand(self,
                            Constant.WHAT_SYS_ADVANCED,
                            Constant.TYPE_CURRENT_RESOLUTION,
                            Constant.ACTION_GET,
                            0,
                            data=data,
                            describe="getCustomResolution",
                            applyTo=["T1", "T2", "T3", "T4", "T6", "T8"])
    return result
def getCareInfo(self):
    '''
            获取终端在care的注册信息
    :param    self    必须
    :return   reult   字典      key:sn号     value:{
                                            "state":true,
                                            "serverNodes":[
                                                            {
                                                                 "label":"测试",
                                                                 "node":"t.novaicare.com"
                                                            },
                                                            {
                                                                "label":"美国节点",
                                                                "node":"care-us.novaicare.com"
                                                            },
                                                            {
                                                                "label":"中国节点",
                                                                "node":"care.novaicare.com"
                                                            }
                                                        ],
                                            "url":"t.novaicare.com",
                                            "username":"******",
                                            "isOnline":true
                                        }
    :example  reult = getCareInfo(self)
              reult = {'bzsa07216j0550000355': {u'username': u'chenyongfa', u'isOnline': True, u'url': u't-docker.novaicare.com', u'webSocketUrl': u'', u'state': True, u'serverNodes': [{u'node': u'care-us.novaicare.com', u'label': u'\u7f8e\u56fd'}, {u'node': u'care.novaicare.com', u'label': u'\u4e2d\u56fd'}, {u'node': u'care-sg.novaicare.com', u'label': u'\u65b0\u52a0\u5761'}]}}

    '''
    data = {}
    data["language"] = "zh-cn"
    result = sendGetCommand(self,
                            Constant.WHAT_MONITOR,
                            Constant.TYPE_CARE,
                            Constant.ACTION_GET,
                            0,
                            data=data,
                            timeout=12,
                            describe="getCareInfo")
    return result
Exemple #12
0
def listTransfer(self, programname='local_net_planl'):
    '''.
            开始传输
    :param1   self        必须
    :param2   programname        节目名称         
    :return  flag bool型   节目是否下发成功   
    :example flag = (self,programname='local_net_planl')   '''

    #获取播放清单md5码
    planlistname = 'planlist.json'
    programnamedir = os.path.join(os.path.abspath("../file/media"),
                                  programname)
    mediadir = os.path.join(programnamedir, "media")
    planlistdir = os.path.join(programnamedir, "program/" + programname)
    planlistpath = os.path.join(planlistdir, planlistname)
    listpath = os.listdir(planlistdir)
    for filename in listpath:
        if "json" not in filename:
            mediapicname = filename
    mac = '089E0129007A'
    #计算清单md5
    md5 = getFileMd5(planlistpath)
    #获取节目大小
    totalSize = getFileSize(programnamedir)
    data = {
        "deviceIdentifier": mac,
        "totalSize": totalSize,
        "type": "DEFAULT",
        "source": 1,
        "local": False,
        "solutions": {
            "name": programname,
            "identifier": md5
        }
    }
    #print data
    result = sendGetCommand(self,
                            Constant.WHAT_PLAYLIST,
                            Constant.TYPE_WHAT_PLAYLIST,
                            Constant.ACTION_START,
                            0,
                            data=data,
                            timeout=4,
                            describe="开始传输")
    #print result
    Res = {}
    uploadMediaUrl = {}
    uploadUrl = {}
    for sn in self.sns:
        if result[sn] == "FAILED" or result[sn] == "ERROR":
            Res[sn] = False
            continue

        #上传媒体
        uploadMediaUrl[sn] = result[sn]["uploadMediaUrl"].encode("utf-8")
        #上传清单
        uploadUrl[sn] = result[sn]["appliedInfos"]["uploadUrl"].encode("utf-8")

    result1 = uploadFile(self,
                         file=mediadir,
                         user='******',
                         ftpdir=uploadMediaUrl)
    result2 = uploadFile(self,
                         file=planlistdir,
                         user='******',
                         ftpdir=uploadUrl)
    print "上传媒体结果:" + str(result1)
    print "上传清单结果:" + str(result2)
    for sn in self.sns:
        if result1[sn] == False or result2[sn] == False:
            Res[sn] = False
            continue
    #清单文件路径
    planListUrl = uploadUrl[self.sns[0]] + '/' + planlistname
    #略缩图路径
    thumbnailUrl = uploadUrl[self.sns[0]] + '/' + mediapicname
    time.sleep(3)
    flag = listTransferOver(self,
                            identifier=md5,
                            name=programname,
                            planListUrl=planListUrl,
                            thumbnailUrl=thumbnailUrl)
    for sn in Res.keys():
        if Res[sn] == False:
            print "节目传输错误"
            return False
    return flag
def getFireWareVersion(self):
    result = sendGetCommand(self, Constant.WHAT_VERSION, Constant.TYPE_FIREWARE, Constant.ACTION_GET, 0,timeout=5,describe="获取终端固件版本号")
    return result