#!/usr/local/bin/python2.7
# Full tag list for any given file.
# Copyright 2005 Joe Wreschnig
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.

import sys
import locale

from optparse import OptionParser


def main(argv):
    from mutagen import File

    parser = OptionParser()
    parser.add_option("--no-flac", help="Compatibility; does nothing.")
    parser.add_option("--no-mp3", help="Compatibility; does nothing.")
    parser.add_option("--no-apev2", help="Compatibility; does nothing.")

    (options, args) = parser.parse_args(argv[1:])
    if not args:
        raise SystemExit(parser.print_help() or 1)

    enc = locale.getpreferredencoding() or "utf-8"
    for filename in args:
        print("--", filename)
        try:
            print("- " + File(filename).pprint().encode(enc, 'replace'))
        except AttributeError:
            print("- Unknown file type")
        except KeyboardInterrupt:
            raise
        except Exception as err:
            print(str(err))
        print


if __name__ == "__main__":
    main(sys.argv)
