equal
deleted
inserted
replaced
621 """ |
621 """ |
622 |
622 |
623 for k, v in exif.get_main_tags().iteritems() : |
623 for k, v in exif.get_main_tags().iteritems() : |
624 print "%30s: %s" % (k, v) |
624 print "%30s: %s" % (k, v) |
625 |
625 |
626 def main (path, debug=False) : |
626 def main_path (path, dump) : |
627 """ |
627 # dump path |
628 Load and dump EXIF data from the given path |
628 print "%s: " % path |
629 """ |
629 |
630 |
|
631 # try and load it |
630 # try and load it |
632 exif = load_path(path) |
631 exif = load_path(path) |
633 |
632 |
634 if not exif : |
633 if not exif : |
635 raise Exception("No EXIF data found") |
634 raise Exception("No EXIF data found") |
636 |
635 |
637 if debug : |
636 if dump : |
638 # dump it |
637 # dump everything |
639 print "%s: " % path |
|
640 print |
|
641 |
|
642 dump_exif(exif) |
638 dump_exif(exif) |
643 |
639 |
644 else : |
640 else : |
645 # list them |
641 # list them |
646 list_tags(exif) |
642 list_tags(exif) |
|
643 |
|
644 |
|
645 def main (paths, dump=False) : |
|
646 """ |
|
647 Load and dump EXIF data from the given path |
|
648 """ |
|
649 |
|
650 # handle each one |
|
651 for path in paths : |
|
652 main_path(path, dump=dump) |
647 |
653 |
648 if __name__ == '__main__' : |
654 if __name__ == '__main__' : |
|
655 import getopt |
649 from sys import argv |
656 from sys import argv |
650 |
657 |
651 main(argv[1], '-d' in argv) |
658 # defaults |
652 |
659 dump = False |
|
660 |
|
661 # parse args |
|
662 opts, args = getopt.getopt(argv[1:], "d", ["dump"]) |
|
663 |
|
664 for opt, val in opts : |
|
665 if opt in ('-d', "--dump") : |
|
666 dump = True |
|
667 |
|
668 main(args, dump=dump) |
|
669 |