File indexing completed on 2025-03-09 03:59:12

0001 import sys
0002 import argparse
0003 
0004 
0005 if __name__ == "__main__":
0006 
0007     if sys.version_info.major < 3:
0008         import subprocess
0009         sys.exit(subprocess.call(["python3"] + sys.argv))
0010 
0011     parser = argparse.ArgumentParser()
0012     parser.add_argument("file")
0013     parser.add_argument(
0014         "--frame",
0015         type=int,
0016         help="Frame to load",
0017         default=0
0018     )
0019     parser.add_argument(
0020         "--lottiepath",
0021         help="Additional path to add to sys.path",
0022         default=""
0023     )
0024     ns, _ = parser.parse_known_args()
0025     if ns.lottiepath:
0026         sys.path.insert(0, ns.lottiepath)
0027     import lottie
0028     animation = lottie.parsers.tgs.parse_tgs(ns.file)
0029     lottie.exporters.export_svg(animation, sys.stdout, ns.frame, True)