From 3eb55713f22953be45d7432559d890b15418be19 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Sat, 3 Oct 2020 08:41:20 -0400 Subject: [PATCH] Tools: Add a script for showing the metadata of a file This seems generally useful for determining what we should save or try to display in the track database. Signed-off-by: Anna Schumaker --- tools/show_tags.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/show_tags.py diff --git a/tools/show_tags.py b/tools/show_tags.py new file mode 100644 index 0000000..1289f8d --- /dev/null +++ b/tools/show_tags.py @@ -0,0 +1,24 @@ +#!/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()