feat(specials): 改用 Jellyfin API 写入,放置功能真正生效
- 关键结论:Jellyfin 12.4 不读手写 NFO 里的 airsbefore_* 标签(替换全部元数据刷新也不读),
且 API 不回显这三个字段,所以之前无法验证
- 正确路径 POST /Items/{id}:改 AirsBeforeSeasonNumber / AirsBeforeEpisodeNumber /
AirsAfterSeasonNumber 后提交,等价于在 App 里手填,立即生效并自动回写 NFO
- apply_via_api:按剧名找 series id,拉 Season 00 条目,逐条提交
- 容器内 127.0.0.1 连不上 Jellyfin,自动回退 172.17.0.1 / 10.10.1.202
- 实测:11 部剧共写入 469 条,现在就出发第4季 23 条里 13 条特典,顺序正确
- 新增 docs/specials.md 记录规则、坑与限制
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import configparser, json, urllib.parse, urllib.request
|
||||
cfg = configparser.ConfigParser(); cfg.read("/home/ali/docker/tools/python/media/src/config.ini", encoding="utf-8")
|
||||
url = cfg.get("Jellyfin","url",fallback="http://127.0.0.1:8096").rstrip("/")
|
||||
key = cfg.get("Jellyfin","api_key",fallback="").strip()
|
||||
H = {"X-Emby-Token": key}
|
||||
def api(path, **q):
|
||||
q.setdefault("api_key", key)
|
||||
req = urllib.request.Request(f"{url}{path}?" + urllib.parse.urlencode(q), headers=H)
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
return json.load(r)
|
||||
|
||||
res = api("/Items", searchTerm="现在就出发", IncludeItemTypes="Series", Recursive="true")
|
||||
sid = res["Items"][0]["Id"]
|
||||
eps = api(f"/Shows/{sid}/Episodes", season="4", limit="200")["Items"]
|
||||
print(f" 第4季返回条目数: {len(eps)}")
|
||||
special = [e for e in eps if e.get("ParentIndexNumber") == 0]
|
||||
print(f" 其中来自特别季(ParentIndexNumber=0): {len(special)}")
|
||||
for e in eps[:6]:
|
||||
print(f" S{e.get('ParentIndexNumber')}E{e.get('IndexNumber')} {e.get('Name','')[:30]}")
|
||||
Reference in New Issue
Block a user