diff --git a/speech_translate/_logging.py b/speech_translate/_logging.py index 00aaa1f..4838d34 100644 --- a/speech_translate/_logging.py +++ b/speech_translate/_logging.py @@ -32,8 +32,7 @@ class StreamStderrToLogger(object): """ For stderr and tqdm progress bar """ - def __init__(self, level): - self.level = level + def __init__(self): # tqdm use stderr to print, so we can consider it as info self.considered_info = [ "Downloading", "Fetching", "run_threaded", "Estimating duration from bitrate", "Translating", "Refine", "Align", @@ -60,7 +59,7 @@ def write(self, buf): if len(recent_stderr) > 10: recent_stderr.pop(0) else: - logger.log(self.level, line) + logger.error(line) def flush(self): pass @@ -73,7 +72,7 @@ def init_logging(level): dir_log + "/" + current_log, level=level, encoding="utf-8", backtrace=False, diagnose=True, format=LOG_FORMAT ) - sys.stderr = StreamStderrToLogger("ERROR") + sys.stderr = StreamStderrToLogger() # tqdm use stderr so we also need to redirect it diff --git a/speech_translate/ui/window/about.py b/speech_translate/ui/window/about.py index 3acd76e..d6bf851 100644 --- a/speech_translate/ui/window/about.py +++ b/speech_translate/ui/window/about.py @@ -2,6 +2,7 @@ from tkinter import Canvas, Tk, Toplevel, ttk from loguru import logger +from packaging import version from PIL import Image, ImageTk from requests import get @@ -155,7 +156,7 @@ def req_update_check(self, notify_up_to_date=False): if req is not None and req.status_code == 200: data = req.json() latest_version = str(data["tag_name"]) - if __version__ < latest_version: + if version.parse(__version__) < version.parse(latest_version): logger.info(f"New version found: {latest_version}") self.update_text = "New version available" self.update_fg = "blue"