diff options
Diffstat (limited to 'libmat2/video.py')
| -rw-r--r-- | libmat2/video.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libmat2/video.py b/libmat2/video.py index 4f15b19..0060f78 100644 --- a/libmat2/video.py +++ b/libmat2/video.py | |||
| @@ -10,10 +10,10 @@ from . import subprocess | |||
| 10 | class AbstractFFmpegParser(exiftool.ExiftoolParser): | 10 | class AbstractFFmpegParser(exiftool.ExiftoolParser): |
| 11 | """ Abstract parser for all FFmpeg-based ones, mainly for video. """ | 11 | """ Abstract parser for all FFmpeg-based ones, mainly for video. """ |
| 12 | # Some fileformats have mandatory metadata fields | 12 | # Some fileformats have mandatory metadata fields |
| 13 | meta_key_value_whitelist = {} # type: Dict[str, Union[str, int]] | 13 | meta_key_value_allowlist = {} # type: Dict[str, Union[str, int]] |
| 14 | 14 | ||
| 15 | def remove_all(self) -> bool: | 15 | def remove_all(self) -> bool: |
| 16 | if self.meta_key_value_whitelist: | 16 | if self.meta_key_value_allowlist: |
| 17 | logging.warning('The format of "%s" (%s) has some mandatory ' | 17 | logging.warning('The format of "%s" (%s) has some mandatory ' |
| 18 | 'metadata fields; mat2 filled them with standard ' | 18 | 'metadata fields; mat2 filled them with standard ' |
| 19 | 'data.', self.filename, ', '.join(self.mimetypes)) | 19 | 'data.', self.filename, ', '.join(self.mimetypes)) |
| @@ -45,8 +45,8 @@ class AbstractFFmpegParser(exiftool.ExiftoolParser): | |||
| 45 | 45 | ||
| 46 | ret = dict() # type: Dict[str, Union[str, dict]] | 46 | ret = dict() # type: Dict[str, Union[str, dict]] |
| 47 | for key, value in meta.items(): | 47 | for key, value in meta.items(): |
| 48 | if key in self.meta_key_value_whitelist.keys(): | 48 | if key in self.meta_key_value_allowlist.keys(): |
| 49 | if value == self.meta_key_value_whitelist[key]: | 49 | if value == self.meta_key_value_allowlist[key]: |
| 50 | continue | 50 | continue |
| 51 | ret[key] = value | 51 | ret[key] = value |
| 52 | return ret | 52 | return ret |
| @@ -54,7 +54,7 @@ class AbstractFFmpegParser(exiftool.ExiftoolParser): | |||
| 54 | 54 | ||
| 55 | class WMVParser(AbstractFFmpegParser): | 55 | class WMVParser(AbstractFFmpegParser): |
| 56 | mimetypes = {'video/x-ms-wmv', } | 56 | mimetypes = {'video/x-ms-wmv', } |
| 57 | meta_whitelist = {'AudioChannels', 'AudioCodecID', 'AudioCodecName', | 57 | meta_allowlist = {'AudioChannels', 'AudioCodecID', 'AudioCodecName', |
| 58 | 'ErrorCorrectionType', 'AudioSampleRate', 'DataPackets', | 58 | 'ErrorCorrectionType', 'AudioSampleRate', 'DataPackets', |
| 59 | 'Directory', 'Duration', 'ExifToolVersion', | 59 | 'Directory', 'Duration', 'ExifToolVersion', |
| 60 | 'FileAccessDate', 'FileInodeChangeDate', 'FileLength', | 60 | 'FileAccessDate', 'FileInodeChangeDate', 'FileLength', |
| @@ -64,7 +64,7 @@ class WMVParser(AbstractFFmpegParser): | |||
| 64 | 'ImageWidth', 'MIMEType', 'MaxBitrate', 'MaxPacketSize', | 64 | 'ImageWidth', 'MIMEType', 'MaxBitrate', 'MaxPacketSize', |
| 65 | 'Megapixels', 'MinPacketSize', 'Preroll', 'SendDuration', | 65 | 'Megapixels', 'MinPacketSize', 'Preroll', 'SendDuration', |
| 66 | 'SourceFile', 'StreamNumber', 'VideoCodecName', } | 66 | 'SourceFile', 'StreamNumber', 'VideoCodecName', } |
| 67 | meta_key_value_whitelist = { # some metadata are mandatory :/ | 67 | meta_key_value_allowlist = { # some metadata are mandatory :/ |
| 68 | 'AudioCodecDescription': '', | 68 | 'AudioCodecDescription': '', |
| 69 | 'CreationDate': '0000:00:00 00:00:00Z', | 69 | 'CreationDate': '0000:00:00 00:00:00Z', |
| 70 | 'FileID': '00000000-0000-0000-0000-000000000000', | 70 | 'FileID': '00000000-0000-0000-0000-000000000000', |
| @@ -78,7 +78,7 @@ class WMVParser(AbstractFFmpegParser): | |||
| 78 | 78 | ||
| 79 | class AVIParser(AbstractFFmpegParser): | 79 | class AVIParser(AbstractFFmpegParser): |
| 80 | mimetypes = {'video/x-msvideo', } | 80 | mimetypes = {'video/x-msvideo', } |
| 81 | meta_whitelist = {'SourceFile', 'ExifToolVersion', 'FileName', 'Directory', | 81 | meta_allowlist = {'SourceFile', 'ExifToolVersion', 'FileName', 'Directory', |
| 82 | 'FileSize', 'FileModifyDate', 'FileAccessDate', | 82 | 'FileSize', 'FileModifyDate', 'FileAccessDate', |
| 83 | 'FileInodeChangeDate', 'FilePermissions', 'FileType', | 83 | 'FileInodeChangeDate', 'FilePermissions', 'FileType', |
| 84 | 'FileTypeExtension', 'MIMEType', 'FrameRate', 'MaxDataRate', | 84 | 'FileTypeExtension', 'MIMEType', 'FrameRate', 'MaxDataRate', |
| @@ -98,7 +98,7 @@ class AVIParser(AbstractFFmpegParser): | |||
| 98 | 98 | ||
| 99 | class MP4Parser(AbstractFFmpegParser): | 99 | class MP4Parser(AbstractFFmpegParser): |
| 100 | mimetypes = {'video/mp4', } | 100 | mimetypes = {'video/mp4', } |
| 101 | meta_whitelist = {'AudioFormat', 'AvgBitrate', 'Balance', 'TrackDuration', | 101 | meta_allowlist = {'AudioFormat', 'AvgBitrate', 'Balance', 'TrackDuration', |
| 102 | 'XResolution', 'YResolution', 'ExifToolVersion', | 102 | 'XResolution', 'YResolution', 'ExifToolVersion', |
| 103 | 'FileAccessDate', 'FileInodeChangeDate', 'FileModifyDate', | 103 | 'FileAccessDate', 'FileInodeChangeDate', 'FileModifyDate', |
| 104 | 'FileName', 'FilePermissions', 'MIMEType', 'FileType', | 104 | 'FileName', 'FilePermissions', 'MIMEType', 'FileType', |
| @@ -109,7 +109,7 @@ class MP4Parser(AbstractFFmpegParser): | |||
| 109 | 'MovieDataSize', 'VideoFrameRate', 'MediaTimeScale', | 109 | 'MovieDataSize', 'VideoFrameRate', 'MediaTimeScale', |
| 110 | 'SourceImageHeight', 'SourceImageWidth', | 110 | 'SourceImageHeight', 'SourceImageWidth', |
| 111 | 'MatrixStructure', 'MediaDuration'} | 111 | 'MatrixStructure', 'MediaDuration'} |
| 112 | meta_key_value_whitelist = { # some metadata are mandatory :/ | 112 | meta_key_value_allowlist = { # some metadata are mandatory :/ |
| 113 | 'CreateDate': '0000:00:00 00:00:00', | 113 | 'CreateDate': '0000:00:00 00:00:00', |
| 114 | 'CurrentTime': '0 s', | 114 | 'CurrentTime': '0 s', |
| 115 | 'MediaCreateDate': '0000:00:00 00:00:00', | 115 | 'MediaCreateDate': '0000:00:00 00:00:00', |
