Skip to content

Commit

Permalink
removed custom field check from mediainfo, small fixes to mediatrace …
Browse files Browse the repository at this point in the history
…check, and added mediatrace fields to config.yaml
  • Loading branch information
eddycolloton committed Jun 22, 2024
1 parent 79a10bd commit f3cb1bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
16 changes: 9 additions & 7 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ mediainfo_values:
Sampling rate: 48.0 kHz
Bit depth: 24 bits
Compression mode: Lossless
expected_custom_fields:
Title:
Encoded by:
Description:
Encoding settings:
ORIGINAL MEDIA TYPE:
exiftool_values:
File Type: MKV
File Type Extension: mkv
Expand Down Expand Up @@ -140,10 +134,18 @@ ffmpeg_values:
ORIGINAL MEDIA TYPE:
ENCODED_BY:
mediatrace:
COLLECTION:
TITLE:
CATALOG_NUMBER:
DESCRIPTION:
ORIGINAL MEDIA TYPE:
DATE_DIGITIZED:
ENCODING_SETTINGS:
ENCODED_BY:
ORIGINAL_MEDIA_TYPE:
DATE_TAGGED:
TERMS_OF_USE:
_TECHNICAL_NOTES:
_ORIGINAL_FPS:
qct-parse:
content:
silence:
Expand Down
20 changes: 1 addition & 19 deletions src/AV_Spex/checks/mediainfo_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def parse_mediainfo(file_path):
expected_general = config_path.config_dict['mediainfo_values']['expected_general']
expected_video = config_path.config_dict['mediainfo_values']['expected_video']
expected_audio = config_path.config_dict['mediainfo_values']['expected_audio']
expected_custom_fields = config_path.config_dict['mediainfo_values']['expected_custom_fields']

section_data = {}
# creates empty dictionary "section_data"
Expand Down Expand Up @@ -114,32 +113,15 @@ def parse_mediainfo(file_path):
if actual_value not in expected_value:
mediainfo_differences.append(f"Metadata field in Audio: {expected_key} has a value of {actual_value}\nThe expected value is: {expected_value}")
# append this string to the list "mediainfo_differences"

custom_mediainfo_differences = []
for expected_key, expected_value in expected_custom_fields.items():
# defines variables "expected_key" and "expected_value" to the dictionary "expected_audio"
if expected_key not in (section_data["General"]):
custom_mediainfo_differences.append(f"metadata field in General: {expected_key} does not exist")
elif len(section_data["General"][expected_key]) == 0:
# count the values in the nested dictionary "General" with 'len', if the values are zero, then:
custom_mediainfo_differences.append(f"General: {expected_key} is empty")
# append this string to the list "mediainfo_differences"

if not mediainfo_differences and not custom_mediainfo_differences:
if not mediainfo_differences:
# if the list "mediainfo_differences" is empty, then
logger.info("\nAll specified fields and values found in the MediaInfo output.")
elif not mediainfo_differences:
logger.info("\nAll specified metadata fields and values found in the MediaInfo output, but some custom embedded fields are missing or don't match.")
else:
# if the list "mediainfo_differences" is not empty, then
logger.critical(f"\nSome specified MediaInfo fields or values are missing or don't match:")
for diff in mediainfo_differences:
logger.critical(f'{diff}')

if custom_mediainfo_differences:
logger.critical("\nThe specified MediaInfo fields or values for embedded metadata are below:")
for custom_diff in custom_mediainfo_differences:
logger.critical(f'{custom_diff}')

# Only execute if this file is run directly, not imported)
if __name__ == "__main__":
Expand Down
4 changes: 4 additions & 0 deletions src/AV_Spex/checks/mediatrace_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def parse_mediatrace(xml_file):
mediatrace_differences.append(f"MediaTrace: {expected_key} is empty")
# append this string to the list "mediatrace_differences"

if not mediatrace_differences:
# if the list "mediatrace_differences" is empty, then
logger.info("\nAll specified mediatrace fields and values found in output.")

if mediatrace_differences:
logger.critical("\nSome specified MediaTrace fields or values are missing or don't match:")
for diff in mediatrace_differences:
Expand Down

1 comment on commit f3cb1bf

@eddycolloton
Copy link
Collaborator Author

@eddycolloton eddycolloton commented on f3cb1bf Jun 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mediatrace fields taken from NMAAHC/nmaahcmm#87

Please sign in to comment.