File indexing completed on 2025-01-05 04:00:26
0001 #!/usr/bin/env python3 0002 0003 import json 0004 import sys 0005 import os 0006 import argparse 0007 sys.path.insert(0, os.path.join( 0008 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 0009 "lib" 0010 )) 0011 from lottie.exporters import prettyprint, prettyprint_summary 0012 from lottie.objects import Animation 0013 from lottie.parsers.tgs import parse_tgs 0014 from lottie import __version__ 0015 0016 parser = argparse.ArgumentParser( 0017 description="Pretty prints a tgs / lottie file with more readable annotations (useful to debug / diff lottie files)" 0018 ) 0019 parser.add_argument("--version", "-v", action="version", version="%(prog)s - python-lottie " + __version__) 0020 parser.add_argument( 0021 "infile", 0022 help="Input file" 0023 ) 0024 parser.add_argument( 0025 "--summary", 0026 "-s", 0027 action="store_true", 0028 help="Just show a short summary" 0029 ) 0030 0031 if __name__ == "__main__": 0032 ns = parser.parse_args() 0033 0034 an = parse_tgs(ns.infile) 0035 0036 if ns.summary: 0037 prettyprint_summary(an) 0038 else: 0039 prettyprint(an) 0040