From 0d2e942eae18a1914baae1442846d72626eabdd0 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Wed, 28 May 2025 17:43:25 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0=20Plex=20=E5=AA=92=E4=BD=93=E5=BA=93?= =?UTF-8?q?=E5=92=8C=20AList=20=E7=9B=AE=E5=BD=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/run.py | 58 ++++++++++++++++++++++++++++++++++++++++ app/static/Plex.svg | 9 +++++++ app/static/css/main.css | 51 +++++++++++++++++++++++++++++++++++ app/templates/index.html | 30 ++++++++++++++++++++- 4 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 app/static/Plex.svg diff --git a/app/run.py b/app/run.py index 851f311..02d2214 100644 --- a/app/run.py +++ b/app/run.py @@ -319,6 +319,64 @@ def run_script_now(): ) +# 刷新Plex媒体库 +@app.route("/refresh_plex_library", methods=["POST"]) +def refresh_plex_library(): + if not is_login(): + return jsonify({"success": False, "message": "未登录"}) + + task_index = request.json.get("task_index") + if task_index is None: + return jsonify({"success": False, "message": "缺少任务索引"}) + + # 获取任务信息 + task = config_data["tasklist"][task_index] + if not task.get("savepath"): + return jsonify({"success": False, "message": "任务没有保存路径"}) + + # 导入Plex插件 + from plugins.plex import Plex + + # 初始化Plex插件 + plex = Plex(**config_data["plugins"]["plex"]) + if not plex.is_active: + return jsonify({"success": False, "message": "Plex 插件未正确配置"}) + + # 执行刷新 + plex.run(task) + + return jsonify({"success": True, "message": "成功刷新 Plex 媒体库"}) + + +# 刷新AList目录 +@app.route("/refresh_alist_directory", methods=["POST"]) +def refresh_alist_directory(): + if not is_login(): + return jsonify({"success": False, "message": "未登录"}) + + task_index = request.json.get("task_index") + if task_index is None: + return jsonify({"success": False, "message": "缺少任务索引"}) + + # 获取任务信息 + task = config_data["tasklist"][task_index] + if not task.get("savepath"): + return jsonify({"success": False, "message": "任务没有保存路径"}) + + # 导入AList插件 + from plugins.alist import Alist + + # 初始化AList插件 + alist = Alist(**config_data["plugins"]["alist"]) + if not alist.is_active: + return jsonify({"success": False, "message": "AList 插件未正确配置"}) + + # 执行刷新 + alist.run(task) + + return jsonify({"success": True, "message": "成功刷新 AList 目录"}) + + @app.route("/task_suggestions") def get_task_suggestions(): if not is_login(): diff --git a/app/static/Plex.svg b/app/static/Plex.svg new file mode 100644 index 0000000..7bd25d1 --- /dev/null +++ b/app/static/Plex.svg @@ -0,0 +1,9 @@ + + + diff --git a/app/static/css/main.css b/app/static/css/main.css index 1c1d86c..2f582c2 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -2311,6 +2311,8 @@ main .table th { .task .btn-outline-primary, .task .btn-outline-danger, .task .btn-warning, +.task .btn-outline-plex, +.task .btn-outline-alist, .row .btn-outline-primary { width: 32px; height: 32px; @@ -2318,6 +2320,7 @@ main .table th { display: flex; align-items: center; justify-content: center; + border-radius: 6px !important; } /* 播放按钮样式 */ @@ -3921,3 +3924,51 @@ table.selectable-records .expand-button:hover { #fileSelectModal .table tr.selected-file:hover { background-color: var(--button-gray-background-color); } + +/* Plex按钮样式 */ +.btn-outline-plex { + border-color: #EBAF00; + color: #EBAF00; +} + +.btn-outline-plex:hover { + background-color: #EBAF00; + border-color: #EBAF00; + color: #fff; +} + +.btn-outline-plex:hover .plex-icon { + filter: brightness(0) invert(1); +} + +/* AList按钮样式 */ +.btn-outline-alist { + border-color: #70C6BE; + color: #70C6BE; +} + +.btn-outline-alist:hover { + background-color: #70C6BE; + border-color: #70C6BE; + color: #fff; +} + +.btn-outline-alist:hover .alist-icon { + filter: brightness(0) invert(1); +} + +/* Plex图标样式 */ +.plex-icon { + width: 11px; + height: auto; + object-fit: contain; +} + +/* AList图标样式 */ +.alist-icon { + width: 17.8px; + height: auto; + object-fit: contain; + position: relative; + top: -0.5px; +} diff --git a/app/templates/index.html b/app/templates/index.html index eb0e9bd..494aa74 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -484,8 +484,10 @@
+ + - +
@@ -3584,6 +3586,32 @@ }); } }, + refreshPlexLibrary(index) { + axios.post('/refresh_plex_library', { task_index: index }) + .then(response => { + if (response.data.success) { + this.showToast(response.data.message); + } else { + alert(response.data.message); + } + }) + .catch(error => { + alert("刷新 Plex 媒体库失败: " + (error.response?.data?.message || error.message || "未知错误")); + }); + }, + refreshAlistDirectory(index) { + axios.post('/refresh_alist_directory', { task_index: index }) + .then(response => { + if (response.data.success) { + this.showToast(response.data.message); + } else { + alert(response.data.message); + } + }) + .catch(error => { + alert("刷新 AList 目录失败: " + (error.response?.data?.message || error.message || "未知错误")); + }); + }, } }); From 3f04866c8161042bb3e27ce5f3a48ac9ad38ccf5 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Wed, 28 May 2025 23:07:02 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E6=96=B9=E5=BC=8F=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/main.css | 58 ++++++++++++++++++++++++++++ app/templates/index.html | 82 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 135 insertions(+), 5 deletions(-) diff --git a/app/static/css/main.css b/app/static/css/main.css index 2f582c2..200bf56 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -3972,3 +3972,61 @@ table.selectable-records .expand-button:hover { position: relative; top: -0.5px; } + +/* 任务按钮悬停显示样式 */ +.task-buttons .hover-only { + opacity: 0; + transition: opacity 0.2s ease-in-out; + position: absolute; + right: 0; + visibility: hidden; +} + +/* 修改悬停触发范围到整个任务单元 */ +.task:hover .task-buttons .hover-only { + opacity: 1; + visibility: visible; + position: static; +} + +/* 确保按钮容器在悬停时保持宽度 */ +.task-buttons { + position: relative; + min-width: 160px; /* 根据按钮数量和间距调整 */ + display: flex; + justify-content: flex-end; + padding-right: 0; + margin-right: 0; +} + +/* 确保按钮在悬停时可见 */ +.task:hover .task-buttons { + z-index: 1; +} + +/* 移动模式下的任务按钮容器样式 */ +@media (max-width: 767.98px) { + .task .col-auto.task-buttons { + padding-right: 15px; /* 与添加任务按钮的右边距保持一致 */ + } +} + +@media (min-width: 992px) { + .display-setting-row > .col-lg-3 { + padding-left: 4px !important; + padding-right: 4px !important; + } + .display-setting-row { + margin-left: -4px !important; + margin-right: -4px !important; + } +} + +.display-setting-row > [class*='col-'] { + padding-left: 4px !important; + padding-right: 4px !important; +} +.display-setting-row { + margin-left: -4px !important; + margin-right: -4px !important; +} diff --git a/app/templates/index.html b/app/templates/index.html index 494aa74..a1b6fa0 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -440,6 +440,63 @@ +
+
+

