def sanity_check_media_item(self, media_item): start = datetime.strptime(media_item['start'], "%Y-%m-%d-%H-%M-%S") end = datetime.strptime(media_item['end'], "%Y-%m-%d-%H-%M-%S") length1 = pure.date_interval_to_seconds(end - start) length2 = media_item['cue_out'] - media_item['cue_in'] if abs(length2 - length1) > 1: self.logger.error("end - start length: %s", length1) self.logger.error("cue_out - cue_in length: %s", length2) self.logger.error("Two lengths are not equal!!!")
def sanity_check_media_item(self, media_item): start = datetime.strptime(media_item['start'], "%Y-%m-%d-%H-%M-%S") end = datetime.strptime(media_item['end'], "%Y-%m-%d-%H-%M-%S") mime = media_item['metadata']['mime'] mimetypes.init(["%s/mime.types" % os.path.dirname(os.path.realpath(__file__))]) mime_ext = mimetypes.guess_extension(mime, strict=False) length1 = pure.date_interval_to_seconds(end - start) length2 = media_item['cue_out'] - media_item['cue_in'] if abs(length2 - length1) > 1: self.logger.error("end - start length: %s", length1) self.logger.error("cue_out - cue_in length: %s", length2) self.logger.error("Two lengths are not equal!!!") media_item['file_ext'] = mime_ext return mime_ext
def sanity_check_media_item(self, media_item): start = datetime.strptime(media_item['start'], "%Y-%m-%d-%H-%M-%S") end = datetime.strptime(media_item['end'], "%Y-%m-%d-%H-%M-%S") length1 = pure.date_interval_to_seconds(end - start) length2 = media_item['cue_out'] - media_item['cue_in'] print print '### sanity check #########################' #print media_item #print '------------------------------------------' print 'length1 (end - start) : %s' % length1 print 'length2 (coue_out - cue_in) : %s' % length2 if abs(length2 - length1) > 1: self.logger.error("Two lengths are not equal!!!") self.logger.error("end - start length: %s", length1) self.logger.error("cue_out - cue_in length: %s", length2) self.logger.error("------------------------------------------")