12345678910111213141516171819202122232425262728293031323334 |
- import sys
- from pprint import pprint
- import re
- if __name__ == "__main__":
- channel = sys.argv[2] if len(sys.argv) == 3 else "stable"
- # Addon
- content = ""
- with open("addon_template.xml", "r") as f:
- content = f.read()
- with open("addon.xml", "w") as f:
- f.write(content.replace("%RELEASE%", "" if channel == "stable" else "_beta"))
- # Settings
- content = ""
- with open("settings_template.xml", "r") as f:
- content = f.read()
- with open("resources/settings.xml", "w") as f:
- f.write(content.replace("%RELEASE%", "" if channel == "stable" else "_beta"))
- content = ""
- with open(sys.argv[1], "r") as f:
- content = f.read()
- content = content.replace("%RELEASE%", channel)
- content = re.sub(r"\nfrom ((?:utils|viewids|watchdog|consts|compressedcookielib|portal|api|playerwatcher).*)", "", content)
- content = re.sub(r"\nimport ((?:utils|viewids|watchdog|consts|compressedcookielib|portal|api|playerwatcher).*)", "", content)
- with open(sys.argv[1], "w") as f:
- f.write(content)
|