马春杰杰 Exit Reader Mode

自动移除指定条件种子的脚本autoremove_torrents的安装和使用

安装:

pip3 install autoremove-torrents

使用:

新建配置文件:

touch /home/sipl/4T/mcj/auto_remove_torrent_config.yml

然后填入:

mteam: # 任务名称
  client: qbittorrent
  host: http://127.0.0.1:8080
  username: admin
  password: adminadmin
  strategies:
    celue1: # 策略名称
      # 筛选过滤器
      all_categories: true
      remove: progress>99.99 and create_time>36000
  # 是否同时删除本地数据,默认为否
  delete_data: true

以上意思是,当下载进度大于99.99并且创建时间大于10小时了,就会删除掉。

运行:

先测试下:/usr/local/bin/autoremove-torrents --view --conf=/home/sipl/4T/mcj/auto_remove_torrent_colsnfig.yml

确认没问题了,正式运行:

/usr/local/bin/autoremove-torrents  --conf=/home/sipl/4T/mcj/auto_remove_torrent_colsnfig.yml

结果:

Sat, 05 Jun 2021 23:38:34 autoremovetorrents.main INFO: Auto Remove Torrents 1.5.3
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.main INFO: Loading configurations...
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.main INFO: Found 1 task(s) in the file.
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.task INFO: Running task 'mteam'...
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.task INFO: Logging in...
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.task INFO: Login successfully. The client is qBittorrent v4.1.9.1.
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.task INFO: WebUI API version: 2.2.1 (v2)
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.task INFO: Status reported by the client: 
        Download Speed: 48.26MiB/s      Total: 820.18GiB
        Upload Speed: 18.55MiB/s        Total: 1.46TiB
        Outgoing Port Status: Open
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.task INFO: Getting all the torrents...
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.task INFO: Found 66 torrent(s) in the client.
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: Running strategy celue1...
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: Total: 66 torrent(s). 21 torrent(s) can be removed.
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: To be deleted:
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: CCTV5+.2021.World.Womens.Volleyball.League.20210604.HDTV.1080i.H264-HDSTV.ts
        Progress:100.00%        Size:3.97GiB    Ratio:0.207     Total Uploaded:840.98MiB
        Seeder(connected/total):0/38    Leecher(connected/total):0/19   Status:Uploading
        Download Speed:0.00B/s(Avg.:1.13MiB/s)  Upload Speed:0.00B/s(Avg.:22.30KiB/s)
        Create Time:2021-06-05 12:55:05 Seeding Time:0d 09:43:25        Last Activity:2021-06-05 18:52:27
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: They.Live.1988.UHD.BluRay.Remux.2160p.DV.HEVC.TrueHD-Atmos.7.1-OurBits
        Progress:100.00%        Size:50.70GiB   Ratio:3.989     Total Uploaded:202.35GiB
        Seeder(connected/total):0/93    Leecher(connected/total):1/5    Status:Uploading
        Download Speed:0.00B/s(Avg.:3.88MiB/s)  Upload Speed:39.72KiB/s(Avg.:5.37MiB/s)
        Create Time:2021-06-05 12:55:12 Seeding Time:0d 07:00:23        Last Activity:2021-06-05 23:38:33
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,ourbits.club
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: CCTV4.National.Memory.20210531~20210604.HDTV.1080i.H264-HDSTV
        Progress:100.00%        Size:11.26GiB   Ratio:0.348     Total Uploaded:3.92GiB
        Seeder(connected/total):0/48    Leecher(connected/total):0/41   Status:Uploading
        Download Speed:0.00B/s(Avg.:2.56MiB/s)  Upload Speed:0.00B/s(Avg.:106.42KiB/s)
        Create Time:2021-06-05 12:55:05 Seeding Time:0d 09:28:30        Last Activity:2021-06-05 18:42:23
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: 铠甲勇士捕将第四部.Armor.Hero.Lava.S04.2015.1080p.WEB-DL.AAC.H264-HDSWEB
        Progress:100.00%        Size:18.67GiB   Ratio:0.581     Total Uploaded:10.85GiB
        Seeder(connected/total):0/67    Leecher(connected/total):0/43   Status:Uploading
        Download Speed:0.00B/s(Avg.:4.01MiB/s)  Upload Speed:0.00B/s(Avg.:267.75KiB/s)
        Create Time:2021-06-05 11:50:05 Seeding Time:0d 10:28:55        Last Activity:2021-06-05 23:29:53
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: CCTV5.2021.French.Open.20210603.HDTV.1080i.H264-HDSTV.ts
        Progress:100.00%        Size:5.73GiB    Ratio:0.267     Total Uploaded:1.53GiB
        Seeder(connected/total):0/39    Leecher(connected/total):0/19   Status:Uploading
        Download Speed:0.00B/s(Avg.:1.53MiB/s)  Upload Speed:0.00B/s(Avg.:41.38KiB/s)
        Create Time:2021-06-05 12:50:06 Seeding Time:0d 09:43:41        Last Activity:2021-06-05 21:19:43
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: Basic Love 2009 WEB-DL 4K H265 AAC & DDP 5.1 4Audios-Dave.mkv
        Progress:100.00%        Size:4.62GiB    Ratio:0.221     Total Uploaded:1.02GiB
        Seeder(connected/total):0/70    Leecher(connected/total):0/4    Status:Uploading
        Download Speed:0.00B/s(Avg.:6.13MiB/s)  Upload Speed:0.00B/s(Avg.:29.12KiB/s)
        Create Time:2021-06-05 13:10:11 Seeding Time:0d 10:00:20        Last Activity:2021-06-05 14:59:41
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.totheglory.im
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: CCTV4.Guo.Bao.Fa.Xian.20210531~20210603.HDTV.1080i.H264-HDSTV
        Progress:100.00%        Size:8.97GiB    Ratio:0.104     Total Uploaded:955.26MiB
        Seeder(connected/total):0/35    Leecher(connected/total):0/28   Status:Uploading
        Download Speed:0.00B/s(Avg.:2.24MiB/s)  Upload Speed:0.00B/s(Avg.:25.34KiB/s)
        Create Time:2021-06-05 12:55:05 Seeding Time:0d 09:35:10        Last Activity:2021-06-05 18:52:27
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: 青天を衝け EP15 1080p HDTV x265 AAC.mkv
        Progress:100.00%        Size:1.24GiB    Ratio:0.794     Total Uploaded:1010.01MiB
        Seeder(connected/total):0/33    Leecher(connected/total):0/1    Status:Uploading
        Download Speed:0.00B/s(Avg.:1.11MiB/s)  Upload Speed:0.00B/s(Avg.:26.13KiB/s)
        Create Time:2021-06-05 12:25:24 Seeding Time:0d 10:40:25        Last Activity:2021-06-05 14:18:16
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.totheglory.im
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: CCTV5+.2021.French.Open.20210604A.HDTV.1080i.H264-HDSTV.ts
        Progress:100.00%        Size:6.76GiB    Ratio:0.188     Total Uploaded:1.27GiB
        Seeder(connected/total):0/32    Leecher(connected/total):0/34   Status:Uploading
        Download Speed:0.00B/s(Avg.:1.76MiB/s)  Upload Speed:0.00B/s(Avg.:34.87KiB/s)
        Create Time:2021-06-05 13:00:05 Seeding Time:0d 09:32:53        Last Activity:2021-06-05 19:02:38
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: 青梅竹马绝对不会输的恋爱喜剧.Osananajimi.ga.Zettai.ni.Makenai.Love.Come.2021.WEB-DL.H264.AAC-OurTV
        Progress:100.00%        Size:663.21MiB  Ratio:0.698     Total Uploaded:463.86MiB
        Seeder(connected/total):0/38    Leecher(connected/total):0/1    Status:Uploading
        Download Speed:0.00B/s(Avg.:14.14MiB/s) Upload Speed:0.00B/s(Avg.:10.95KiB/s)
        Create Time:2021-06-05 11:30:09 Seeding Time:0d 12:02:01        Last Activity:2021-06-05 21:29:11
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,ourbits.club
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: Song.to.Song.2017.UHD.BluRay.REMUX.2160p.HEVC.DTS-HD.MA5.1-HDS
        Progress:100.00%        Size:56.22GiB   Ratio:3.086     Total Uploaded:173.63GiB
        Seeder(connected/total):0/117   Leecher(connected/total):0/94   Status:Uploading
        Download Speed:0.00B/s(Avg.:4.22MiB/s)  Upload Speed:0.00B/s(Avg.:3.93MiB/s)
        Create Time:2021-06-05 11:05:05 Seeding Time:0d 08:46:07        Last Activity:2021-06-05 21:59:54
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: BTV.I'm.A.Big.Doctor.20210603.HDTV.1080i.H264-HDSTV.ts
        Progress:100.00%        Size:2.35GiB    Ratio:0.158     Total Uploaded:381.78MiB
        Seeder(connected/total):0/39    Leecher(connected/total):0/20   Status:Uploading
        Download Speed:0.00B/s(Avg.:3.90MiB/s)  Upload Speed:0.00B/s(Avg.:10.05KiB/s)
        Create Time:2021-06-05 12:50:06 Seeding Time:0d 10:38:10        Last Activity:2021-06-05 18:42:23
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: Indiana Jones and the Temple of Doom 1984 2160p UHD Blu-ray HEVC TrueHD 7.1-ESiR
        Progress:100.00%        Size:59.88GiB   Ratio:1.511     Total Uploaded:90.49GiB
        Seeder(connected/total):0/130   Leecher(connected/total):0/7    Status:Uploading
        Download Speed:0.00B/s(Avg.:12.40MiB/s) Upload Speed:0.00B/s(Avg.:2.08MiB/s)
        Create Time:2021-06-05 11:05:39 Seeding Time:0d 11:00:45        Last Activity:2021-06-05 16:57:13
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.totheglory.im
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: HunanTV.The.Treasure.20210604.HDTV.1080i.H264-HDSTV.ts
        Progress:100.00%        Size:4.91GiB    Ratio:0.984     Total Uploaded:4.83GiB
        Seeder(connected/total):0/41    Leecher(connected/total):0/24   Status:Uploading
        Download Speed:0.00B/s(Avg.:1.33MiB/s)  Upload Speed:0.00B/s(Avg.:131.22KiB/s)
        Create Time:2021-06-05 12:55:05 Seeding Time:0d 09:40:35        Last Activity:2021-06-05 18:52:00
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: Rams.2015.720p.BluRay.x264-WiKi
        Progress:100.00%        Size:4.67GiB    Ratio:0.457     Total Uploaded:2.13GiB
        Seeder(connected/total):0/100   Leecher(connected/total):0/5    Status:Uploading
        Download Speed:0.00B/s(Avg.:5.78MiB/s)  Upload Speed:0.00B/s(Avg.:61.73KiB/s)
        Create Time:2021-06-05 13:35:08 Seeding Time:0d 09:49:39        Last Activity:2021-06-05 16:52:12
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.totheglory.im
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: 拆弹专家 ShockWave 2017 UHD Blu-ray 2160p HEVC DTS-X 7.1-Pete@HDSky
        Progress:100.00%        Size:60.01GiB   Ratio:2.968     Total Uploaded:178.29GiB
        Seeder(connected/total):0/129   Leecher(connected/total):5/180  Status:Uploading
        Download Speed:0.00B/s(Avg.:3.36MiB/s)  Upload Speed:466.66KiB/s(Avg.:4.88MiB/s)
        Create Time:2021-06-05 13:15:06 Seeding Time:0d 05:18:00        Last Activity:2021-06-05 23:38:34
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: HunanTV.Back.To.Field.20210604.HDTV.1080i.H264-HDSTV.ts
        Progress:100.00%        Size:4.62GiB    Ratio:0.821     Total Uploaded:3.80GiB
        Seeder(connected/total):0/48    Leecher(connected/total):0/41   Status:Uploading
        Download Speed:0.00B/s(Avg.:1.37MiB/s)  Upload Speed:0.00B/s(Avg.:102.38KiB/s)
        Create Time:2021-06-05 12:50:06 Seeding Time:0d 09:50:45        Last Activity:2021-06-05 22:06:13
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: Shock.Wave.2.2020.Blu-Ray.1080p.AVC.TrueHD.Atmos.7.1-lingfriendly@OurBits.iso
        Progress:100.00%        Size:37.22GiB   Ratio:1.603     Total Uploaded:59.69GiB
        Seeder(connected/total):0/187   Leecher(connected/total):0/13   Status:Uploading
        Download Speed:0.00B/s(Avg.:2.69MiB/s)  Upload Speed:0.00B/s(Avg.:1.63MiB/s)
        Create Time:2021-06-05 13:15:15 Seeding Time:0d 06:26:52        Last Activity:2021-06-05 23:02:47
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,ourbits.club
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: 連続テレビ小説 おちょやん 第20週 #096-100 1080p HDTV x265 AAC
        Progress:100.00%        Size:1.83GiB    Ratio:0.361     Total Uploaded:677.68MiB
        Seeder(connected/total):0/32    Leecher(connected/total):0/8    Status:Uploading
        Download Speed:0.00B/s(Avg.:5.62MiB/s)  Upload Speed:0.00B/s(Avg.:16.34KiB/s)
        Create Time:2021-06-05 11:35:08 Seeding Time:0d 11:42:15        Last Activity:2021-06-05 14:41:33
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.totheglory.im
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: Jade.Final.Destiny.E06-E10.HDTV.1080i.H264-HDSTV
        Progress:100.00%        Size:15.54GiB   Ratio:2.627     Total Uploaded:40.87GiB
        Seeder(connected/total):0/55    Leecher(connected/total):1/31   Status:Uploading
        Download Speed:0.00B/s(Avg.:3.14MiB/s)  Upload Speed:0.00B/s(Avg.:1.12MiB/s)
        Create Time:2021-06-05 13:15:06 Seeding Time:0d 08:58:46        Last Activity:2021-06-05 19:12:39
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,tracker.hdsky.me
Sat, 05 Jun 2021 23:38:34 autoremovetorrents.strategy INFO: 逆天奇案.SinisterBeings.2021.2160p.WEB-DL.H265.AAC.OurTV
        Progress:100.00%        Size:2.32GiB    Ratio:0.647     Total Uploaded:1.50GiB
        Seeder(connected/total):0/62    Leecher(connected/total):0/1    Status:Uploading
        Download Speed:0.00B/s(Avg.:28.28MiB/s) Upload Speed:0.00B/s(Avg.:36.25KiB/s)
        Create Time:2021-06-05 11:10:09 Seeding Time:0d 12:01:53        Last Activity:2021-06-05 19:00:44
        Category:       Tracker:** [DHT] **,** [PeX] **,** [LSD] **,ourbits.club

可以看到将会有21个种子被删除。

然后我们可以把命令加入到crontab中定时运行就行了。这就是使用autoremove自动删除种子的方法介绍。


本文最后更新于2021年7月6日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!