feat(subtitle): 文本字幕外置化仅限 TRANSCODE 源;右键菜单合并为级联子菜单
- 内嵌 ASS 抽取与字体抽取挂到 verdict == TRANSCODE(extract-subs / --extract-internal 仍可强制),直传片源不再生成外挂副本 - 外挂 SRT 兜底仅在 [Subtitles] export 不含 ass 时启用,避免同语言双份 - 新增同语言判重(含旧命名 <stem>.<lang>.srt),重复抽取不再产生重复字幕 - 识别中英双语轨为 zh-en,语言白名单加入 zh-en - 外挂字幕统一 <stem>.internal.<lang>.srt 命名 - 右键菜单合并为 SceneMarshal 级联子菜单(ExtendedSubCommandsKey), 四项:媒体整理 / 媒体归档 / 补外挂字幕 / 入库校验,图标 assets/menu 自绘 - HANDOFF 补右键菜单说明;新增 docs/movie-duplicates.md 记录电影库清理
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 10 KiB |
@@ -44,6 +44,24 @@ media-archive # 归档进媒体库(TMDB 建议分类
|
||||
|
||||
依赖:`scripts/remote-common.ps1`(SSH/路径翻译公共函数)、`scripts/deploy.ps1`、`scripts/media-rename.ps1`、`scripts/media-archive.ps1`、`scripts/install-explorer-menu.ps1`(右键菜单)。
|
||||
|
||||
### 3.1 资源管理器右键菜单
|
||||
|
||||
一个级联子菜单 `SceneMarshal ▸`,作用于文件夹 / 空白处 / `.mkv` / `.mp4` / `.avi`:
|
||||
|
||||
| 菜单项 | 等价命令 |
|
||||
|---|---|
|
||||
| 重命名 | `media-rename -p <目录> auto` |
|
||||
| 媒体归档 | `media-archive -p <目录>` |
|
||||
| 补外挂字幕 | `media-rename -p <目录> extract-subs` |
|
||||
| 入库校验 | `media-rename -p <目录> check` |
|
||||
|
||||
- 级联写法:父键 `MUIVerb` + `ExtendedSubCommandsKey`(自引用 HKCR 相对路径)+ `Shell\<子项>`,
|
||||
与 Windows 自带 `UpdateEncryptionSettingsWork` 一致。早期用 `SubCommands=""` 会展开为空,已弃用。
|
||||
- 子项图标在 `assets/menu/{rename,archive,subtitle,check}.ico`(脚本生成,品牌渐变 + 白色字形)。
|
||||
- 安装/卸载:`scripts\install-explorer-menu.ps1` / `uninstall-explorer-menu.ps1`;
|
||||
若某些系统不认级联,用 `install-explorer-menu.ps1 -Flat` 退回平级 4 项。
|
||||
- 改注册表后需重启 `explorer.exe` 才生效。
|
||||
|
||||
**SSH 依赖 Bitwarden SSH agent**:
|
||||
|
||||
```powershell
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
# 电影库多版本清单
|
||||
|
||||
> 扫描时间:2026-11-19 · 范围 `/hdd/sda1/media/电影`(MOVIE-华语 / 日韩 / 欧美 / 港台)
|
||||
> 方法:全库 300 个视频全部登记,按「同文件夹多文件 + 跨文件夹同名同 tmdb」两路归并,
|
||||
> 再用 ffprobe 实测每个候选的真实分辨率、编码、码率、片长、HDR 类型(文件名标签不可信,见文末)。
|
||||
|
||||
## 结论
|
||||
|
||||
- 全库 **300 个视频 / 3,377.6 GiB / 276 个影片文件夹**
|
||||
- **21 个文件夹含多版本**,涉及 45 个文件;**没有跨文件夹的重复片**(一部电影只在一个文件夹里)
|
||||
- 建议删除 **24 个文件**,可回收 **185.9 GiB**
|
||||
- 其中 18 部同片同剪、画质明显更低:**170.0 GiB**(可直接删)
|
||||
- 其中 3 部是两个不同剪辑:**15.9 GiB**(删前请确认是否需要在意的剪辑)
|
||||
|
||||
## 执行记录(2026-11-19)
|
||||
|
||||
A、B 两段已全部按本清单执行完毕(每段都是 dry-run 逐字节校验后才删除):
|
||||
|
||||
- **A 段**:删除 21 个片源 + 81 个同版本附属文件(jpg/png/nfo),**0 失败、0 残留**
|
||||
- **B 段**:删除 3 个片源 + 7 个附属文件,**0 失败、0 残留**(用户确认:片长不同的旧版本先删,之后自行找 4K 版)
|
||||
- 24 个保留片源全部核验在位并 ffprobe 可读;5 处字幕已迁移到保留版本名下
|
||||
- 合计释放 **186.0 GiB**(170.1 + 15.9),磁盘 87% → 86%(剩 2.0T → 2.2T)
|
||||
- Jellyfin 库刷新已触发(HTTP 204)
|
||||
- 3 个无视频空壳文件夹已清除(`蚁人与黄蜂女:量子狂潮`、`银河护卫队3` 全空;
|
||||
`欢迎来到龙餐馆` 是 TMDB 匹配失败的错名残留,只剩一个无 tmdbid 的 nfo,正确文件夹是 `欢迎来龙餐馆`)
|
||||
- 清理后:**273 个影片文件夹 / 273 个视频 / 0 个多版本文件夹 / 无空文件夹**,磁盘 86%(剩 2.2T)
|
||||
|
||||
## A. 已删除(同片同剪,画质明显更低)
|
||||
|
||||
| 电影 | 保留 | 删除 | 回收 | 理由 |
|
||||
|---|---|---|---|---|
|
||||
| **不能说的秘密 (2007)** | 1920×1080 H264 8bit 28.2 Mbps / DTS 8ch<br>20.0 GiB | 1920×808 H264 8bit 6.0 Mbps / AAC 2ch · 4.3 GiB | 4.3 GiB | WEB-DL 码率只有 6 Mbps,REMUX 是 28 Mbps 蓝光直灌 |
|
||||
| **花木兰 (2020)** | 3840×1608 HEVC 10bit 21.2 Mbps / TrueHD 8ch<br>17.1 GiB | 3840×1608 HEVC 10bit 13.9 Mbps / EAC3 6ch · 11.1 GiB<br>1280×720 HEVC 8bit 2.8 Mbps / AAC 2ch · 2.3 GiB<br>1920×1080 H264 8bit 2.0 Mbps / AAC 6ch · 1.6 GiB | 15.0 GiB | 文件夹里 4 个文件,实际是 1 个 4K DV 加 3 个降级重编码 |
|
||||
| **误杀3 (2024)** | 3840×1616 HEVC 8bit 4.2 Mbps / EAC3 6ch<br>3.2 GiB | 1920×808 HEVC 8bit 0.9 Mbps / AAC 2ch · 0.7 GiB | 0.7 GiB | 保留的实为 4K 3840×1616,要删的那版仅 0.9 Mbps |
|
||||
| **AI创世者 (2023)** | 3840×2160 HEVC 8bit 15.1 Mbps / EAC3 6ch<br>14.4 GiB | 1920×1080 H264 8bit 5.1 Mbps / AAC 2ch · 4.8 GiB | 4.8 GiB | 4K 与 1080p 之别 |
|
||||
| **变形金刚:超能勇士崛起 (2023)** | 3840×1608 HEVC 10bit 36.0 Mbps / TrueHD 8ch<br>32.0 GiB | 1920×1080 HEVC 8bit 5.5 Mbps / AAC 6ch · 4.9 GiB | 4.9 GiB | 文件名写 1080p,实为 4K 3840×1608 杜比视界 |
|
||||
| **碟中谍8:最终清算 (2025)** | 3840×2024 HEVC 10bit 24.9 Mbps / EAC3 6ch<br>29.6 GiB | 1916×1008 HEVC 8bit 3.8 Mbps / EAC3 6ch · 4.5 GiB | 4.5 GiB | 4K 杜比视界与 1916×1008 之分 |
|
||||
| **神秘代码 (2009)** | 3840×2160 HEVC 10bit 57.4 Mbps / TrueHD 8ch<br>48.7 GiB | 3840×1634 HEVC 10bit 16.6 Mbps / TrueHD 8ch · 14.1 GiB | 14.1 GiB | 要删的那版标 1080p 实为 4K,但码率只有 16.6 Mbps(保留版 57.4) |
|
||||
| **蜘蛛侠 (2002)** | 3840×2160 HEVC 10bit 34.0 Mbps / TrueHD 8ch<br>28.8 GiB | 1280×688 H264 8bit 2.6 Mbps / AC3 6ch · 2.2 GiB | 2.2 GiB | 4K 与 720p 之别 |
|
||||
| **蜘蛛侠:英雄归来 (2017)** | 3840×2160 HEVC 10bit 40.5 Mbps / TrueHD 8ch<br>37.8 GiB | 1280×720 H264 8bit 2.0 Mbps / AAC 2ch · 1.9 GiB | 1.9 GiB | 要删的那版标 1080p,实为 1280×720 |
|
||||
| **蜘蛛侠:英雄无归 (2021)** | 3840×2160 HEVC 10bit 35.6 Mbps / TrueHD 8ch<br>36.8 GiB | 1920×800 H264 8bit 3.4 Mbps / AAC 2ch · 3.5 GiB | 3.5 GiB | 4K REMUX 与 1080p WEB 之别 |
|
||||
| **蜘蛛侠:英雄远征 (2019)** | 3840×2160 HEVC 10bit 34.5 Mbps / TrueHD 8ch<br>31.2 GiB | 1280×720 H264 8bit 1.9 Mbps / AAC 2ch · 1.7 GiB | 1.7 GiB | 要删的那版标 1080p,实为 1280×720 |
|
||||
| **金刚狼 (2009)** | 1920×1080 H264 8bit 5.2 Mbps / AAC 2ch<br>3.9 GiB | 1024×576 H264 8bit 2.0 Mbps / AC3 6ch · 1.5 GiB | 1.5 GiB | 要删的那版标 720p,实为 1024×576 |
|
||||
| **阿凡达:水之道 (2022)** | 3840×2076 HEVC 10bit 22.5 Mbps / EAC3 6ch<br>30.3 GiB | 3840×2160 HEVC 8bit 12.4 Mbps / AAC 6ch · 16.6 GiB | 16.6 GiB | 同为 4K;保留版 10bit 且带杜比视界与中字 |
|
||||
| **玻璃樽 (1999)** | 1920×1080 H264 8bit 24.6 Mbps / AC3 6ch<br>20.6 GiB | 1920×812 HEVC 10bit 7.0 Mbps / AC3 6ch · 5.8 GiB | 5.8 GiB | 同为 1080p;REMUX 24.6 Mbps 对 WEB 7.0 Mbps |
|
||||
| **超凡蜘蛛侠2 (2014)** | 3840×1608 HEVC 10bit 46.2 Mbps / TrueHD 8ch<br>45.7 GiB | 1024×576 H264 8bit 1.2 Mbps / AAC 2ch · 1.2 GiB<br>3840×2160 HEVC 10bit 40.7 Mbps / TrueHD 8ch · 40.3 GiB | 41.5 GiB | 三个文件其实都是 4K 或更低:保留 3840×1608 无黑边版(46.2 Mbps) |
|
||||
| **超凡蜘蛛侠 (2012)** | 3840×2160 HEVC 10bit 40.0 Mbps / TrueHD 8ch<br>38.0 GiB | 3840×1608 HEVC 10bit 23.9 Mbps / TrueHD 8ch · 22.7 GiB | 22.7 GiB | 两版都是真 4K;保留 40 Mbps 的 WEB,删 23.9 Mbps 的「REMUX」(码率偏低,疑似重编码冒充) |
|
||||
| **闪灵 (1980)** | 3840×2160 HEVC 10bit 14.3 Mbps / FLAC 6ch<br>14.4 GiB | 1920×1080 H264 8bit 21.4 Mbps / EAC3 6ch · 21.5 GiB | 21.5 GiB | 保留真 4K 10bit(还带中文字幕),删 1080p 旧蓝光直灌 |
|
||||
| **梅根 (2022)** | 1920×804 HEVC 10bit 2.5 Mbps / MP3 2ch<br>1.8 GiB | 1920×1080 H264 8bit 4.0 Mbps / AAC 2ch · 2.8 GiB | 2.8 GiB | 同为 1080p,HEVC 10bit 效率更高;两版差距不大 |
|
||||
|
||||
**小计:18 部 / 21 个文件 / 170.0 GiB**
|
||||
|
||||
## B. 已删除(片长不同的旧版本,2026-11-19)
|
||||
|
||||
> 这 3 部原片长不同,删除已确认(用户:先删,之后自行找 4K 版)。
|
||||
> **具体删掉的是哪个剪辑,逐部核对如下:**
|
||||
> - **蜘蛛侠2**:删掉的是 **135.8 分钟加长版(Spider-Man 2.1)**,保留的是 127.5 分钟剧场版 4K
|
||||
> → 想补加长版需另找 4K 源,关键词 `Spider-Man 2.1`
|
||||
> - **蜘蛛侠3**:删掉的是 139.2 分钟 rmvb,保留的是 134.0 分钟 4K → 若要 139 分钟版需另找
|
||||
> - **太空救援**:删掉的是 **110.7 分钟短版**,保留的 4K 才是 118.9 分钟长版 → **无需补**
|
||||
|
||||
| 电影 | 保留 | 删除 | 回收 | 理由 |
|
||||
|---|---|---|---|---|
|
||||
| **蜘蛛侠3 (2007)** | 3840×2160 HEVC 10bit 39.9 Mbps / TrueHD 8ch<br>37.3 GiB | 1280×680 RealVideo 8bit 1.8 Mbps / RealAudio 2ch · 1.8 GiB | 1.8 GiB | rmvb 只有 1.8 Mbps、1280×680,画质严重劣化;但片长差 5 分钟 |
|
||||
| **太空救援 (2017)** | 3840×2160 HEVC 10bit 70.1 Mbps / DTS 8ch<br>58.2 GiB | 1920×858 H264 8bit 15.1 Mbps / DTS 6ch · 11.7 GiB | 11.7 GiB | 片长 118.9 分钟对 110.7 分钟,是两个剪辑版本 |
|
||||
| **蜘蛛侠2 (2004)** | 3840×2160 HEVC 10bit 40.1 Mbps / TrueHD 8ch<br>35.7 GiB | 1280×720 H264 8bit 2.6 Mbps / AC3 6ch · 2.4 GiB | 2.4 GiB | 127.5 分钟剧场版对 135.8 分钟加长版(2.1) |
|
||||
|
||||
**小计:3 部 / 3 个文件 / 15.9 GiB**
|
||||
|
||||
- **太空救援**:保留 118.9 分钟(俄版原长),删掉 110.7 分钟(发行短版)。
|
||||
- **蜘蛛侠2**:保留 127.5 分钟剧场版 4K,删掉 135.8 分钟加长版(Spider-Man 2.1)720p
|
||||
—— 加长版目前库里已无,需要再找 4K 源补回。
|
||||
- **蜘蛛侠3**:保留 134.0 分钟 4K,删掉 139.2 分钟 rmvb(片长差可能来自不同剪辑或片头 logo)。
|
||||
|
||||
## C. 文件名陷阱(本次实测发现)
|
||||
|
||||
这批文件的命名和实际内容有系统性偏差,**只看文件名会删错**:
|
||||
|
||||
| 文件夹 | 文件名写的 | ffprobe 实测 |
|
||||
|---|---|---|
|
||||
| 花木兰 (2020) | `1080p.BluRay.REMUX` | **3840×1608** 4K HEVC 10bit + 杜比视界 |
|
||||
| 花木兰 (2020) | `1080p.WEB-DL.HEVC.8bit` | **1280×720** |
|
||||
| 变形金刚:超能勇士崛起 | `1080p.BluRay.REMUX` | **3840×1608** 4K + 杜比视界 |
|
||||
| 误杀3 (2024) | `1080p...AC3.5.1` | **3840×1616** 4K |
|
||||
| 神秘代码 (2009) | `1080p.WEB-DL` | **3840×1634** 4K(码率仅 16.6 Mbps) |
|
||||
| 蜘蛛侠:英雄归来 / 英雄远征 | `1080p.WEB-DL` | **1280×720** |
|
||||
| 蜘蛛侠2 (2004) | `1080p.WEB-DL` | **1280×720** |
|
||||
| 金刚狼 (2009) / 超凡蜘蛛侠2 | `720p` | **1024×576** |
|
||||
| 超凡蜘蛛侠2 (2014) | `1080p.BluRay.REMUX` | **3840×1608** 4K(46.2 Mbps) |
|
||||
|
||||
## D. 手动删除的「新精武门」系列(已确认)
|
||||
|
||||
你手动清掉了 **3 个**「新精武门」文件夹(2026-11-19,已确认均为有意删除):
|
||||
|
||||
| 文件夹 | 片长 | 大小 | 性质 |
|
||||
|---|---|---|---|
|
||||
| `新精武门1 (1976)` | 120.1 分钟 | 7.6 GiB | 成龙的《新精武门》,nfo 误配成 `Animated Motion: Part 1`(tmdbid 257555) |
|
||||
| `新精武门 (1976) [tmdbid-18666]` | 82.9 分钟 | 4.8 GiB | 片长对不上,疑似残缺或错片 |
|
||||
| `新精武门2:漫画威龙 (1992) [tmdbid-73417]` | — | 3.9 GiB | 720×480 MPEG-2,独立的另一部电影(1992 漫畫威龍),顺带清掉 |
|
||||
|
||||
合计 16.4 GiB。加上 A 段的 170.1 GiB,本次共释放 **186.5 GiB**。
|
||||
|
||||
全库消失条目对账:preflight 缓存(12:04,298 条)+ 2 条缓存未收录 = 300 条,
|
||||
减去 21(A 段)+ 3(本段)= **276 条,与磁盘实际完全吻合**。
|
||||
|
||||
## E. 删除时的附属文件
|
||||
|
||||
这些文件夹里每个版本都带一整套按版本名生成的海报/信息文件,删片源时要一起删,否则 Jellyfin 里会留孤儿图片:
|
||||
|
||||
```
|
||||
<影片名> - <版本标签>-backdrop.jpg / -landscape.jpg / -logo.png / -poster.jpg / -fanartN.jpg
|
||||
<影片名> - <版本标签>.nfo
|
||||
<影片名> - <版本标签>.<语言>.srt|ass ← 字幕,注意区分
|
||||
```
|
||||
|
||||
**字幕要留意的两处**(删的版本才有):
|
||||
|
||||
1. `花木兰 (2020)`:要删的 `1080p.WEB-DL.HEVC.10bit.AC3.5.1` 带 `en.srt` + `zh-CN.srt`,保留的 REMUX 没有外挂字幕。
|
||||
2. `神秘代码 (2009)`:要删的 4K WEB 版带 `internal.en.ass` / `internal.en.2.ass` / `zh-CN.srt`;
|
||||
保留的 REMUX 只有 `internal.zh-CN.ass`。想留英文字幕就先把 srt/ass 改到保留版同名下。
|
||||
|
||||
其余片源删掉不影响字幕(保留版自带或另有外挂)。
|
||||
@@ -44,7 +44,8 @@ keywords = TG频道,@yunpantv
|
||||
# 导出格式:ass(原始保真,默认)/ srt(清洗后);可写 ass,srt 同时导出
|
||||
export = ass
|
||||
# 只导出这些语言的轨;all 表示全部
|
||||
languages = zh-CN,zh-TW,en,und
|
||||
# zh-en = 中英双语轨(标题含"双语/中英/CHS&ENG"等)
|
||||
languages = zh-CN,zh-TW,zh-en,en,und
|
||||
# 允许处理的字幕轨编码;ass 轨用 -c:s copy 原样抽出,其余转成 ass
|
||||
codecs = ass,ssa,webvtt,subrip,mov_text
|
||||
# 内嵌优先:有内嵌字幕时不再处理外挂字幕
|
||||
@@ -80,7 +81,7 @@ max_direct_mbps = 70
|
||||
pre_extract_ass_gb = 15
|
||||
# 大文件自动抽 ASS(当前 export=ass 时已天然满足)
|
||||
auto_extract_ass = true
|
||||
# 必须转码的片源(DV5/老编码等)若无外挂字幕,自动导出文本字幕为外挂 SRT
|
||||
# 必须转码的片源(DV5/老编码等)的外挂字幕兜底;仅当 [Subtitles] export 不含 ass 时启用
|
||||
export_text_subs = true
|
||||
# 每次扫描是否输出体检报告
|
||||
write_report = true
|
||||
|
||||
@@ -141,8 +141,16 @@ class MediaPipeline:
|
||||
log.debug(f"✨ [完美豁免] {f.name} 已达最高工业标准,直接放行~")
|
||||
|
||||
if self.args.mode != "clean-ads":
|
||||
# 必须转码的片源:补外挂文本字幕,避免客户端选内嵌字幕时投递失败
|
||||
if config.EXPORT_TEXT_SUBS and pf.verdict == TRANSCODE:
|
||||
# 文本字幕(ASS / SRT)外置化只对必须转码的片源做:
|
||||
# 直传片源的内嵌字幕客户端能直接渲染,不需要外挂副本。
|
||||
# 显式 extract-subs 或 --extract-internal 视为强制,不受此限制。
|
||||
forced_subs = bool(self.args.extract_internal) or self.args.mode == "extract-subs"
|
||||
want_text_subs = forced_subs or pf.verdict == TRANSCODE
|
||||
|
||||
# 外挂 SRT 兜底:只在没配置 ASS 导出时启用,
|
||||
# 否则同一语言会同时出现 .internal.<lang>.ass 和 .srt 两份。
|
||||
if (want_text_subs and config.EXPORT_TEXT_SUBS and pf.verdict == TRANSCODE
|
||||
and 'ass' not in config.SUBTITLE_EXPORT):
|
||||
text_subs = [s for s in pf.info.get("subs", [])
|
||||
if (s.get("codec") or "").lower() in SubtitleService.TEXT_SUB_CODECS]
|
||||
if text_subs:
|
||||
@@ -151,10 +159,12 @@ class MediaPipeline:
|
||||
SubtitleService.export_text_sidecars,
|
||||
(f, dest_dir, target_stem),
|
||||
)
|
||||
|
||||
if config.PREFER_INTERNAL:
|
||||
# 🎯 内嵌字幕优先:先看内嵌,有就不再处理外挂
|
||||
internal_subs = 0
|
||||
if not skip_heavy or self.args.extract_internal or self.args.mode == "extract-subs":
|
||||
if want_text_subs:
|
||||
if not skip_heavy or forced_subs:
|
||||
internal_subs = SubtitleService.scan_subtitles(f, self.task_mgr, target_stem, dest_dir)
|
||||
elif SubtitleService.has_internal_sub(dest_dir, target_stem):
|
||||
# 完美文件名豁免时不做 ffprobe,但仍需识别"已有内嵌字幕"
|
||||
@@ -165,12 +175,11 @@ class MediaPipeline:
|
||||
else:
|
||||
# 旧行为:外挂优先,没有外挂(或强制)时才提取内嵌
|
||||
has_ext_sub = RenamerService.scan_existing_subtitles(f, target_stem, m_type, dest_dir, self.task_mgr)
|
||||
if (not has_ext_sub or self.args.extract_internal or self.args.mode == "extract-subs") and (
|
||||
not skip_heavy or self.args.extract_internal or self.args.mode == "extract-subs"):
|
||||
if want_text_subs and (not has_ext_sub or forced_subs) and (not skip_heavy or forced_subs):
|
||||
SubtitleService.scan_subtitles(f, self.task_mgr, target_stem, dest_dir)
|
||||
|
||||
# 内嵌字体附件(ASS 特效字体还原)
|
||||
if config.EXTRACT_FONTS:
|
||||
# 内嵌字体附件(ASS 特效字体还原):只有抽了 ASS 才有意义
|
||||
if config.EXTRACT_FONTS and want_text_subs:
|
||||
SubtitleService.scan_fonts(f, self.task_mgr, dest_dir)
|
||||
|
||||
if self.args.mode != "extract-subs" and not skip_heavy:
|
||||
|
||||
@@ -92,6 +92,15 @@ class SubtitleService:
|
||||
lang = stream.get('tags', {}).get('language', 'und').lower()
|
||||
title = stream.get('tags', {}).get('title', '').lower()
|
||||
|
||||
# 中英双语轨:标题里同时出现中文与英文标识(或直接写"双语")时优先判定,
|
||||
# 否则会被下面的"简/繁"规则吞成单语。输出 zh-en,与 zh-CN / zh-TW 区分。
|
||||
has_cn = any(k in title for k in ('中', '简', '繁', 'chs', 'chi', 'zho'))
|
||||
has_en = any(k in title for k in ('英', 'eng', 'english'))
|
||||
if '双语' in title or 'bilingual' in title or (has_cn and has_en):
|
||||
return 'zh-en'
|
||||
if has_en and not has_cn:
|
||||
return 'en'
|
||||
|
||||
lang_code = "und"
|
||||
if lang in ['chi', 'zho', 'zh', 'chi-cn', 'zh-cn']: lang_code = 'zh-CN'
|
||||
elif lang in ['tw', 'hk', 'zh-tw']: lang_code = 'zh-TW'
|
||||
@@ -99,8 +108,12 @@ class SubtitleService:
|
||||
elif lang in ['jpn', 'ja']: lang_code = 'ja'
|
||||
elif lang in ['kor', 'ko']: lang_code = 'ko'
|
||||
|
||||
if '繁' in title or 'tw' in title or 'hk' in title or 'cht' in title: lang_code = 'zh-TW'
|
||||
elif '简' in title or 'cn' in title or '双语' in title or '中' in title or 'chs' in title: lang_code = 'zh-CN'
|
||||
if ('繁' in title or 'traditional' in title or '传统' in title or '正体' in title
|
||||
or 'tw' in title or 'hk' in title or 'cht' in title):
|
||||
lang_code = 'zh-TW'
|
||||
elif ('简' in title or 'simplified' in title or 'cn' in title
|
||||
or '中' in title or 'chs' in title):
|
||||
lang_code = 'zh-CN'
|
||||
elif '英' in title and lang_code == 'und': lang_code = 'en'
|
||||
elif '中' in title and lang_code == 'und': lang_code = 'zh-CN'
|
||||
|
||||
@@ -149,12 +162,34 @@ class SubtitleService:
|
||||
log.warning(f"⚠️ 内置字幕扫描失败: {file_path.name} -> {e}")
|
||||
return queued
|
||||
|
||||
@staticmethod
|
||||
def _existing_sidecar(dest_dir: Path, target_stem: str, lang: str, suffix: str) -> Path | None:
|
||||
"""同语言外挂字幕是否已存在(含早期不带 .internal 的命名与其它封装格式)。
|
||||
|
||||
老库里的字幕多为 <stem>.<lang>.srt(旧命名),若不认这些,重复抽取会在
|
||||
同一语言下再生成 .internal.<lang>.ass,Jellyfin 里就会出现两条同语言字幕。
|
||||
"""
|
||||
for name in (
|
||||
f"{target_stem}.internal.{lang}{suffix}.ass",
|
||||
f"{target_stem}.internal.{lang}{suffix}.srt",
|
||||
f"{target_stem}.{lang}{suffix}.srt",
|
||||
f"{target_stem}.{lang}{suffix}.ass",
|
||||
):
|
||||
p = dest_dir / name
|
||||
if p.exists() and p.stat().st_size > 0:
|
||||
return p
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _queue_ass(file_path, task_mgr, target_stem, dest_dir, stream_idx, codec, lang_code, suffix) -> int:
|
||||
out_ass = dest_dir / f"{target_stem}.internal.{lang_code}{suffix}.ass"
|
||||
if out_ass.exists() and out_ass.stat().st_size > 0:
|
||||
log.debug(f"✨ [跳过导出] 目标内置 ASS 已存在: {out_ass.name}")
|
||||
return 1
|
||||
existing = SubtitleService._existing_sidecar(dest_dir, target_stem, lang_code, suffix)
|
||||
if existing is not None:
|
||||
log.debug(f"✨ [跳过导出] 同语言外挂字幕已存在: {existing.name}")
|
||||
return 1
|
||||
|
||||
temp_ass = dest_dir / f".scenemarshal-{uuid4().hex[:12]}.ass"
|
||||
task_mgr.add_extract(
|
||||
@@ -171,6 +206,9 @@ class SubtitleService:
|
||||
log.debug(f"✨ [跳过提取] 目标内置字幕已存在: {out_srt.name}")
|
||||
SubtitleService._drop_external_copies(out_srt)
|
||||
return 1
|
||||
if SubtitleService._existing_sidecar(dest_dir, target_stem, lang_code, suffix) is not None:
|
||||
log.debug(f"✨ [跳过提取] 同语言外挂字幕已存在: {target_stem}.{lang_code}{suffix}")
|
||||
return 1
|
||||
|
||||
temp_ass = dest_dir / f".scenemarshal-{uuid4().hex[:12]}.ass"
|
||||
task_mgr.add_extract(
|
||||
@@ -297,20 +335,12 @@ class SubtitleService:
|
||||
def export_text_sidecars(file_path: Path, dest_dir: Path, out_stem: str) -> int:
|
||||
"""给必须转码的片源补外挂 SRT(客户端本地渲染,避开内嵌字幕投递)。
|
||||
|
||||
- 已有同名外挂字幕(srt/ass/ssa)时整体跳过,避免覆盖用户的字幕;
|
||||
- 按轨逐条补:只导出目录里还缺的语言,已有的不动(便于老库补齐,
|
||||
例如后来才发现的中英双语轨);
|
||||
- 只处理文本字幕轨,图形字幕(PGS/DVD/DVB)跳过;
|
||||
- 命名 <out_stem>.<lang>.srt,已存在则跳过。
|
||||
- 命名 <out_stem>.internal.<lang>.srt,与内嵌抽取共用 .internal 标记;
|
||||
中英双语轨出 <out_stem>.internal.zh-en.srt。
|
||||
"""
|
||||
prefix = f"{out_stem}."
|
||||
try:
|
||||
for existing in dest_dir.iterdir():
|
||||
if (existing.is_file() and existing.name.startswith(prefix)
|
||||
and existing.suffix.lower() in {'.srt', '.ass', '.ssa'}):
|
||||
log.debug(f"✨ [跳过外挂字幕] 已存在: {existing.name}")
|
||||
return 0
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
data = FFprobeUtil.get_json(file_path, "-show_streams", "-select_streams", "s")
|
||||
if not data:
|
||||
return 0
|
||||
@@ -323,11 +353,17 @@ class SubtitleService:
|
||||
continue
|
||||
|
||||
lang = SubtitleService._lang_code(s)
|
||||
# 与内嵌抽取共用一份语言白名单,避免把马来语/泰米尔语这类杂轨也导出来
|
||||
if config.SUBTITLE_LANGUAGES and lang not in config.SUBTITLE_LANGUAGES:
|
||||
continue
|
||||
lang_counts[lang] = lang_counts.get(lang, 0) + 1
|
||||
suffix = "" if lang_counts[lang] == 1 else f".{lang_counts[lang]}"
|
||||
out_srt = dest_dir / f"{out_stem}.{lang}{suffix}.srt"
|
||||
out_srt = dest_dir / f"{out_stem}.internal.{lang}{suffix}.srt"
|
||||
# 早期版本不带 .internal 标记,同语言外挂已存在时同样视为已补齐,避免重复
|
||||
legacy_srt = dest_dir / f"{out_stem}.{lang}{suffix}.srt"
|
||||
|
||||
if out_srt.exists() and out_srt.stat().st_size > 0:
|
||||
if (out_srt.exists() and out_srt.stat().st_size > 0) or (
|
||||
legacy_srt.exists() and legacy_srt.stat().st_size > 0):
|
||||
continue
|
||||
|
||||
temp = dest_dir / f".scenemarshal-{uuid4().hex[:12]}.srt"
|
||||
|
||||
@@ -1,37 +1,45 @@
|
||||
#Requires -Version 7.0
|
||||
<#
|
||||
.SYNOPSIS
|
||||
资源管理器右键菜单的入口:把选中的文件夹(或视频文件所在目录)交给 media-rename / media-archive。
|
||||
资源管理器右键菜单的入口:把选中的文件夹(或视频文件所在目录)交给对应动作。
|
||||
|
||||
.DESCRIPTION
|
||||
由 install-explorer-menu.ps1 注册到:
|
||||
- 文件夹右键
|
||||
- 文件夹空白处右键(当前目录)
|
||||
- .mkv / .mp4 / .avi 文件右键(取其所在目录)
|
||||
由 install-explorer-menu.ps1 注册成一个级联子菜单(SceneMarshal):
|
||||
1. 重命名(自动) auto
|
||||
2. 归档… media-archive
|
||||
3. 补外挂字幕(转码片源) extract-subs
|
||||
4. 入库前体检(只读) check
|
||||
|
||||
.PARAMETER Action
|
||||
rename(默认)= 规范化流水线;archive = 归档进媒体库。
|
||||
rename(默认)/ archive / extract-subs / check。
|
||||
|
||||
.PARAMETER Pause
|
||||
执行结束后停住窗口,便于查看输出(由右键菜单传入)。
|
||||
|
||||
.PARAMETER DryRun
|
||||
只打印将要执行的远端命令,不真正执行(调试 / 验证路径翻译用)。
|
||||
|
||||
.PARAMETER Paths
|
||||
资源管理器传入的选中项(通常一个)。
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet('rename', 'archive')]
|
||||
[ValidateSet('rename', 'archive', 'extract-subs', 'check')]
|
||||
[string]$Action = 'rename',
|
||||
[switch]$Pause,
|
||||
[switch]$DryRun,
|
||||
[Parameter(ValueFromRemainingArguments = $true)][string[]]$Paths = @()
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
try { [Console]::OutputEncoding = [Text.Encoding]::UTF8 } catch { }
|
||||
|
||||
$runner = switch ($Action) {
|
||||
'archive' { 'media-archive.ps1' }
|
||||
default { 'media-rename.ps1' }
|
||||
# 动作 → (执行脚本, 附带模式参数)
|
||||
$plan = switch ($Action) {
|
||||
'archive' { @{ Runner = 'media-archive.ps1'; Extra = @() } }
|
||||
'extract-subs' { @{ Runner = 'media-rename.ps1'; Extra = @('extract-subs') } }
|
||||
'check' { @{ Runner = 'media-rename.ps1'; Extra = @('check') } }
|
||||
default { @{ Runner = 'media-rename.ps1'; Extra = @() } }
|
||||
}
|
||||
|
||||
$target = $Paths | Where-Object { $_ } | Select-Object -First 1
|
||||
@@ -47,7 +55,18 @@ if (Test-Path -LiteralPath $target -PathType Leaf) {
|
||||
}
|
||||
|
||||
Write-Host "📁 目标: $target" -ForegroundColor DarkGray
|
||||
& (Join-Path $PSScriptRoot $runner) -Tokens @($target)
|
||||
Write-Host ("▶ 动作: {0}" -f $Action) -ForegroundColor DarkGray
|
||||
|
||||
$runnerPath = Join-Path $PSScriptRoot $plan.Runner
|
||||
$tokens = @($target) + $plan.Extra
|
||||
|
||||
if ($DryRun) {
|
||||
& $runnerPath -Tokens $tokens -DryRun
|
||||
}
|
||||
else {
|
||||
& $runnerPath -Tokens $tokens
|
||||
}
|
||||
|
||||
$code = $LASTEXITCODE
|
||||
if ($null -eq $code) { $code = 0 }
|
||||
|
||||
|
||||
@@ -1,21 +1,36 @@
|
||||
#Requires -Version 7.0
|
||||
<#
|
||||
.SYNOPSIS
|
||||
在 Windows 资源管理器右键菜单里注册 SceneMarshal 的「重命名」「归档」两项。
|
||||
在 Windows 资源管理器右键菜单注册 SceneMarshal 菜单(当前用户,无需管理员)。
|
||||
|
||||
.DESCRIPTION
|
||||
只写 HKCU(当前用户),不需要管理员权限,可随时用 uninstall-explorer-menu.ps1 移除。
|
||||
注册位置(每处两个菜单项):
|
||||
HKCU\Software\Classes\Directory\shell\<Key> (文件夹右键)
|
||||
HKCU\Software\Classes\Directory\Background\shell\<Key> (文件夹空白处右键)
|
||||
HKCU\Software\Classes\SystemFileAssociations\.mkv\shell\<Key>
|
||||
默认注册成「SceneMarshal ▸」级联子菜单,子项:
|
||||
1. 重命名(自动) → auto
|
||||
2. 归档… → media-archive(交互选分类)
|
||||
3. 补外挂字幕(转码片源) → extract-subs
|
||||
4. 入库前体检(只读) → check
|
||||
|
||||
级联写法与 Windows 自带项(UpdateEncryptionSettingsWork)一致:
|
||||
父键上写 ExtendedSubCommandsKey = 该键自身的 HKCR 相对路径,子项放在父键的 Shell\ 下。
|
||||
|
||||
注册位置(每处一个父菜单):
|
||||
HKCU\Software\Classes\Directory\shell\SceneMarshal (文件夹右键)
|
||||
HKCU\Software\Classes\Directory\Background\shell\SceneMarshal (文件夹空白处右键)
|
||||
HKCU\Software\Classes\SystemFileAssociations\.mkv\shell\SceneMarshal
|
||||
... 同上 .mp4 / .avi(文件右键,取其所在目录)
|
||||
|
||||
.PARAMETER Flat
|
||||
兜底模式:不级联,直接注册 4 个平级菜单项(名称带「SceneMarshal ▸ 」前缀)。
|
||||
|
||||
.EXAMPLE
|
||||
.\install-explorer-menu.ps1
|
||||
.EXAMPLE
|
||||
.\install-explorer-menu.ps1 -Flat
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
param(
|
||||
[switch]$Flat
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
@@ -35,37 +50,101 @@ $repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$iconPath = Join-Path $repoRoot 'assets\scenemarshal.ico'
|
||||
if (-not (Test-Path -LiteralPath $iconPath)) { $iconPath = $pwsh }
|
||||
|
||||
$actions = @(
|
||||
@{ Key = 'SceneMarshal'; Text = 'SceneMarshal 重命名'; Action = 'rename' },
|
||||
@{ Key = 'SceneMarshalArchive'; Text = 'SceneMarshal 归档'; Action = 'archive' }
|
||||
$menuName = 'SceneMarshal'
|
||||
|
||||
$iconsDir = Join-Path $repoRoot 'assets\menu'
|
||||
function Get-ItemIcon([string]$name) {
|
||||
$p = Join-Path $iconsDir $name
|
||||
if (Test-Path -LiteralPath $p) { return $p }
|
||||
return $iconPath
|
||||
}
|
||||
|
||||
# 级联子项:ExtendedSubCommandsKey 模式下 Explorer 取 MUIVerb 作为显示名
|
||||
$items = @(
|
||||
@{ Key = '01-rename'; Text = '媒体整理'; Action = 'rename'; Icon = (Get-ItemIcon 'rename.ico') },
|
||||
@{ Key = '02-archive'; Text = '媒体归档'; Action = 'archive'; Icon = (Get-ItemIcon 'archive.ico') },
|
||||
@{ Key = '03-extract-subs'; Text = '补外挂字幕'; Action = 'extract-subs'; Icon = (Get-ItemIcon 'subtitle.ico') },
|
||||
@{ Key = '04-check'; Text = '入库校验'; Action = 'check'; Icon = (Get-ItemIcon 'check.ico') }
|
||||
)
|
||||
|
||||
# Relative = ExtendedSubCommandsKey 的值(相对 HKEY_CLASSES_ROOT),同时用于定位注册表路径
|
||||
$locations = @(
|
||||
@{ Shell = 'HKCU:\Software\Classes\Directory\shell'; Token = '%1' },
|
||||
@{ Shell = 'HKCU:\Software\Classes\Directory\Background\shell'; Token = '%V' },
|
||||
@{ Shell = 'HKCU:\Software\Classes\SystemFileAssociations\.mkv\shell'; Token = '%1' },
|
||||
@{ Shell = 'HKCU:\Software\Classes\SystemFileAssociations\.mp4\shell'; Token = '%1' },
|
||||
@{ Shell = 'HKCU:\Software\Classes\SystemFileAssociations\.avi\shell'; Token = '%1' }
|
||||
@{ Relative = 'Directory\shell\SceneMarshal'; Token = '%1' },
|
||||
@{ Relative = 'Directory\Background\shell\SceneMarshal'; Token = '%V' },
|
||||
@{ Relative = 'SystemFileAssociations\.mkv\shell\SceneMarshal'; Token = '%1' },
|
||||
@{ Relative = 'SystemFileAssociations\.mp4\shell\SceneMarshal'; Token = '%1' },
|
||||
@{ Relative = 'SystemFileAssociations\.avi\shell\SceneMarshal'; Token = '%1' }
|
||||
)
|
||||
|
||||
function New-MenuCommand([string]$Action, [string]$Token) {
|
||||
'"' + $pwsh + '" -NoLogo -NoProfile -File "' + $runner + '" -Action ' + $Action + ' -Pause "' + $Token + '"'
|
||||
}
|
||||
|
||||
function Get-RegPath([string]$relative) {
|
||||
return "HKCU:\Software\Classes\$relative"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------- 清理旧结构
|
||||
foreach ($loc in $locations) {
|
||||
foreach ($item in $actions) {
|
||||
$key = Join-Path $loc.Shell $item.Key
|
||||
foreach ($name in @($menuName, 'SceneMarshalArchive')) {
|
||||
$old = Join-Path (Split-Path -Parent (Get-RegPath $loc.Relative)) $name
|
||||
if (Test-Path -LiteralPath $old) { Remove-Item -LiteralPath $old -Recurse -Force }
|
||||
}
|
||||
# 兜底模式的平级项
|
||||
$shellOf = Split-Path -Parent (Get-RegPath $loc.Relative)
|
||||
Get-ChildItem -LiteralPath $shellOf -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.PSChildName -like 'SceneMarshal-*' } |
|
||||
ForEach-Object { Remove-Item -LiteralPath $_.PSPath -Recurse -Force }
|
||||
}
|
||||
# 早期尝试留下的共享子菜单键
|
||||
foreach ($sub in @('SceneMarshalMenu', 'SceneMarshalMenuBg')) {
|
||||
$old = "HKCU:\Software\Classes\$sub"
|
||||
if (Test-Path -LiteralPath $old) { Remove-Item -LiteralPath $old -Recurse -Force }
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------- 注册
|
||||
foreach ($loc in $locations) {
|
||||
$parent = Get-RegPath $loc.Relative
|
||||
if (-not (Test-Path -LiteralPath $parent)) { New-Item -Path $parent -Force | Out-Null }
|
||||
|
||||
if ($Flat) {
|
||||
# 兜底:每个位置注册 4 个平级项
|
||||
foreach ($item in $items) {
|
||||
$key = Join-Path $parent ("SceneMarshal-{0}" -f $item.Action)
|
||||
$commandKey = Join-Path $key 'command'
|
||||
New-Item -Path $key -Force | Out-Null
|
||||
New-Item -Path $commandKey -Force | Out-Null
|
||||
New-ItemProperty -Path $key -Name '(default)' -Value $item.Text -PropertyType String -Force | Out-Null
|
||||
New-ItemProperty -Path $key -Name 'Icon' -Value $iconPath -PropertyType String -Force | Out-Null
|
||||
New-ItemProperty -Path $key -Name 'MUIVerb' -Value ("$menuName ▸ " + $item.Text) -PropertyType String -Force | Out-Null
|
||||
New-ItemProperty -Path $key -Name 'Icon' -Value $item.Icon -PropertyType String -Force | Out-Null
|
||||
New-ItemProperty -Path $commandKey -Name '(default)' -Value (New-MenuCommand $item.Action $loc.Token) -PropertyType String -Force | Out-Null
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
New-ItemProperty -Path $parent -Name 'MUIVerb' -Value $menuName -PropertyType String -Force | Out-Null
|
||||
New-ItemProperty -Path $parent -Name 'ExtendedSubCommandsKey' -Value $loc.Relative -PropertyType String -Force | Out-Null
|
||||
New-ItemProperty -Path $parent -Name 'Icon' -Value $iconPath -PropertyType String -Force | Out-Null
|
||||
|
||||
$childrenShell = Join-Path $parent 'Shell'
|
||||
New-Item -Path $childrenShell -Force | Out-Null
|
||||
foreach ($item in $items) {
|
||||
$child = Join-Path $childrenShell $item.Key
|
||||
$commandKey = Join-Path $child 'command'
|
||||
New-Item -Path $commandKey -Force | Out-Null
|
||||
New-ItemProperty -Path $child -Name 'MUIVerb' -Value $item.Text -PropertyType String -Force | Out-Null
|
||||
New-ItemProperty -Path $child -Name 'Icon' -Value $item.Icon -PropertyType String -Force | Out-Null
|
||||
New-ItemProperty -Path $commandKey -Name '(default)' -Value (New-MenuCommand $item.Action $loc.Token) -PropertyType String -Force | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host '✔ 已注册右键菜单(当前用户)' -ForegroundColor Green
|
||||
foreach ($item in $actions) {
|
||||
Write-Host (" - 「{0}」 × 文件夹 / 空白处 / mkv,mp4,avi" -f $item.Text) -ForegroundColor DarkGray
|
||||
if ($Flat) {
|
||||
Write-Host '✔ 已注册平级菜单项(兜底模式)' -ForegroundColor Green
|
||||
}
|
||||
else {
|
||||
Write-Host '✔ 已注册右键级联菜单(ExtendedSubCommandsKey 自引用)' -ForegroundColor Green
|
||||
}
|
||||
Write-Host " $menuName ▸" -ForegroundColor Cyan
|
||||
foreach ($item in $items) {
|
||||
Write-Host (" {0}" -f $item.Text) -ForegroundColor DarkGray
|
||||
}
|
||||
Write-Host ' 位置:文件夹 / 空白处 / .mkv / .mp4 / .avi' -ForegroundColor DarkGray
|
||||
Write-Host '提示:若菜单未立即出现,重启一次 explorer.exe 或重新登录。' -ForegroundColor Yellow
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
#Requires -Version 7.0
|
||||
<#
|
||||
.SYNOPSIS
|
||||
移除 install-explorer-menu.ps1 注册的右键菜单(重命名 + 归档)。
|
||||
移除 install-explorer-menu.ps1 注册的 SceneMarshal 右键菜单。
|
||||
|
||||
.DESCRIPTION
|
||||
清理范围:
|
||||
- 5 处位置上的 SceneMarshal 父菜单(级联)及旧版平级项
|
||||
- 级联用的共享子菜单键 SceneMarshalMenu / SceneMarshalMenuBg
|
||||
- 兜底模式(-Flat)注册的 SceneMarshal-<action> 平级项
|
||||
|
||||
.EXAMPLE
|
||||
.\uninstall-explorer-menu.ps1
|
||||
@@ -11,7 +17,6 @@ param()
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$keyNames = @('SceneMarshal', 'SceneMarshalArchive')
|
||||
$shells = @(
|
||||
'HKCU:\Software\Classes\Directory\shell',
|
||||
'HKCU:\Software\Classes\Directory\Background\shell',
|
||||
@@ -19,6 +24,7 @@ $shells = @(
|
||||
'HKCU:\Software\Classes\SystemFileAssociations\.mp4\shell',
|
||||
'HKCU:\Software\Classes\SystemFileAssociations\.avi\shell'
|
||||
)
|
||||
$keyNames = @('SceneMarshal', 'SceneMarshalArchive')
|
||||
|
||||
$removed = 0
|
||||
foreach ($shell in $shells) {
|
||||
@@ -30,6 +36,24 @@ foreach ($shell in $shells) {
|
||||
Write-Host " - 已移除 $key" -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
# 兜底模式留下的平级项
|
||||
Get-ChildItem -LiteralPath $shell -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.PSChildName -like 'SceneMarshal-*' } |
|
||||
ForEach-Object {
|
||||
Remove-Item -LiteralPath $_.PSPath -Recurse -Force
|
||||
$script:removed++
|
||||
Write-Host (" - 已移除 {0}" -f $_.PSChildName) -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "✔ 右键菜单已清理($removed 项)" -ForegroundColor Green
|
||||
# 共享子菜单
|
||||
foreach ($sub in @('SceneMarshalMenu', 'SceneMarshalMenuBg')) {
|
||||
$key = "HKCU:\Software\Classes\$sub"
|
||||
if (Test-Path -LiteralPath $key) {
|
||||
Remove-Item -LiteralPath $key -Recurse -Force
|
||||
$script:removed++
|
||||
Write-Host " - 已移除 $key" -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ("✔ 右键菜单已清理({0} 项)" -f $removed) -ForegroundColor Green
|
||||
|
||||