From 5355675a6ac89fecfdcab8590be3ed04e6717dea Mon Sep 17 00:00:00 2001 From: faroukbmiled Date: Fri, 6 Oct 2023 14:11:38 +0100 Subject: [PATCH] invalid items now have proper down dates --- boiiiwd_package/src/library_tab.py | 10 ++++++++++ boiiiwd_package/src/main.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/boiiiwd_package/src/library_tab.py b/boiiiwd_package/src/library_tab.py index 95027a3..0d91893 100644 --- a/boiiiwd_package/src/library_tab.py +++ b/boiiiwd_package/src/library_tab.py @@ -635,6 +635,16 @@ class LibraryTab(ctk.CTkScrollableFrame): if offline_date: down_date = offline_date + elif invalid_warn: + try: + zone_path = Path(folder) / "zone" + for ff_file in zone_path.glob("*.ff"): + if ff_file.exists(): + creation_timestamp = ff_file.stat().st_mtime + break + down_date = datetime.fromtimestamp(creation_timestamp).strftime("%d %b, %Y @ %I:%M%p") + except: + down_date = "Failed to get download date" else: down_date = self.get_item_by_id(items_file, workshop_id, 'date') diff --git a/boiiiwd_package/src/main.py b/boiiiwd_package/src/main.py index 931e140..9b3cc11 100644 --- a/boiiiwd_package/src/main.py +++ b/boiiiwd_package/src/main.py @@ -1625,7 +1625,8 @@ class BOIIIWD(ctk.CTk): remove_tree(map_folder) remove_tree(download_folder) - self.library_tab.update_item(self.edit_destination_folder.get(), workshop_id, mod_type, folder_name) + if not invalid_item_folder: + self.library_tab.update_item(self.edit_destination_folder.get(), workshop_id, mod_type, folder_name) self.show_complete_message(message=f"{mod_type.capitalize()} files were downloaded\nYou can run the game now!\nPS: You have to restart the game \n(pressing launch will launch/restarts)") self.button_download.configure(state="normal") self.button_stop.configure(state="disabled")