L drive mapping (#167)

changed the L drive mappings to match the newest windows procedure
This commit is contained in:
j-lin-lmg
2025-10-02 10:41:48 -07:00
committed by GitHub
parent 19340c52ae
commit 83486887ac
9 changed files with 40 additions and 26 deletions

View File

@@ -6,7 +6,7 @@ import shutil
def copy_from_network_drive():
"""Download 7zip from network drive"""
source = r"\\Labs\labs\01_Installers_Utilities\7ZIP\7zr_25.00.exe"
source = r"\\labs.lmg.gg\labs\01_Installers_Utilities\7ZIP\7zr_25.00.exe"
root_dir = os.path.dirname(os.path.realpath(__file__))
destination = os.path.join(root_dir, "7zr_25.00.exe")
shutil.copyfile(source, destination)

View File

@@ -80,7 +80,7 @@ def download_scene(scene: BlenderScene) -> None:
def copy_scene_from_network_drive(file_name, destination):
"""copy blend file from network drive"""
network_dir = Path("\\\\Labs\\labs\\03_ProcessingFiles\\Blender Render")
network_dir = Path("\\\\labs.lmg.gg\\labs.lmg.gg\\03_ProcessingFiles\\Blender Render")
source_path = network_dir.joinpath(file_name)
logging.info("Copying %s from %s", file_name, source_path)
shutil.copyfile(source_path, destination)
@@ -97,12 +97,13 @@ def time_to_seconds(time_string):
return seconds
def run_blender_render(executable_path: Path, log_directory: Path, device: str, benchmark: BlenderScene) -> str:
def run_blender_render(executable_path: Path, log_directory: Path, device: str,
benchmark: BlenderScene) -> str:
"""Execute the blender render of barbershop, returns the duration as string"""
blend_log = log_directory.joinpath("blender.log")
blend_path = SCRIPT_DIR.joinpath(benchmark.file_name)
cmd_line = f'"{str(executable_path)}" -b -E CYCLES -y "{str(blend_path)}" -f 1 -- --cycles-device {device} --cycles-print-stats'
with open(blend_log,'w' , encoding="utf-8") as f_obj:
with open(blend_log, 'w', encoding="utf-8") as f_obj:
subprocess.run(cmd_line, stdout=f_obj, text=True, check=True)
# example: Time: 02:59.57 (Saving: 00:00.16)

View File

@@ -27,7 +27,8 @@ def get_args() -> any:
def copy_from_network_drive():
"""Copies mod file from network drive to harness folder"""
src_path = Path(r"\\Labs\labs\03_ProcessingFiles\Cyberpunk 2077\basegame_no_intro_videos.archive")
src_path = Path(
r"\\labs.lmg.gg\labs\03_ProcessingFiles\Cyberpunk 2077\basegame_no_intro_videos.archive")
dest_path = SCRIPT_DIRECTORY / "basegame_no_intro_videos.archive"
shutil.copyfile(src_path, dest_path)

View File

@@ -37,7 +37,7 @@ def get_install_path():
def copy_replay_from_network_drive():
"""Copies replay file from network drive to harness folder"""
src_path = Path(r"\\Labs\labs\03_ProcessingFiles\Dota2\benchmark.dem")
src_path = Path(r"\\labs.lmg.gg\labs\03_ProcessingFiles\Dota2\benchmark.dem")
dest_path = SCRIPT_DIRECTORY / "benchmark.dem"
shutil.copyfile(src_path, dest_path)
@@ -84,13 +84,18 @@ def copy_config() -> None:
def read_config() -> list[str] | None:
"""Looks for config file and returns contents if found"""
userdata_path = Path(get_steam_folder_path(), "userdata", str(STEAM_USER_ID), str(STEAM_GAME_ID), "local", "cfg", "video.txt")
userdata_path = Path(
get_steam_folder_path(),
"userdata", str(STEAM_USER_ID),
str(STEAM_GAME_ID),
"local", "cfg", "video.txt")
install_path = Path(get_install_path(), "game", "dota", "cfg", "video.txt")
try:
with open(userdata_path, encoding="utf-8") as f:
return f.readlines()
except OSError:
logging.error("Did not find config file at path %s. Trying path %s", userdata_path, install_path)
logging.error("Did not find config file at path %s. Trying path %s",
userdata_path, install_path)
try:
with open(install_path, encoding="utf-8") as f:
return f.readlines()
@@ -118,6 +123,6 @@ def get_resolution():
height = height_match.group(1)
if width_match is not None:
width = width_match.group(1)
if height != 0 and width !=0:
if height != 0 and width != 0:
return (height, width)
return (height, width)

View File

@@ -24,7 +24,7 @@ def install_mingw() -> str:
if str(MINGW_FOLDER) not in original_path:
os.environ['PATH'] = str(MINGW_FOLDER.joinpath('bin')) + os.pathsep + original_path
return "existing mingw installation detected"
source = Path("\\\\Labs\\labs\\01_Installers_Utilities\\MinGW\\").joinpath(MINGW_ZIP)
source = Path("\\\\labs.lmg.gg\\labs.lmg.gg\\01_Installers_Utilities\\MinGW\\").joinpath(MINGW_ZIP)
destination = SCRIPT_DIR.joinpath(MINGW_ZIP)
shutil.copyfile(source, destination)
with ZipFile(destination, 'r') as zip_object:
@@ -36,7 +36,8 @@ def install_mingw() -> str:
def copy_miniconda_from_network_drive():
"""copies miniconda installer from network drive"""
source = Path("\\\\Labs\\labs\\01_Installers_Utilities\\Miniconda\\").joinpath(MINICONDA_INSTALLER)
source = Path("\\\\labs.lmg.gg\\labs.lmg.gg\\01_Installers_Utilities\\Miniconda\\").joinpath(
MINICONDA_INSTALLER)
destination = SCRIPT_DIR.joinpath(MINICONDA_INSTALLER)
shutil.copyfile(source, destination)
@@ -49,7 +50,7 @@ def install_miniconda() -> str:
copy_miniconda_from_network_drive()
except Exception as err:
raise Exception("could not copy miniconda from network drive") from err
command =[
command = [
"powershell",
"start-process",
"-FilePath",
@@ -57,7 +58,7 @@ def install_miniconda() -> str:
"-ArgumentList",
'"/S"',
"-Wait"
]
]
try:
output = subprocess.check_output(command, stderr=subprocess.PIPE, text=True)
except Exception as err:
@@ -71,14 +72,14 @@ def copy_godot_source_from_network_drive() -> str:
if SCRIPT_DIR.joinpath(GODOT_DIR).is_dir():
return "existing godot source directory detected"
zip_name = f"{GODOT_DIR}.zip"
source = Path("\\\\Labs\\labs\\03_ProcessingFiles\\Godot Files\\").joinpath(zip_name)
source = Path("\\\\labs.lmg.gg\\labs.lmg.gg\\03_ProcessingFiles\\Godot Files\\").joinpath(zip_name)
destination = SCRIPT_DIR.joinpath(zip_name)
shutil.copyfile(source, destination)
with ZipFile(destination, 'r') as zip_object:
try:
zip_object.extractall(path=SCRIPT_DIR)
except Exception as ex:
raise Exception ("error extracting godot zip") from ex
raise Exception("error extracting godot zip") from ex
return "godot source copied and unpacked from network drive"
@@ -90,7 +91,8 @@ def check_conda_environment_exists() -> bool:
"-n",
CONDA_ENV_NAME
]
process = subprocess.run(" ".join(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False)
process = subprocess.run(" ".join(command), stdout=subprocess.PIPE,
stderr=subprocess.PIPE, text=True, check=False)
if process.returncode == 1:
return False
return True
@@ -131,6 +133,6 @@ def convert_duration_string_to_seconds(duration: str) -> int:
hours=int(duration.split(':')[0]),
minutes=int(duration.split(':')[1]),
seconds=float(duration.split('.')[0].split(':')[2]),
milliseconds=int(float('0.' + duration.split('.')[1])*1000))
milliseconds=int(float('0.' + duration.split('.')[1]) * 1000))
return round(time_obj.total_seconds())

View File

@@ -17,7 +17,8 @@ def handbrake_present() -> bool:
def copy_handbrake_from_network_drive():
"""copy handbrake cli from network drive"""
source = Path("\\\\Labs\\labs\\01_Installers_Utilities\\Handbrake\\X86\\HandBrakeCLI-1.9.1-win-x86_64\\")
source = Path(
"\\\\labs.lmg.gg\\labs.lmg.gg\\01_Installers_Utilities\\Handbrake\\X86\\HandBrakeCLI-1.9.1-win-x86_64\\")
copy_souce = source / HANDBRAKE_EXECUTABLE
destination = SCRIPT_DIR / HANDBRAKE_EXECUTABLE
shutil.copyfile(copy_souce, destination)
@@ -30,7 +31,7 @@ def is_video_source_present() -> bool:
def copy_video_source():
"""copy big buck bunny source video to local from network drive"""
source = r"\\Labs\labs\03_ProcessingFiles\Handbrake Test\big_buck_bunny_1080p24.y4m"
source = r"\\labs.lmg.gg\labs\03_ProcessingFiles\Handbrake Test\big_buck_bunny_1080p24.y4m"
root_dir = os.path.dirname(os.path.realpath(__file__))
destination = os.path.join(root_dir, SOURCE_VIDEO_NAME)
shutil.copyfile(source, destination)

