feat: add tips for opening folder on the web page

This commit is contained in:
ihmily
2025-04-10 21:14:47 +08:00
parent 0014753285
commit 74c4e8a456
5 changed files with 11 additions and 7 deletions

View File

@@ -158,7 +158,6 @@ class LiveStreamRecorder:
headers=self.get_headers_params(record_url, self.platform_key)
)
ffmpeg_command = ffmpeg_builder.build_command()
logger.info(f"FFmpeg Command: {ffmpeg_command}")
self.app.page.run_task(
self.start_ffmpeg,
stream_info.anchor_name,

View File

@@ -294,7 +294,8 @@ class RecordingCardManager:
async def recording_dir_on_click(self, recording: Recording):
if recording.recording_dir:
if os.path.exists(recording.recording_dir):
utils.open_folder(recording.recording_dir)
if not utils.open_folder(recording.recording_dir):
await self.app.snack_bar.show_snack_bar(self._['no_support_open_dir'])
else:
await self.app.snack_bar.show_snack_bar(self._["no_folder_tip"])

View File

@@ -134,7 +134,7 @@ def jsonp_to_json(jsonp_str: str) -> OptionalDict:
raise Exception("No JSON data found in JSONP response.")
def open_folder(directory_path: str):
def open_folder(directory_path: str) -> bool:
try:
if sys.platform == "win32":
os.startfile(directory_path)
@@ -142,12 +142,14 @@ def open_folder(directory_path: str):
subprocess.run(["open", directory_path], check=True)
else:
subprocess.run(["xdg-open", directory_path], check=True)
return True
except FileNotFoundError:
logger.error("Unable to open folder. The command may not be available on this system.")
except subprocess.CalledProcessError:
logger.error(f"Failed to open folder '{directory_path}'. Please ensure the path is valid and accessible.")
except Exception as e:
logger.error(f"An unexpected error occurred: {e}")
return False
def add_hours_to_time(time_str: str, hours_to_add: float) -> str:

View File

@@ -45,7 +45,7 @@
"single_input": "Single Input",
"batch_input": "Batch Input",
"live_room": "Live Room",
"platform_not_supported_tip": "⚠\uFE0F This platform does not support recording",
"platform_not_supported_tip": "⚠ This platform does not support recording",
"pick_time": "Pick time",
"pick_time_tip": "Configure scheduled time",
"time_out_of_range": "Time out of range",
@@ -112,7 +112,8 @@
"no_recording_dir_tip": "No saved recording files",
"none": "None",
"recording_card_tip": "Click to select",
"use_proxy": "Use Proxy"
"use_proxy": "Use Proxy",
"no_support_open_dir": "⚠️ Web version does not support opening folder"
},
"settings_page": {
"recording_settings": "Recording Settings",

View File

@@ -46,7 +46,7 @@
"single_input": "单个录入",
"batch_input": "批量录入",
"live_room": "直播间",
"platform_not_supported_tip": "⚠\uFE0F 暂不支持该平台录制",
"platform_not_supported_tip": "⚠ 暂不支持该平台录制",
"pick_time": "选择时间",
"pick_time_tip": "配置定时时间",
"time_out_of_range": "选择时间超出范围",
@@ -114,7 +114,8 @@
"no_recording_dir_tip": "该直播间暂无保存的录制文件",
"none": "无",
"recording_card_tip": "点击选中",
"use_proxy": "使用代理"
"use_proxy": "使用代理",
"no_support_open_dir": "⚠️ Web端不支持打开文件夹"
},
"settings_page": {
"recording_settings": "录制设置",