diff --git a/apache_automate.py b/ApacheAutomate.py similarity index 79% rename from apache_automate.py rename to ApacheAutomate.py index 49e4a5f..f97f7fe 100644 --- a/apache_automate.py +++ b/ApacheAutomate.py @@ -4,6 +4,9 @@ from pywinauto import mouse from pywinauto.findwindows import find_windows import os import shutil +import subprocess + + def open_apache3_iso(repo_name): @@ -52,7 +55,7 @@ def browse_replace_file(file_replace_ele, new_file_path, repo_name): file_replace_ele.child_window(title="Replace File", auto_id="1094", control_type="Button").wrapper_object().click() -def replace_files(files_list, app): +def replace_files(files_list, repo_name, app): new_file_path_format = os.path.join( os.path.normpath(os.getcwd() + os.sep + os.pardir), "Data",repo_name, "Disc", "New") for file_name in files_list: @@ -73,31 +76,27 @@ def replace_files(files_list, app): browse_replace_file(file_replace_ele, os.path.join(new_file_path_format, file_name), repo_name) -#Files to reinsert -#files_list = ['SLPS_254.50', 'DAT.bin'] -files_list = ['SLPS_254.50'] -repo_name = "Tales-Of-Rebirth" - -#copy original Iso -original_path = os.path.join(os.getcwd(), "..", "Data", repo_name, "Disc", "Original", "{}.iso".format(repo_name)) -new_path = os.path.join(os.getcwd(), "..", "Data", repo_name, "Disc", "New", "{}.iso".format(repo_name)) - -print("Copy Original Iso into New folder") -shutil.copy( original_path, new_path) - - - -try: - app = application.Application(backend="uia").connect(title='Apache3 Build 3.10.6 (BETA)') - app.Apache3Build.close() +def apache_job(files_list, repo_name): -except: - print("Open Apache3 and load the iso") - app = open_apache3_iso(repo_name) - - print("Replace the different files") - replace_files(files_list,app) + #copy original Iso + original_path = os.path.join(os.getcwd(), "..", "Data", repo_name, "Disc", "Original", "{}.iso".format(repo_name)) + new_path = os.path.join(os.getcwd(), "..", "Data", repo_name, "Disc", "New", "{}.iso".format(repo_name)) - print("Close Apache3") - app.Apache3Build.close() \ No newline at end of file + print("Copy Original Iso into New folder") + shutil.copy( original_path, new_path) + + + try: + app = application.Application(backend="uia").connect(title='Apache3 Build 3.10.6 (BETA)') + app.Apache3Build.close() + + except: + print("Open Apache3 and load the iso") + app = open_apache3_iso(repo_name) + + print("Replace the different files") + replace_files(files_list, repo_name, app) + + print("Close Apache3") + app.Apache3Build.close() \ No newline at end of file diff --git a/ToolsTales_Executable.py b/ToolsTales_Executable.py index a31e17a..1b59e49 100644 --- a/ToolsTales_Executable.py +++ b/ToolsTales_Executable.py @@ -6,9 +6,16 @@ import os import io import re import requests +import subprocess +import ApacheAutomate + SCRIPT_VERSION = "0.3" +def generate_xdelta_patch(original_path, new_path, xdelta_name="Tales-Of-Rebirth_Patch_New.xdelta"): + + 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" @@ -205,6 +212,9 @@ if __name__ == "__main__": #SLPS tales_instance.insert_Menu_File("../Data/TOR/Disc/Original/SLPS_254.50") + + ApacheAutomate.apache_job(['SLPS_254.50'], "Tales-Of-Rebirth") + print("new SLPS is found inside Data/{}/Menu/New".format(game_name)) #Other files for menu stuff diff --git a/__pycache__/ApacheAutomate.cpython-38.pyc b/__pycache__/ApacheAutomate.cpython-38.pyc new file mode 100644 index 0000000..7506e65 Binary files /dev/null and b/__pycache__/ApacheAutomate.cpython-38.pyc differ