Created
January 30, 2020 21:21
-
-
Save Matojeje/8f49df03dd575d9b6e55dcca2e87f192 to your computer and use it in GitHub Desktop.
Converts JSON files exported from bodymovin AE plugin to TGS (Telegram sticker)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import gzip | |
parser = argparse.ArgumentParser(description="Packs JSON files exported by Bodymovin into TGS files for Telegram.\nIt's literally just gzip.", epilog="By Mato.") | |
parser.add_argument("filename", type=str, help="The JSON file to convert") | |
filename = vars(parser.parse_args())["filename"] | |
print("Opening file") | |
# http://xahlee.info/python/gzip.html | |
input = open(filename, "rb") | |
file = input.read() | |
input.close() | |
output = gzip.GzipFile(filename + ".gz.tgs", "wb") | |
output.write(file) | |
output.close() | |
print("Done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment