added check in for item existance in steam to boiii and download functions
This commit is contained in:
parent
9656d92865
commit
8b9ec40721
@ -1199,7 +1199,9 @@ class BOIIIWD(ctk.CTk):
|
|||||||
self.label_speed.configure(text="Installing...")
|
self.label_speed.configure(text="Installing...")
|
||||||
mod_type = extract_json_data(json_file_path, "Type")
|
mod_type = extract_json_data(json_file_path, "Type")
|
||||||
items_file = os.path.join(application_path, LIBRARY_FILE)
|
items_file = os.path.join(application_path, LIBRARY_FILE)
|
||||||
if self.library_tab.item_exists_in_file(items_file, workshop_id):
|
item_exixsts = self.library_tab.item_exists_in_file(items_file, workshop_id)
|
||||||
|
|
||||||
|
if item_exixsts:
|
||||||
get_folder_name = self.library_tab.get_item_by_id(items_file, workshop_id, return_option="folder_name")
|
get_folder_name = self.library_tab.get_item_by_id(items_file, workshop_id, return_option="folder_name")
|
||||||
if get_folder_name:
|
if get_folder_name:
|
||||||
folder_name = get_folder_name
|
folder_name = get_folder_name
|
||||||
@ -1215,15 +1217,20 @@ class BOIIIWD(ctk.CTk):
|
|||||||
folder_name = extract_json_data(json_file_path, "publisherID")
|
folder_name = extract_json_data(json_file_path, "publisherID")
|
||||||
|
|
||||||
if mod_type == "mod":
|
if mod_type == "mod":
|
||||||
mods_folder = os.path.join(destination_folder, "mods")
|
path_folder = os.path.join(destination_folder, "mods")
|
||||||
folder_name_path = os.path.join(mods_folder, folder_name, "zone")
|
folder_name_path = os.path.join(path_folder, folder_name, "zone")
|
||||||
elif mod_type == "map":
|
elif mod_type == "map":
|
||||||
usermaps_folder = os.path.join(destination_folder, "usermaps")
|
path_folder = os.path.join(destination_folder, "usermaps")
|
||||||
folder_name_path = os.path.join(usermaps_folder, folder_name, "zone")
|
folder_name_path = os.path.join(path_folder, folder_name, "zone")
|
||||||
else:
|
else:
|
||||||
show_message("Error", f"Invalid workshop type in workshop.json, are you sure this is a map or a mod?., skipping {workshop_id}...", icon="cancel")
|
show_message("Error", f"Invalid workshop type in workshop.json, are you sure this is a map or a mod?., skipping {workshop_id}...", icon="cancel")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not item_exixsts:
|
||||||
|
while os.path.exists(os.path.join(path_folder, folder_name)):
|
||||||
|
folder_name += f"_{workshop_id}"
|
||||||
|
folder_name_path = os.path.join(path_folder, folder_name, "zone")
|
||||||
|
|
||||||
os.makedirs(folder_name_path, exist_ok=True)
|
os.makedirs(folder_name_path, exist_ok=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -1458,7 +1465,9 @@ class BOIIIWD(ctk.CTk):
|
|||||||
self.label_speed.configure(text="Installing...")
|
self.label_speed.configure(text="Installing...")
|
||||||
mod_type = extract_json_data(json_file_path, "Type")
|
mod_type = extract_json_data(json_file_path, "Type")
|
||||||
items_file = os.path.join(application_path, LIBRARY_FILE)
|
items_file = os.path.join(application_path, LIBRARY_FILE)
|
||||||
if self.library_tab.item_exists_in_file(items_file, workshop_id):
|
item_exixsts = self.library_tab.item_exists_in_file(items_file, workshop_id)
|
||||||
|
|
||||||
|
if item_exixsts:
|
||||||
get_folder_name = self.library_tab.get_item_by_id(items_file, workshop_id, return_option="folder_name")
|
get_folder_name = self.library_tab.get_item_by_id(items_file, workshop_id, return_option="folder_name")
|
||||||
if get_folder_name:
|
if get_folder_name:
|
||||||
folder_name = get_folder_name
|
folder_name = get_folder_name
|
||||||
@ -1474,16 +1483,21 @@ class BOIIIWD(ctk.CTk):
|
|||||||
folder_name = extract_json_data(json_file_path, "publisherID")
|
folder_name = extract_json_data(json_file_path, "publisherID")
|
||||||
|
|
||||||
if mod_type == "mod":
|
if mod_type == "mod":
|
||||||
mods_folder = os.path.join(destination_folder, "mods")
|
path_folder = os.path.join(destination_folder, "mods")
|
||||||
folder_name_path = os.path.join(mods_folder, folder_name, "zone")
|
folder_name_path = os.path.join(path_folder, folder_name, "zone")
|
||||||
elif mod_type == "map":
|
elif mod_type == "map":
|
||||||
usermaps_folder = os.path.join(destination_folder, "usermaps")
|
path_folder = os.path.join(destination_folder, "usermaps")
|
||||||
folder_name_path = os.path.join(usermaps_folder, folder_name, "zone")
|
folder_name_path = os.path.join(path_folder, folder_name, "zone")
|
||||||
else:
|
else:
|
||||||
show_message("Error", "Invalid workshop type in workshop.json, are you sure this is a map or a mod?.", icon="cancel")
|
show_message("Error", "Invalid workshop type in workshop.json, are you sure this is a map or a mod?.", icon="cancel")
|
||||||
self.stop_download()
|
self.stop_download()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not item_exixsts:
|
||||||
|
while os.path.exists(os.path.join(path_folder, folder_name)):
|
||||||
|
folder_name += f"_{workshop_id}"
|
||||||
|
folder_name_path = os.path.join(path_folder, folder_name, "zone")
|
||||||
|
|
||||||
os.makedirs(folder_name_path, exist_ok=True)
|
os.makedirs(folder_name_path, exist_ok=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -602,8 +602,9 @@ class SettingsTab(ctk.CTkFrame):
|
|||||||
if os.path.exists(json_file_path):
|
if os.path.exists(json_file_path):
|
||||||
mod_type = extract_json_data(json_file_path, "Type")
|
mod_type = extract_json_data(json_file_path, "Type")
|
||||||
items_file = os.path.join(application_path, LIBRARY_FILE)
|
items_file = os.path.join(application_path, LIBRARY_FILE)
|
||||||
|
item_exixsts = main_app.app.library_tab.item_exists_in_file(items_file, workshop_id)
|
||||||
|
|
||||||
if main_app.app.library_tab.item_exists_in_file(items_file, workshop_id):
|
if item_exixsts:
|
||||||
get_folder_name = main_app.app.library_tab.get_item_by_id(items_file, workshop_id, return_option="folder_name")
|
get_folder_name = main_app.app.library_tab.get_item_by_id(items_file, workshop_id, return_option="folder_name")
|
||||||
if get_folder_name:
|
if get_folder_name:
|
||||||
folder_name = get_folder_name
|
folder_name = get_folder_name
|
||||||
@ -619,15 +620,20 @@ class SettingsTab(ctk.CTkFrame):
|
|||||||
folder_name = extract_json_data(json_file_path, "publisherID")
|
folder_name = extract_json_data(json_file_path, "publisherID")
|
||||||
|
|
||||||
if mod_type == "mod":
|
if mod_type == "mod":
|
||||||
mods_folder = os.path.join(boiii_folder, "mods")
|
path_folder = os.path.join(boiii_folder, "mods")
|
||||||
folder_name_path = os.path.join(mods_folder, folder_name, "zone")
|
folder_name_path = os.path.join(path_folder, folder_name, "zone")
|
||||||
elif mod_type == "map":
|
elif mod_type == "map":
|
||||||
usermaps_folder = os.path.join(boiii_folder, "usermaps")
|
path_folder = os.path.join(boiii_folder, "usermaps")
|
||||||
folder_name_path = os.path.join(usermaps_folder, folder_name, "zone")
|
folder_name_path = os.path.join(path_folder, folder_name, "zone")
|
||||||
else:
|
else:
|
||||||
show_message("Error", "Invalid workshop type in workshop.json, are you sure this is a map or a mod?.", icon="cancel")
|
show_message("Error", "Invalid workshop type in workshop.json, are you sure this is a map or a mod?.", icon="cancel")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if not item_exixsts:
|
||||||
|
while os.path.exists(os.path.join(path_folder, folder_name)):
|
||||||
|
folder_name += f"_{workshop_id}"
|
||||||
|
folder_name_path = os.path.join(path_folder, folder_name, "zone")
|
||||||
|
|
||||||
os.makedirs(folder_name_path, exist_ok=True)
|
os.makedirs(folder_name_path, exist_ok=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user