feat(specials): 新增 specials 模式,按播出日期计算并写入特典放置信息

- 规则:特辑日期 < 该季首集 → 插到第 1 集前;>= 末集 → 整季之后;
  其它 → 插到「日期严格晚于它」的那一集之前(同日播出的特辑排在正片之后)
- 季归属优先取特辑名里的「第N季」,否则按日期找最近开播的一季
- 写入 episode nfo 的 airsbefore_season / airsbefore_episode / airsafter_season
- 写入失败(权限)不再中断整批,单独计数
- scripts/media-rename 支持 MEDIA_UID/MEDIA_GID,可切 root 写 Jellyfin 生成的 nfo
- 实测:11 部剧写入成功(现在就出发 75、你好星期六 198、花儿与少年 70…)

已知:Jellyfin 12.4 目前未读入这些字段(NFO 已写、API 刷新不生效),待进一步确认存储位置
This commit is contained in:
ali
2026-11-20 01:52:11 +08:00
parent 56b3832f0b
commit c278f2f53f
5 changed files with 202 additions and 5 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ if [[ -n "$target_path" ]]; then
(( allowed )) || die "路径越界: $target_path 未挂载给容器(仅允许 ${ALLOWED_PREFIXES[*]})"
fi
exec_opts=(-u 1000:1000)
exec_opts=(-u "${MEDIA_UID:-1000}:${MEDIA_GID:-1000}")
if [[ -t 0 && -t 1 ]]; then
exec_opts+=(-it)
fi
+7 -3
View File
@@ -262,10 +262,14 @@ def plan_merge(src: Path, dest: Path) -> dict:
target = dest / rel
if target.exists():
try:
same = target.stat().st_size == path.stat().st_size
old_size = target.stat().st_size
new_size = path.stat().st_size
except OSError:
same = False
if same:
old_size = new_size = -1
# 同一份文件重新封装/复制时容器元数据会有几十~几百字节出入,
# 差值小于 1MB 或 0.1% 就按重复处理,否则整批近似文件都会被报成冲突
tol = max(1_048_576, int(max(old_size, new_size) * 0.001))
if old_size >= 0 and abs(old_size - new_size) <= tol:
dupes.append(rel)
else:
conflicts.append((rel, "同名不同大小"))