Skip to content

Commit cf0cf63

Browse files
committed
[0.7.2] add max recent title
1 parent fef141b commit cf0cf63

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

constant/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
__all__ = [
44
"KEYRING_SERVICE_NAME", "KEYRING_COOKIES", "KEYRING_COOKIES_INDEX",
55
"KEYRING_SETTINGS", "KEYRING_ROOM_INFO", "KEYRING_APP_SETTINGS",
6-
"LOCAL_SERVER_NAME", "LOGGER_NAME", "USERNAME_DISPLAY_TEMPLATE", "VERSION",
7-
"DARK_CSS", "LIGHT_CSS", "ProxyMode", "PreferProto", "CoverStatus",
6+
"LOCAL_SERVER_NAME", "LOGGER_NAME", "USERNAME_DISPLAY_TEMPLATE",
7+
"MAX_RECENT_TITLE", "VERSION", "DARK_CSS", "LIGHT_CSS",
8+
"ProxyMode", "PreferProto", "CoverStatus",
89
"WidgetIndex", "CacheType"
910
]
1011

@@ -53,6 +54,7 @@ class CacheType(StrEnum):
5354
LOCAL_SERVER_NAME = "StartLive|singleInstanceServer"
5455
LOGGER_NAME = "StartLiveLogger"
5556
USERNAME_DISPLAY_TEMPLATE = "{}({})"
57+
MAX_RECENT_TITLE = 5
5658
VERSION = "0.7.2"
5759

5860
APP_KEY = "aae92bc66f3edfab"

models/workers/title/title_update.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# local package import
55
import app_state
6-
from constant import CacheType
6+
from constant import CacheType, MAX_RECENT_TITLE
77
from exceptions import TitleUpdateError
88
from models.cache import get_cache_path
99
from models.log import get_logger
@@ -46,7 +46,8 @@ def run(self, /) -> None:
4646
CacheType.CONFIG,
4747
f"title{app_state.cookies_dict["DedeUserID"]}")
4848
with open(_title_file, "w", encoding="utf-8") as f:
49-
f.write("\n".join(app_state.room_info["recent_title"]))
49+
f.write("\n".join(
50+
app_state.room_info["recent_title"][:MAX_RECENT_TITLE]))
5051

5152
@Slot()
5253
def on_exception(self, *args, **kwargs):

0 commit comments

Comments
 (0)