显示设置

+ + + +
+
+
+
+
+
+ 运行此任务 +
+ +
+
+
+
+
+ 删除此任务 +
+ +
+
+
+
+
+ 刷新 Plex 媒体库 +
+ +
+
+
+
+
+ 刷新 AList 目录 +
+ +
+
+
+
@@ -483,12 +540,12 @@ #
-
- - +
+ + - - + +
@@ -1008,6 +1065,12 @@ webui: { username: "", password: "" + }, + button_display: { + run_task: "always", + delete_task: "always", + refresh_plex: "always", + refresh_alist: "always" } }, userInfoList: [], // 用户信息列表 @@ -1526,6 +1589,15 @@ if (!config_data.episode_patterns) { config_data.episode_patterns = []; } + // 确保按钮显示配置存在 + if (!config_data.button_display) { + config_data.button_display = { + run_task: "always", + delete_task: "always", + refresh_plex: "always", + refresh_alist: "always" + }; + } this.formData = config_data; setTimeout(() => { this.configModified = false; From 608cb69debbd586ab0dd27a133fd6a8f6bad1c59 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Thu, 29 May 2025 00:26:02 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=B7=E6=96=B0=20Plex?= =?UTF-8?q?=20=E5=AA=92=E4=BD=93=E5=BA=93=E6=8C=89=E9=92=AE=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/main.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/static/css/main.css b/app/static/css/main.css index 200bf56..9842c39 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -3959,7 +3959,7 @@ table.selectable-records .expand-button:hover { /* Plex图标样式 */ .plex-icon { - width: 11px; + width: 10.4px; height: auto; object-fit: contain; } From 4aed66e59d16e6a197dcc4524f0ac2495eadf2cd Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Thu, 29 May 2025 02:29:25 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=82=AC=E5=81=9C=E6=98=BE=E7=A4=BA=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/main.css | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/app/static/css/main.css b/app/static/css/main.css index 9842c39..b41152e 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -2425,6 +2425,7 @@ body { /* 任务列表页面中的任务标题颜色 */ .task .btn.btn-block.text-left { color: var(--dark-text-color); + transition: color 0.2s ease-in-out; } /* 历史记录页面的文本和表格内容 */ @@ -4030,3 +4031,71 @@ table.selectable-records .expand-button:hover { margin-left: -4px !important; margin-right: -4px !important; } + +/* 任务单元基础样式 */ +.task { + position: relative; + cursor: pointer; +} + +/* 任务展开后的配置区域使用默认指针 */ +.task .collapse { + cursor: default; +} + +/* 任务按钮悬停显示样式 */ +.task-buttons .hover-only { + opacity: 0; + transition: opacity 0.2s ease-in-out; + position: absolute; + right: 0; + visibility: hidden; +} + +/* 修改悬停触发范围到整个任务单元 */ +.task:hover .task-buttons .hover-only { + opacity: 1; + visibility: visible; + position: static; +} + +/* 确保按钮容器在悬停时保持宽度 */ +.task-buttons { + position: relative; + min-width: 160px; /* 根据按钮数量和间距调整 */ + display: flex; + justify-content: flex-end; + padding-right: 0; + margin-right: 0; +} + +/* 确保按钮在悬停时可见 */ +.task:hover .task-buttons { + z-index: 1; +} + +/* 添加伪元素扩展整个任务单元的可点击区域 */ +.task::before, +.task::after { + content: ''; + position: absolute; + left: 0; + width: 100%; + height: 8px; + background: transparent; + z-index: 0; + pointer-events: auto; +} + +.task::before { + top: 0; +} + +.task::after { + bottom: -8px; +} + +/* 当鼠标悬停在任务单元上时,任务标题变为蓝色 */ +.task:hover .btn.btn-block.text-left { + color: var(--focus-border-color); +} From 60352fbe62f7bb1a417d1416e08c2bddfa784e86 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Fri, 30 May 2025 19:29:56 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20AList=20Strm=20Gen=20?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=97=A0=E6=B3=95=E7=94=9F=E6=88=90=20STRM?= =?UTF-8?q?=20=E6=96=87=E4=BB=B6=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/alist_strm.py | 14 ++-- plugins/alist_strm_gen.py | 155 ++++++++++++++++++++++++++------------ plugins/aria2.py | 12 +-- 3 files changed, 119 insertions(+), 62 deletions(-) diff --git a/plugins/alist_strm.py b/plugins/alist_strm.py index 0d7c3f3..a9ec54d 100644 --- a/plugins/alist_strm.py +++ b/plugins/alist_strm.py @@ -2,7 +2,7 @@ import re import requests """ - 配合 Alist-Strm 项目,触发特定配置运行 + 配合 AList-Strm 项目,触发特定配置运行 https://github.com/tefuirZ/alist-strm """ @@ -47,12 +47,12 @@ class Alist_strm: for item in matchs if item[0] in config_id_str.split(",") ] - print(f"Alist-Strm 配置运行: {config_name}") + print(f"AList-Strm 配置运行: {config_name}") return True else: - print(f"Alist-Strm 配置运行: 匹配失败 ❌ 请检查网络连通和cookie有效性") + print(f"AList-Strm 配置运行: 匹配失败 ❌ 请检查网络连通和 Cookie 有效性") except Exception as e: - print(f"获取 Alist-Strm 配置信息出错: {e}") + print(f"获取 AList-Strm 配置信息出错 ❌ {e}") return False def run_selected_configs(self, selected_configs_str): @@ -61,7 +61,7 @@ class Alist_strm: try: selected_configs = [int(x.strip()) for x in selected_configs_str.split(",")] except ValueError: - print("🔗 Alist-Strm 配置运行: 出错 ❌ ID 应以 , 分割") + print("🔗 AList-Strm 配置运行: 出错 ❌ ID 应以 , 分割") return False data = [("selected_configs", config_id) for config_id in selected_configs] data.append(("action", "run_selected")) @@ -73,10 +73,10 @@ class Alist_strm: match = re.search(r'role="alert">\s*([^<]+)\s*= 0 and idx < len(file_info): downloaded_files.append(file_info[idx]) except Exception as e: - print(f"📥 Aria2 添加下载任务失败: {e}") + print(f"📥 添加 Aria2 下载任务失败 ❌ {e}") # 如果配置了自动删除且有成功添加下载任务的文件,则删除夸克网盘中的文件 if task_config.get("auto_delete_quark_files") and downloaded_files: @@ -225,7 +225,7 @@ class Aria2: if files_to_delete: account.delete(files_to_delete) except Exception as e: - print(f"📝 Aria2: 删除夸克网盘文件失败: {e}") + print(f"📝 Aria2: 删除夸克网盘文件失败 ❌ {e}") else: if not task_config.get("auto_delete_quark_files"): # 未启用自动删除,不需要输出信息 @@ -249,7 +249,7 @@ class Aria2: response.raise_for_status() return response.json() except Exception as e: - print(f"Aria2 下载: 错误{e}") + print(f"Aria2 下载: 错误 ❌ {e}") return {} def get_version(self): @@ -259,7 +259,7 @@ class Aria2: print(f"Aria2 下载: v{response['result']['version']}") return True else: - print(f"Aria2 下载: 连接失败{response.get('error')}") + print(f"Aria2 下载: 连接失败 ❌ {response.get('error')}") return False def add_uri(self, params=None):