mirror of
https://github.com/ihmily/StreamCap.git
synced 2026-05-06 21:51:36 +08:00
Feat/live complete messagepush (#86)
* fix: change message push controls master switch in settings and sub switch in streamcard (default True) * feat: add Live recording completed message push * fix: check use ruff
This commit is contained in:
@@ -269,7 +269,7 @@ class RecordingManager:
|
||||
recording.title = f"{recording.streamer_name} - {self._[recording.quality]}"
|
||||
recording.display_title = f"[{self._['is_live']}] {recording.title}"
|
||||
|
||||
if self.settings.user_config["stream_start_notification_enabled"] or recording.enabled_message_push:
|
||||
if self.settings.user_config["stream_start_notification_enabled"] and recording.enabled_message_push:
|
||||
push_content = self._["push_content"]
|
||||
begin_push_message_text = self.settings.user_config.get("custom_stream_start_content")
|
||||
if begin_push_message_text:
|
||||
|
||||
@@ -6,6 +6,7 @@ import time
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from ..messages.message_pusher import MessagePusher
|
||||
from ..models.recording_status_model import RecordingStatus
|
||||
from ..models.video_quality_model import VideoQuality
|
||||
from ..process_manager import BackgroundService
|
||||
@@ -264,7 +265,22 @@ class LiveStreamRecorder:
|
||||
else:
|
||||
self.recording.recording = False
|
||||
logger.success(f"Live recording completed: {record_name}")
|
||||
if (self.settings.user_config["stream_end_notification_enabled"]
|
||||
and self.recording.enabled_message_push):
|
||||
push_content = self._["push_content_end"]
|
||||
end_push_message_text = self.settings.user_config.get("custom_stream_end_content")
|
||||
if end_push_message_text:
|
||||
push_content = end_push_message_text
|
||||
|
||||
push_at = datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
push_content = push_content.replace("[room_name]", self.recording.streamer_name).replace(
|
||||
"[time]", push_at
|
||||
)
|
||||
msg_title = self.settings.user_config.get("custom_notification_title").strip()
|
||||
msg_title = msg_title or self._["status_notify"]
|
||||
|
||||
msg_manager = MessagePusher(self.settings)
|
||||
self.app.page.run_task(msg_manager.push_messages, msg_title, push_content)
|
||||
try:
|
||||
self.recording.update({"display_title": display_title})
|
||||
await self.app.record_card_manager.update_card(self.recording)
|
||||
|
||||
@@ -130,7 +130,7 @@ class RecordingDialog:
|
||||
scheduled_recording = initial_values.get("scheduled_recording", False)
|
||||
scheduled_start_time = initial_values.get("scheduled_start_time")
|
||||
monitor_hours = initial_values.get("monitor_hours", 5)
|
||||
message_push_enabled = initial_values.get('enabled_message_push', False)
|
||||
message_push_enabled = initial_values.get('enabled_message_push', True)
|
||||
|
||||
async def on_scheduled_setting_change(e):
|
||||
selected_value = e.control.value
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
"live_room": "Live Room",
|
||||
"recorded": "Recorded",
|
||||
"push_content": "Live room status update: [room_name] is live, time: [time]",
|
||||
"push_content_end": "Live room status update: [room_name] is live completed, time: [time]",
|
||||
"status_notify": "Live room status update notification",
|
||||
"STOPPED_MONITORING": "Monitoring Stopped",
|
||||
"MONITORING": "Monitoring In Progress",
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
"live_room": "直播间",
|
||||
"recorded": "已录制",
|
||||
"push_content": "直播间状态更新:[room_name] 正在直播中,时间:[time]",
|
||||
"push_content_end": "直播间状态更新:[room_name] 直播已结束,时间:[time]",
|
||||
"status_notify": "直播间状态更新通知",
|
||||
"platform_not_supported_tip": "暂不支持该平台录制",
|
||||
"STOPPED_MONITORING": "直播间已停止监控",
|
||||
|
||||
Reference in New Issue
Block a user