compress.py: make executable and decompress argument from command line

This commit is contained in:
Maximilian Keßler 2023-03-17 11:54:55 +01:00
parent 0756bba205
commit c381a4c129
Signed by: max
GPG key ID: BCC5A619923C0BA5

12
compress.py Normal file → Executable file
View file

@ -1,8 +1,11 @@
#! /bin/python3
import json import json
import sys
from enum import Enum from enum import Enum
from typing import List, Optional from typing import List, Optional
import more_itertools import more_itertools
from variants import variant_id, variant_name from variants import variant_id, variant_name
from termcolor import colored
BASE62 = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; BASE62 = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@ -204,9 +207,6 @@ def link(game_json: dict) -> str:
return "https://hanab.live/replay-json/{}".format(compressed) return "https://hanab.live/replay-json/{}".format(compressed)
if __name__ == "__main__": if __name__ == "__main__":
deck_str = "15shareutrkcydvpxxudafpwcpmnkiuijnbhfmowbfaqggqklvsl" for arg in sys.argv[1:]:
deck_str = "15mfqsfrjfeixvhkhtaplakrcpnxlwdyqnwsmovdagkgpiuubcub" deck = decompress_deck(arg)
deck_str = "15utfaladkwvgrsdwfpqrkouvxiaismnujcxpmgpqckyfelnhhbb" print(deck)
deck_str = "15vxsmoiybhkgamdagwcsbeuqpwdarfhukfvifnutxjcknrqppll"
deck = decompress_deck(deck_str)
print(deck)