#!/usr/bin/env python
# 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.
#
# $Id: mutagen-inspect 3839 2006-09-11 03:34:43Z piman $

import os
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()
    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, err: print str(err)
        print

if __name__ == "__main__":
    try: import mutagen
    except ImportError:
        # Run as ./mid3v2 out of tools/
        sys.path.append(os.path.abspath("../"))
        import mutagen
    main(sys.argv)
