diff --git a/boiiiwd_package/src/f.html b/boiiiwd_package/src/f.html
deleted file mode 100644
index af3565c..0000000
--- a/boiiiwd_package/src/f.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
File Size
-
Posted
-
Updated
-
-
-
-
0.041 MB
-
30 Sep, 2016 @ 1:03pm
-
1 Oct, 2016 @ 12:19pm
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/boiiiwd_package/src/library_tab.py b/boiiiwd_package/src/library_tab.py
index 8f01254..c550f87 100644
--- a/boiiiwd_package/src/library_tab.py
+++ b/boiiiwd_package/src/library_tab.py
@@ -98,6 +98,9 @@ class LibraryTab(ctk.CTkScrollableFrame):
with open(items_file, "r") as f:
items_data = json.load(f)
for item_info in items_data:
+ if not folder_name and "id" in item_info and item_info["id"] == workshop_id:
+ return True, False
+
if "id" in item_info and "folder_name" in item_info and "json_folder_name" in item_info:
if item_info["id"] == workshop_id and item_info["folder_name"] == folder_name:
if item_info["folder_name"] in self.added_folders:
@@ -178,7 +181,8 @@ class LibraryTab(ctk.CTkScrollableFrame):
items_data = json.load(f)
cleaned_items = [item for item in items_data if 'folder_name' in item and 'json_folder_name'
- in item and item['folder_name'] not in self.item_block_list and item['folder_name'] in self.added_folders]
+ in item and item['folder_name'] not in self.item_block_list and item['folder_name']
+ in self.added_folders and item['id'] in self.ids_added]
with open(file, 'w') as file:
json.dump(cleaned_items, file, indent=4)
@@ -221,6 +225,7 @@ class LibraryTab(ctk.CTkScrollableFrame):
if self.refresh_next_time and not dont_add:
self.refresh_next_time = False
self.refresh_items()
+ return
if dont_add:
self.label_list.clear()
diff --git a/boiiiwd_package/src/main.py b/boiiiwd_package/src/main.py
index a15a673..d43c1ab 100644
--- a/boiiiwd_package/src/main.py
+++ b/boiiiwd_package/src/main.py
@@ -1247,9 +1247,9 @@ class BOIIIWD(ctk.CTk):
self.label_speed.configure(text="Installing...")
mod_type = extract_json_data(json_file_path, "Type")
items_file = os.path.join(application_path, LIBRARY_FILE)
- item_exixsts = self.library_tab.item_exists_in_file(items_file, workshop_id)
+ item_exists,_ = self.library_tab.item_exists_in_file(items_file, workshop_id)
- if item_exixsts:
+ if item_exists:
get_folder_name = self.library_tab.get_item_by_id(items_file, workshop_id, return_option="folder_name")
if get_folder_name:
folder_name = get_folder_name
@@ -1274,7 +1274,7 @@ class BOIIIWD(ctk.CTk):
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
- if not item_exixsts:
+ if not item_exists:
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")
@@ -1513,9 +1513,9 @@ class BOIIIWD(ctk.CTk):
self.label_speed.configure(text="Installing...")
mod_type = extract_json_data(json_file_path, "Type")
items_file = os.path.join(application_path, LIBRARY_FILE)
- item_exixsts = self.library_tab.item_exists_in_file(items_file, workshop_id)
+ item_exists,_ = self.library_tab.item_exists_in_file(items_file, workshop_id)
- if item_exixsts:
+ if item_exists:
get_folder_name = self.library_tab.get_item_by_id(items_file, workshop_id, return_option="folder_name")
if get_folder_name:
folder_name = get_folder_name
@@ -1541,7 +1541,7 @@ class BOIIIWD(ctk.CTk):
self.stop_download()
return
- if not item_exixsts:
+ if not item_exists:
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")
diff --git a/boiiiwd_package/src/settings_tab.py b/boiiiwd_package/src/settings_tab.py
index a7ca271..5ab5ed7 100644
--- a/boiiiwd_package/src/settings_tab.py
+++ b/boiiiwd_package/src/settings_tab.py
@@ -1,3 +1,4 @@
+from src import library_tab
from src.update_window import check_for_updates_func
from src.imports import *
from src.helpers import *
@@ -410,6 +411,7 @@ class SettingsTab(ctk.CTkFrame):
return 0
processed_names = set()
+
for folder_path in folders_to_process:
for folder_name in os.listdir(folder_path):
zone_path = os.path.join(folder_path, folder_name, "zone")
@@ -419,24 +421,33 @@ class SettingsTab(ctk.CTkFrame):
continue
json_path = os.path.join(zone_path, "workshop.json")
+ publisher_id = extract_json_data(json_path, 'PublisherID')
new_name = extract_json_data(json_path, option)
if folder_name == new_name:
continue
+ rename_flag = True
+
if os.path.exists(json_path):
- publisher_id = extract_json_data(json_path, 'PublisherID')
folder_to_rename = os.path.join(folder_path, folder_name)
new_folder_name = new_name
while new_folder_name in processed_names:
new_folder_name += f"_{publisher_id}"
+ if folder_name == new_folder_name:
+ rename_flag = False
+ break
new_path = os.path.join(folder_path, new_folder_name)
while os.path.exists(new_path):
new_folder_name += f"_{publisher_id}"
+ if folder_name == new_folder_name:
+ rename_flag = False
+ break
new_path = os.path.join(folder_path, new_folder_name)
- os.rename(folder_to_rename, new_path)
- processed_names.add(new_folder_name)
+ if rename_flag:
+ os.rename(folder_to_rename, new_path)
+ processed_names.add(new_folder_name)
return 1
@@ -619,9 +630,9 @@ class SettingsTab(ctk.CTkFrame):
workshop_id = extract_json_data(json_file_path, "PublisherID")
mod_type = extract_json_data(json_file_path, "Type")
items_file = os.path.join(application_path, LIBRARY_FILE)
- item_exixsts = main_app.app.library_tab.item_exists_in_file(items_file, workshop_id)
+ item_exists,_ = main_app.app.library_tab.item_exists_in_file(items_file, workshop_id)
- if item_exixsts:
+ if item_exists:
get_folder_name = main_app.app.library_tab.get_item_by_id(items_file, workshop_id, return_option="folder_name")
if get_folder_name:
folder_name = get_folder_name
@@ -646,7 +657,7 @@ class SettingsTab(ctk.CTkFrame):
show_message("Error", "Invalid workshop type in workshop.json, are you sure this is a map or a mod?.", icon="cancel")
continue
- if not item_exixsts:
+ if not item_exists:
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")