Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
deeffest authored Dec 29, 2023
1 parent e4975b5 commit 4fe85ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
9 changes: 3 additions & 6 deletions core/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 8 additions & 16 deletions core/update_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 4fe85ac

Please sign in to comment.