fix details updater

This commit is contained in:
faroukbmiled 2023-09-29 20:11:42 +01:00
parent 4dedafea68
commit 0e24fea3d3
2 changed files with 8 additions and 2 deletions

View File

@ -354,7 +354,7 @@ def get_item_name(id):
def show_noti(widget ,message, event=None, noti_dur=3.0, topmost=False):
CTkToolTip(widget, message=message, is_noti=True, noti_event=event, noti_dur=noti_dur, topmost=topmost)
def check_item_date(down_date, date_updated):
def check_item_date(down_date, date_updated, format=False):
current_year = datetime.now().year
date_format_with_year = "%d %b, %Y @ %I:%M%p"
date_format_with_added_year = "%d %b @ %I:%M%p, %Y"
@ -364,6 +364,12 @@ def check_item_date(down_date, date_updated):
except ValueError:
download_datetime = datetime.strptime(down_date + f", {current_year}", date_format_with_added_year)
if format:
try:
date_updated = datetime.strptime(date_updated, date_format_with_year)
except ValueError:
date_updated = datetime.strptime(date_updated + f", {current_year}", date_format_with_added_year)
if date_updated >= download_datetime:
return True
elif date_updated < download_datetime:

View File

@ -675,7 +675,7 @@ class LibraryTab(ctk.CTkScrollableFrame):
def check_for_updates():
try:
if check_item_date(down_date, date_updated):
if check_item_date(down_date, date_updated, format=True):
if show_message("There is an update.", "Press download to redownload!", icon="info", _return=True, option_1="No", option_2="Download"):
if main_app.app.is_downloading:
show_message("Error", "Please wait for the current download to finish or stop it then restart.", icon="cancel")