emmental/tools/show_tags.py

25 lines
518 B
Python

#!/usr/bin/python
# Copyright 2020 (c) Anna Schumaker
#
# Use Mutagen to show the metadata of the requested file
import mutagen
import os
import sys
if len(sys.argv) != 2 or not os.path.isfile(sys.argv[1]):
print(f"Usage: {sys.argv[0]} FILE")
sys.exit(1)
print()
print(f"Reading file {sys.argv[1]}:")
tags = mutagen.File(sys.argv[1])
keys = tags.keys()
keys.sort()
if "metadata_block_picture" in keys:
tags["metadata_block_picture"] = True
for key in keys:
print(f" {key}: {tags[key]}")
print()