fix details updater
This commit is contained in:
parent
4dedafea68
commit
0e24fea3d3
@ -354,7 +354,7 @@ def get_item_name(id):
|
|||||||
def show_noti(widget ,message, event=None, noti_dur=3.0, topmost=False):
|
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)
|
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
|
current_year = datetime.now().year
|
||||||
date_format_with_year = "%d %b, %Y @ %I:%M%p"
|
date_format_with_year = "%d %b, %Y @ %I:%M%p"
|
||||||
date_format_with_added_year = "%d %b @ %I:%M%p, %Y"
|
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:
|
except ValueError:
|
||||||
download_datetime = datetime.strptime(down_date + f", {current_year}", date_format_with_added_year)
|
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:
|
if date_updated >= download_datetime:
|
||||||
return True
|
return True
|
||||||
elif date_updated < download_datetime:
|
elif date_updated < download_datetime:
|
||||||
|
@ -675,7 +675,7 @@ class LibraryTab(ctk.CTkScrollableFrame):
|
|||||||
def check_for_updates():
|
def check_for_updates():
|
||||||
try:
|
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 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:
|
if main_app.app.is_downloading:
|
||||||
show_message("Error", "Please wait for the current download to finish or stop it then restart.", icon="cancel")
|
show_message("Error", "Please wait for the current download to finish or stop it then restart.", icon="cancel")
|
||||||
|
Loading…
Reference in New Issue
Block a user