Transmission 2.94 升级 3.00 跳过启动校验

前言

将 transmission 升级到了 3.00,发现每次启动都会对升级前的旧种子重新校验,然后就是数十个小时的校验过程,实在让人头大。经过多次尝试,终于找到可以跳过启动校验(只校验一次)的方法了,现记录如下。

教程

transmission 在 3.00 使用 40 位 hash 记录种子文件的信息(之前是 16 位),在 torrents 和 resume 文件夹中新生成的文件都是用 40 位 hash 值命名的。要解决每次启动都重复校验的问题,需要将旧种子的信息更新。主要有以下几步:

  1. 等待 transmission 第一次校验完生成新的 40 位 hash 命名的 resume 文件并将旧种子的的 resume 文件删除
  2. 将对应的旧种子的 torrent 文件更名为相同的 40 位 hash

等待初次校验完成

等待校验完成并删除旧 resume 文件(很好分辨,2.94 版本是【种子名 + 前 16 位 hash】的命名方式,而 3.0 版本生成的新 resume 文件都是【40 位 hash】命名方式)

对旧 torrent 文件重命名

停止 docker 中的 transmission服务,将旧 torrent 文件重命名为新 40 位 hash 形式。
因为旧 torrent 文件名称包含前 16 位 hash,所以可以直接将 16 位 hash 字符串与 resume 文件夹内所有文件进行匹配,如果匹配上前 16 位,则修正命名。

写了段代码解决命名问题:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import re

torrents_src = input('请输入torrents文件夹绝对路径:')
resume_src = input('请输入resume文件夹绝对路径:')

torrent_list = os.listdir(torrents_src)
resume_list = os.listdir(resume_src)

count = 0

for torrent in torrent_list:
# 从16位hash值开始,到后缀名结束
# 如果是新版文件40位hash,则会截取后16位,在下面match起始位置匹配匹配失败
pattern = torrent[-24:-8]

for resume in resume_list:
if re.match(pattern, resume[:-7], re.I):
print('Ok, find the files!')
print('torrent:', torrent)
print('resume:', resume)
os.rename(torrents_src+'\\'+torrent, torrents_src+'\\'+resume[:-7]+'.torrent')
print(f'{torrent} 已更名为 {resume[:-7]}.torrent')
print('==========================')
count += 1

print(f'已成功命名{count}个种子文件')

运行结果如下,一切顺利。

启动 transmission,可以看到已经没有在校验了。

注意事项

  1. 在操作前备份好 torrents 和 resume 文件夹
  2. 初次校验完成后建议停止 transmission 服务后再操作。

参考资料

【原创】Transmission 手动跳过校验 教程.md
Move a half downloaded file from Android to Windows/Linux
Reinstall Transmission and moving data to avoid torrent recheck


Transmission 2.94 升级 3.00 跳过启动校验
https://sunjx97.github.io/posts/402aacbe/
作者
sunjx97
发布于
2021年12月18日
许可协议