Пример #1
0
 def check_source(self, source, last_status, id, agent, thread, name, type):
     """
     Get status of profile, if stastus not change then update check equal 1.      
     Ffmpeg: Use Ffprobe to check stastus profile (source) and return flag 
     0 is down
     1 is up
     2 is video error
     3 is audio eror 
     """
     ffmpeg = Ffmpeg()
     check = ffmpeg.check_source(source)
     # print "%s : %s"%(check, last_status)
     self.logger.debug("Curent :%s <> Last: %s" % (check, last_status))
     if check != last_status:
         json_data = """{"source":"%s","status":%s,"pa_id":%s,"agent": "%s","thread":%s,"name":"%s","type":"%s"}""" % (
             source, last_status, id, agent, thread, name, type)
         file = File()
         replicate = file.append_to_check_list(json_data)
         if not replicate:
             self.logger.info("Doubt curent %s <> Last %s : %s" %
                              (check, last_status, str(json_data)))