detail button support mods with no ID
This commit is contained in:
parent
46e8db353c
commit
531d1d78c0
@ -214,9 +214,8 @@ class LibraryTab(ctk.CTkScrollableFrame):
|
|||||||
for zone_path in folder_path.glob("**/zone"):
|
for zone_path in folder_path.glob("**/zone"):
|
||||||
json_path = zone_path / "workshop.json"
|
json_path = zone_path / "workshop.json"
|
||||||
if json_path.exists():
|
if json_path.exists():
|
||||||
# current folder name
|
|
||||||
curr_folder_name = zone_path.parent.name
|
|
||||||
|
|
||||||
|
curr_folder_name = zone_path.parent.name
|
||||||
workshop_id = extract_json_data(json_path, "PublisherID") or "None"
|
workshop_id = extract_json_data(json_path, "PublisherID") or "None"
|
||||||
name = re.sub(r'\^\w+', '', extract_json_data(json_path, "Title")) or "None"
|
name = re.sub(r'\^\w+', '', extract_json_data(json_path, "Title")) or "None"
|
||||||
name = name[:45] + "..." if len(name) > 45 else name
|
name = name[:45] + "..." if len(name) > 45 else name
|
||||||
@ -415,17 +414,21 @@ class LibraryTab(ctk.CTkScrollableFrame):
|
|||||||
def show_map_thread():
|
def show_map_thread():
|
||||||
workshop_id = workshop
|
workshop_id = workshop
|
||||||
online = if_internet_available("return")
|
online = if_internet_available("return")
|
||||||
|
valid_id = None
|
||||||
|
|
||||||
if not workshop_id.isdigit():
|
if not workshop_id.isdigit():
|
||||||
try:
|
try:
|
||||||
if extract_workshop_id(workshop_id).strip().isdigit():
|
if extract_workshop_id(workshop_id).strip().isdigit():
|
||||||
workshop_id = extract_workshop_id(workshop_id).strip()
|
workshop_id = extract_workshop_id(workshop_id).strip()
|
||||||
else:
|
else:
|
||||||
show_message("Warning", "Not a valid Workshop ID.")
|
raise
|
||||||
except:
|
except:
|
||||||
show_message("Warning", "Not a valid Workshop ID.")
|
valid_id = False
|
||||||
return
|
# show_message("Warning", "Not a valid Workshop ID.")
|
||||||
if online:
|
for button_view in self.button_view_list:
|
||||||
|
button_view.configure(state="normal")
|
||||||
|
# return
|
||||||
|
if online and valid_id!=False:
|
||||||
try:
|
try:
|
||||||
url = f"https://steamcommunity.com/sharedfiles/filedetails/?id={workshop_id}"
|
url = f"https://steamcommunity.com/sharedfiles/filedetails/?id={workshop_id}"
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
@ -454,7 +457,7 @@ class LibraryTab(ctk.CTkScrollableFrame):
|
|||||||
stars_div = soup.find("div", class_="fileRatingDetails")
|
stars_div = soup.find("div", class_="fileRatingDetails")
|
||||||
starts = stars_div.find("img")["src"]
|
starts = stars_div.find("img")["src"]
|
||||||
except:
|
except:
|
||||||
show_message("Warning", "Not a valid Workshop ID\nCouldn't get information.")
|
show_message("Warning", "Couldn't get information.")
|
||||||
for button_view in self.button_view_list:
|
for button_view in self.button_view_list:
|
||||||
button_view.configure(state="normal")
|
button_view.configure(state="normal")
|
||||||
return
|
return
|
||||||
@ -486,7 +489,7 @@ class LibraryTab(ctk.CTkScrollableFrame):
|
|||||||
url, workshop_id, invalid_warn, folder)
|
url, workshop_id, invalid_warn, folder)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
show_message("Error", f"Failed to fetch map information.\nError: {e}", icon="cancel")
|
show_message("Error", f"Failed to fetch information.\nError: {e}", icon="cancel")
|
||||||
for button_view in self.button_view_list:
|
for button_view in self.button_view_list:
|
||||||
button_view.configure(state="normal")
|
button_view.configure(state="normal")
|
||||||
return
|
return
|
||||||
@ -530,7 +533,6 @@ class LibraryTab(ctk.CTkScrollableFrame):
|
|||||||
button_view.configure(state="normal")
|
button_view.configure(state="normal")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
info_thread = threading.Thread(target=show_map_thread)
|
info_thread = threading.Thread(target=show_map_thread)
|
||||||
info_thread.start()
|
info_thread.start()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user