Skip to content

Commit

Permalink
Added update feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeonss committed Apr 14, 2023
1 parent fd04ec4 commit b81c65e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
\test
\build
\dist
bubbleblaster.spec
bubbleblaster.spec
*.zip
20 changes: 18 additions & 2 deletions bubbleblaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import customtkinter as ctk
from tkinter import filedialog, messagebox

import sys, os
import sys, os, requests, json
import easyocr
import cv2
from deep_translator import GoogleTranslator
Expand All @@ -24,8 +24,12 @@ class App(ctk.CTk):
def __init__(self):
super().__init__()
self.geometry('500x500')
self.title("BubbleBlaster")
self.tag = "1.0"
self.title(f"BubbleBlaster v{self.tag}")
self.eval('tk::PlaceWindow . center')


self.checkUpdate()


self.grid_rowconfigure(0, weight=0)
Expand Down Expand Up @@ -245,6 +249,18 @@ def exportRaw(self, image, raw_list, rects):
fp.close()
return raw_string


def checkUpdate(self):
r = requests.get("https://api.github.com/repos/Aeonss/BubbleBlaster/releases/latest")
latest_tag = json.loads(r.content).get("tag_name")
if latest_tag > self.tag:
res = messagebox.askquestion(title=None, message=f"A new update has been released for BubbleBlaster (v{latest_tag})! Do you want to download it?")
if res == 'yes':
r2 = requests.get(f"https://github.com/Aeonss/BubbleBlaster/releases/download/{latest_tag}/BubbleBlaster.zip", allow_redirects=True)
with open('BubbleBlaster.zip', 'wb') as f:
f.write(r2.content)


if __name__ == "__main__":
app = App()
app.mainloop()
Expand Down
5 changes: 5 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import requests, json

r = requests.get("https://api.github.com/repos/Aeonss/WebtoonReader/releases/latest")

print(json.loads(r.content).get("tag_name"))

0 comments on commit b81c65e

Please sign in to comment.