From 4fe85ac7c297b76ed911a8e9a8395ec02ce26c59 Mon Sep 17 00:00:00 2001 From: deeffest <117280555+deeffest@users.noreply.github.com> Date: Fri, 29 Dec 2023 15:26:18 +0300 Subject: [PATCH] Add files via upload --- core/main_window.py | 9 +++------ core/update_checker.py | 24 ++++++++---------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/core/main_window.py b/core/main_window.py index 91b6b67..587b82e 100644 --- a/core/main_window.py +++ b/core/main_window.py @@ -127,13 +127,10 @@ def open_image_dialog(self): self.homeInterface.open_image(file_path) def starter_check_updates(self, first_update): - url_version = ( - 'https://sites.google.com/view/deeffest-updates/dliviewer' + url = ( + 'https://api.github.com/repos/deeffest/DEEF-Lite-Image-Viewer/releases/latest' ) - url_download = ( - 'https://sites.google.com/view/deeffest-updates/dliviewer/dliviewer-url' - ) - self.update_checker_thread = UpdateChecker(self.app_version, url_version, url_download, parent=self) + self.update_checker_thread = UpdateChecker(self.app_version, url, parent=self) self.update_checker_thread.update_available.connect(self.msg_box_new_update) if first_update == False: self.update_checker_thread.no_update_found.connect(self.no_update_found_dialog) diff --git a/core/update_checker.py b/core/update_checker.py index f867f86..a96dd49 100644 --- a/core/update_checker.py +++ b/core/update_checker.py @@ -10,29 +10,21 @@ class UpdateChecker(QThread): def __init__( self, version, - url_version, - url_download, + url, parent=None ): super().__init__(parent) - self.url_version = url_version - self.url_download = url_download + self.url = url self.app_version = version def run(self): - try: - response = requests.get(self.url_version) - page = BeautifulSoup(response.content, "html5lib") - item_version = page.find("span", class_="C9DxTc") + response = requests.get(self.url) + item_version = response.json()["name"] + item_download = response.json().get("html_url") - response_download = requests.get(self.url_download) - page_download = BeautifulSoup( - response_download.content, "html5lib") - item_download = page_download.find("span", class_="C9DxTc") - except: - pass + print(item_version, item_download) - if item_version is not None and item_version.text != self.app_version: - self.update_available.emit(item_download.text) + if item_version is not None and item_version != self.app_version: + self.update_available.emit(item_download) else: self.no_update_found.emit()