diff --git a/RepoFunctions.py b/RepoFunctions.py new file mode 100644 index 0000000..32de3ef --- /dev/null +++ b/RepoFunctions.py @@ -0,0 +1,31 @@ +import os +import requests +import json +import subprocess + +def get_Releases(org, repo_name, latest=False): + + #git_url = "https://api.github.com/repos/SymphoniaLauren/Tales-of-Rebirth/releases" + git_url = "https://api.github.com/repos/{}/{}/releases".format(org, repo_name) + + if latest: + git_url = git_url+"/latest" + + header = { + "Accept":"application/vnd.github.v3+json" + } + + res = requests.get(git_url) + json_res = json.loads(res.text) + + return json_res + + +def refresh_repo(repo_name): + + base_path = os.path.join(os.getcwd(), "..", repo_name) + print("Repo to refresh: {}".format(base_path)) + listFile = subprocess.run( + ["git", "pull", repo_name], + cwd=base_path + ) diff --git a/ToolsTales_Executable.py b/ToolsTales_Executable.py index 1b59e49..6981932 100644 --- a/ToolsTales_Executable.py +++ b/ToolsTales_Executable.py @@ -8,6 +8,7 @@ import re import requests import subprocess import ApacheAutomate +import RepoFunctions SCRIPT_VERSION = "0.3" @@ -16,22 +17,7 @@ def generate_xdelta_patch(original_path, new_path, xdelta_name="Tales-Of-Rebirth subprocess.run(["xdelta", "-s", original_path, new_path, xdelta_name]) -def get_Releases(org, repo_name, latest=False): - - #git_url = "https://api.github.com/repos/SymphoniaLauren/Tales-of-Rebirth/releases" - git_url = "https://api.github.com/repos/{}/{}/releases".format(org, repo_name) - - if latest: - git_url = git_url+"/latest" - - header = { - "Accept":"application/vnd.github.v3+json" - } - res = requests.get(git_url) - json_res = json.loads(res.text) - - return json_res def get_directory_path(path): return os.path.dirname(os.path.abspath(path)) @@ -208,6 +194,9 @@ if __name__ == "__main__": tales_instance.bytes_to_text_with_offset( args.param1, int(args.param2)) if args.action == "pack": + RepoFunctions.refresh_repo("PythonLib") + RepoFunctions.refresh_repo("Tales-Of-Rebirth") + if args.file == "SLPS": #SLPS diff --git a/__pycache__/ApacheAutomate.cpython-38.pyc b/__pycache__/ApacheAutomate.cpython-38.pyc index 7506e65..781b546 100644 Binary files a/__pycache__/ApacheAutomate.cpython-38.pyc and b/__pycache__/ApacheAutomate.cpython-38.pyc differ