def check_files(self): for ae_type, ae_name in self.D_content.items(): # Check to make sure the referenced files exist in the same # directory as the XML file ae_dir = os.path.split(self.xml_path)[0] ae_path = os.path.join(ae_dir, ae_name) if not os.path.isfile(ae_path): msg = "Package's {} element is missing - {}" raise MissingElement(msg.format(ae_type, ae_path)) # Set the file size and checksum values self.D_app[ae_type]["Content_FileSize"] = str(os.path.getsize(ae_path)) self.D_app[ae_type]["Content_CheckSum"] = md5_checksum(ae_path) # Use MediaInfo to determine the correct information about the # content files if (ae_type == "poster") or (ae_type == "box cover"): self._scan_image(ae_type, ae_path) else: self._scan_video(ae_type, ae_path)
def check_files(self): for ae_type, ae_name in self.D_content.items(): # Check to make sure the referenced files exist in the same # directory as the XML file ae_dir = os.path.split(self.xml_path)[0] ae_path = os.path.join(ae_dir, ae_name) if not os.path.isfile(ae_path): msg = "Package's {} element is missing - {}" raise MissingElement(msg.format(ae_type, ae_path)) # Set the file size and checksum values self.D_app[ae_type]["Content_FileSize"] = str( os.path.getsize(ae_path)) self.D_app[ae_type]["Content_CheckSum"] = md5_checksum(ae_path) # Use MediaInfo to determine the correct information about the # content files if (ae_type == "poster") or (ae_type == "box cover"): self._scan_image(ae_type, ae_path) else: self._scan_video(ae_type, ae_path)
def test_checksum(self): test_value = md5_checksum(reference_mp4) known_value = "f5f66bd6e6b2ed02153d6fa94787626c" self.assertEqual(test_value, known_value)