You've already forked PythonLib
mirror of
https://github.com/lifebottle/PythonLib.git
synced 2026-02-13 15:25:50 -08:00
Adding upload_xdelta function to upload patch to google drive
This commit is contained in:
@@ -9,15 +9,37 @@ import requests
|
||||
import subprocess
|
||||
import ApacheAutomate
|
||||
import RepoFunctions
|
||||
from pydrive.auth import GoogleAuth
|
||||
from pydrive.drive import GoogleDrive
|
||||
|
||||
|
||||
SCRIPT_VERSION = "0.3"
|
||||
GoogleAuth.DEFAULT_SETTINGS['client_config_file'] = "../client_secrets.json"
|
||||
|
||||
def generate_xdelta_patch(original_path, new_path, xdelta_name="Tales-Of-Rebirth_Patch_New.xdelta"):
|
||||
|
||||
def generate_xdelta_patch(repo_name, xdelta_name="Tales-Of-Rebirth_Patch_New.xdelta"):
|
||||
|
||||
print("Create xdelta patch")
|
||||
original_path = "../Data/{}/Disc/Original/{}.iso".format(repo_name, repo_name)
|
||||
new_path = "../Data/{}/Disc/New/{}.iso".format(repo_name, repo_name)
|
||||
subprocess.run(["xdelta", "-s", original_path, new_path, xdelta_name])
|
||||
|
||||
|
||||
def upload_xdelta(xdelta_name, folder_name):
|
||||
|
||||
gauth = GoogleAuth()
|
||||
drive = GoogleDrive(gauth)
|
||||
|
||||
xdelta_name = r"G:\TalesHacking\PythonLib_Playground\Data\Tales-Of-Rebirth\Disc\New\Tales-Of-Rebirth_patch.xdelta"
|
||||
|
||||
folder_id = '1txy2BI8tTFDPT9vmIbFELW2qmxC_ZjW0'
|
||||
|
||||
gfile = drive.CreateFile({'parents': [{'id': folder_id}]})
|
||||
|
||||
|
||||
file_name = os.path.basename(xdelta_name)
|
||||
gfile['title'] = file_name
|
||||
|
||||
gfile.SetContentFile(xdelta_name)
|
||||
gfile.Upload() # Upload the file.
|
||||
|
||||
def get_directory_path(path):
|
||||
return os.path.dirname(os.path.abspath(path))
|
||||
@@ -200,13 +222,11 @@ if __name__ == "__main__":
|
||||
if args.file == "SLPS":
|
||||
|
||||
#SLPS
|
||||
tales_instance.insert_Menu_File("../Data/TOR/Disc/Original/SLPS_254.50")
|
||||
tales_instance.pack_Menu_File("../Data/Tales-Of-Rebirth/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
|
||||
|
||||
generate_xdelta_patch("Tales-Of-Rebirth", "../Data/Tales-Of-Rebirth/Disc/New/Tales-Of-Rebirth_patch.xdelta")
|
||||
if args.action == "unpack":
|
||||
|
||||
if args.file == "Main":
|
||||
|
||||
Reference in New Issue
Block a user