Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@classmethod
def debug_atom(cls, data):
stderr(data) # use this function to inspect atoms in an atom tree
return {}
# The parser tree: Each key is an atom name which is traversed if existing.
# Leaves of the parser tree are callables which receive the atom data.
# callables return {fieldname: value} which is updates the TinyTag.
META_DATA_TREE = {b'moov': {b'udta': {b'meta': {b'ilst': {
# see: http://atomicparsley.sourceforge.net/mpeg-4files.html
b'\xa9alb': {b'data': Parser.make_data_atom_parser('album')},
b'\xa9ART': {b'data': Parser.make_data_atom_parser('artist')},
b'aART': {b'data': Parser.make_data_atom_parser('albumartist')},
# b'cpil': {b'data': Parser.make_data_atom_parser('compilation')},
b'\xa9cmt': {b'data': Parser.make_data_atom_parser('comment')},
b'disk': {b'data': Parser.make_number_parser('disc', 'disc_total')},
b'\xa9wrt': {b'data': Parser.make_data_atom_parser('composer')},
b'\xa9day': {b'data': Parser.make_data_atom_parser('year')},
b'\xa9gen': {b'data': Parser.make_data_atom_parser('genre')},
b'gnre': {b'data': Parser.parse_id3v1_genre},
b'\xa9nam': {b'data': Parser.make_data_atom_parser('title')},
b'trkn': {b'data': Parser.make_number_parser('track', 'track_total')},
}}}}}
# see: https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html
AUDIO_DATA_TREE = {
b'moov': {
b'mvhd': Parser.parse_mvhd,
b'trak': {b'mdia': {b"minf": {b"stbl": {b"stsd": {b'mp4a':
Parser.parse_audio_sample_entry
}}}}}
}
# Leaves of the parser tree are callables which receive the atom data.
# callables return {fieldname: value} which is updates the TinyTag.
META_DATA_TREE = {b'moov': {b'udta': {b'meta': {b'ilst': {
# see: http://atomicparsley.sourceforge.net/mpeg-4files.html
b'\xa9alb': {b'data': Parser.make_data_atom_parser('album')},
b'\xa9ART': {b'data': Parser.make_data_atom_parser('artist')},
b'aART': {b'data': Parser.make_data_atom_parser('albumartist')},
# b'cpil': {b'data': Parser.make_data_atom_parser('compilation')},
b'\xa9cmt': {b'data': Parser.make_data_atom_parser('comment')},
b'disk': {b'data': Parser.make_number_parser('disc', 'disc_total')},
b'\xa9wrt': {b'data': Parser.make_data_atom_parser('composer')},
b'\xa9day': {b'data': Parser.make_data_atom_parser('year')},
b'\xa9gen': {b'data': Parser.make_data_atom_parser('genre')},
b'gnre': {b'data': Parser.parse_id3v1_genre},
b'\xa9nam': {b'data': Parser.make_data_atom_parser('title')},
b'trkn': {b'data': Parser.make_number_parser('track', 'track_total')},
}}}}}
# see: https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html
AUDIO_DATA_TREE = {
b'moov': {
b'mvhd': Parser.parse_mvhd,
b'trak': {b'mdia': {b"minf": {b"stbl": {b"stsd": {b'mp4a':
Parser.parse_audio_sample_entry
}}}}}
}
}
IMAGE_DATA_TREE = {b'moov': {b'udta': {b'meta': {b'ilst': {
b'covr': {b'data': Parser.make_data_atom_parser('_image_data')},
}}}}}