Skip to content

Commit

Permalink
feat:version print
Browse files Browse the repository at this point in the history
  • Loading branch information
Guovin committed Jan 8, 2025
1 parent f03c92b commit 49579a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
format_interval,
check_ipv6_support,
resource_path,
get_urls_from_file
get_urls_from_file,
get_version_info
)


Expand Down Expand Up @@ -212,6 +213,8 @@ def stop(self):


if __name__ == "__main__":
info = get_version_info()
print(f"ℹ️ {info['name']} Version: {info['version']}")
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
update_source = UpdateSource()
Expand Down
6 changes: 2 additions & 4 deletions tkinter_ui/tkinter_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from tkinter import messagebox
from PIL import Image, ImageTk
from utils.config import config
from utils.tools import resource_path
from utils.tools import resource_path, get_version_info
from main import UpdateSource
import asyncio
import threading
Expand All @@ -19,14 +19,12 @@
from hotel import HotelUI
from subscribe import SubscribeUI
from online_search import OnlineSearchUI
import json
from utils.speed import check_ffmpeg_installed_status


class TkinterUI:
def __init__(self, root):
with open(resource_path("version.json"), "r", encoding="utf-8") as f:
info = json.load(f)
info = get_version_info()
self.root = root
self.root.title(info.get("name", ""))
self.version = info.get("version", "")
Expand Down
9 changes: 9 additions & 0 deletions utils/tools.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import ipaddress
import json
import logging
import os
import re
Expand Down Expand Up @@ -592,3 +593,11 @@ def get_datetime_now():
now = datetime.datetime.now()
time_zone = pytz.timezone(config.time_zone)
return now.astimezone(time_zone).strftime("%Y-%m-%d %H:%M:%S")


def get_version_info():
"""
Get the version info
"""
with open(resource_path("version.json"), "r", encoding="utf-8") as f:
return json.load(f)

0 comments on commit 49579a6

Please sign in to comment.