from pymediainfo import MediaInfo
import flag


media_info = MediaInfo.parse('/mnt/hgfs/Multimedia/Movies/The.'
                             'Hobbit.An.Unexpected.Journey.2012.Extended.'
                             'BluRay.1080p.Rus.Eng.-HQCLUB.mkv')

# for track in media_info.tracks:
#     if track.track_type == 'Text':
#         # print(dir(track))
#         language = track.language
#         if language == 'en':
#             language = 'gb'
#         flag_type = f':{language}:'
#         print(f'Language: {track.language} {flag.flagize(flag_type)}')
#         print(f'Type: {track.title}\n')

for track in media_info.tracks:
    print(track, dir(track), '\n')

print(media_info.tracks, '\n')

print(media_info.tracks[1].__dict__['frame_rate'])

print(media_info.tracks[1].to_data())

assert media_info.tracks[1].to_data() == media_info.tracks[1].__dict__
