mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-10-31 20:55:35 +08:00
- docs/dev/plugins.md 改为总览与导航,旧内容拆入 docs/dev/plugins/ - 新增核心概念、配置表单、事件、前端挂载点、命令行、签名与分发、内置插件、示例页 - 每个扩展点一页,侧边栏由页面表生成 - 改正旧文档中下载器配置、hardlink path_map 与补链按钮的过时描述
1.4 KiB
1.4 KiB
Conflict Policy (conflict_policy)
When the canonical file name of a new torrent is already used by another torrent, this policy decides to keep the old one or to replace it. A typical case is a v2 release of the same episode. @provider(points.CONFLICT_POLICY, id=...) returns a ConflictPolicy.
from ab_sdk.rename import ConflictDecision, ConflictRequest
class ReplaceUpgradesOnly:
def decide(self, request: ConflictRequest) -> ConflictDecision:
if request.strict_upgrade:
return ConflictDecision("replace")
return ConflictDecision("hold", "not a higher version of the same release")
ConflictRequest:target_path,incoming(the new torrent),owners(the torrents that use the name),strict_upgrade(the only owner is the same release as the new torrent and the new torrent has a higher version number).holdkeeps the old file and the new torrent waits. AB shows thereasonto the user.replacedeletes the old task and its files.- The host executes
replaceonly when there is one owner, both torrents have a single file and both have a complete parsed identity. In all other cases AB treats the result ashold. - The host has
holdandreplace. They are the two options of the setting "revision conflict policy".plugins.slots.conflict_policyselects the policy (defaulthold). If the selected id is not registered, AB useshold.