View File

@@ -16,7 +16,8 @@ PROCESS_NAME = "stellaris.exe"
STEAM_GAME_ID = 281990
CONFIG_LOCATION = Path(f"C:\\Users\\{USERNAME}\\Documents\\Paradox Interactive\\Stellaris")
LOG_LOCATION = Path(f"C:\\Users\\{USERNAME}\\Documents\\Paradox Interactive\\Stellaris\\logs")
BENCHMARK_LOCATION = Path(f"C:\\Users\\{USERNAME}\\Documents\\Paradox Interactive\\Stellaris\\save games\\BENCHMARK")
BENCHMARK_LOCATION = Path(
f"C:\\Users\\{USERNAME}\\Documents\\Paradox Interactive\\Stellaris\\save games\\BENCHMARK")
CONFIG_FILENAME = "settings.txt"
LOG_FILE = "game.log"
@@ -76,7 +77,7 @@ def copy_benchmarkfiles() -> None:
def copy_save_from_network_drive(file_name, destination):
"""copy save file from network drive"""
network_dir = Path("\\\\Labs\\labs\\03_ProcessingFiles\\Stellaris")
network_dir = Path("\\\\labs.lmg.gg\\labs.lmg.gg\\03_ProcessingFiles\\Stellaris")
source_path = network_dir.joinpath(file_name)
logging.info("Copying %s from %s", file_name, source_path)
shutil.copyfile(source_path, destination)

View File

@@ -47,7 +47,8 @@ def reset_savedata():
"""
local_savegame_path = Path(
f"C:\\Users\\{USERNAME}\\Documents\\The Last of Us Part II\\76561199405246658\\savedata") # make this global
network_savegame_path = Path(r"\\Labs\Labs\03_ProcessingFiles\The Last of Us Part II\savedata")
network_savegame_path = Path(
r"\\labs.lmg.gg\Labs\03_ProcessingFiles\The Last of Us Part II\savedata")
# Delete the local savedata folder if it exists
if local_savegame_path.exists() and local_savegame_path.is_dir():
@@ -57,7 +58,8 @@ def reset_savedata():
# Copy the savedata folder from the network drive
try:
shutil.copytree(network_savegame_path, local_savegame_path)
logging.info("Copied savedata folder from %s to %s", network_savegame_path, local_savegame_path)
logging.info("Copied savedata folder from %s to %s",
network_savegame_path, local_savegame_path)
except Exception as e:
logging.error("Failed to copy savedata folder: %s", e)
@@ -68,7 +70,8 @@ def delete_autosave():
"""
Deletes the autosave folder from the local directory if it exists.
"""
local_savegame_path = Path(f"C:\\Users\\{USERNAME}\\Documents\\The Last of Us Part II\\76561199405246658\\savedata")
local_savegame_path = Path(
f"C:\\Users\\{USERNAME}\\Documents\\The Last of Us Part II\\76561199405246658\\savedata")
savefile_path = local_savegame_path / "SAVEFILE0A" # check for autosaved file, delete if exists
if savefile_path.exists() and savefile_path.is_dir():
shutil.rmtree(savefile_path)

View File

@@ -16,12 +16,12 @@ def xz_executable_exists() -> bool:
def copy_from_network_drive():
"""Download xz from network drive"""
source = r"\\Labs\labs\01_Installers_Utilities\xz\xz_5.6.2_x86_64.exe"
source = r"\\labs.lmg.gg\labs\01_Installers_Utilities\xz\xz_5.6.2_x86_64.exe"
root_dir = os.path.dirname(os.path.realpath(__file__))
destination = os.path.join(root_dir, XZ_EXECUTABLE)
shutil.copyfile(source, destination)
source = r"\\Labs\labs\03_ProcessingFiles\Compression\tq_dlss_explained_1080p.mp4"
source = r"\\labs.lmg.gg\labs\03_ProcessingFiles\Compression\tq_dlss_explained_1080p.mp4"
root_dir = os.path.dirname(os.path.realpath(__file__))
destination = os.path.join(root_dir, "tq_dlss_explained_1080p.mp4")
shutil.copyfile(source, destination)