实现rTorrent的下载分类管理.docx

上传人:b****6 文档编号:4273569 上传时间:2022-11-28 格式:DOCX 页数:13 大小:32.13KB
下载 相关 举报
实现rTorrent的下载分类管理.docx_第1页
第1页 / 共13页
实现rTorrent的下载分类管理.docx_第2页
第2页 / 共13页
实现rTorrent的下载分类管理.docx_第3页
第3页 / 共13页
实现rTorrent的下载分类管理.docx_第4页
第4页 / 共13页
实现rTorrent的下载分类管理.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

实现rTorrent的下载分类管理.docx

《实现rTorrent的下载分类管理.docx》由会员分享,可在线阅读,更多相关《实现rTorrent的下载分类管理.docx(13页珍藏版)》请在冰豆网上搜索。

实现rTorrent的下载分类管理.docx

实现rTorrent的下载分类管理

实现rTorrent的下载分类管理(任务数自定义)

目前可以实现而又非常必要的目录分组功能大体如下:

(1)设定若干个不同的watch目录,并且都有相应的watch_wait目录放等待种子

每个watch目录有自己的ratio分享率,在ratio达到后自动存放到相应分类目录。

(2)自动监测下载任务数(不包含seeding的种子),定义总数为12。

(3)在下载完成后进行一系列动作,包括4G以上文件合并、watch目录下的种子文件自动删除。

目前已经全部实现,完美分组管理并实测全部正常运行。

(1)

要将文件夹全面重新规划,按照自己喜欢的方式分类。

(已经下载的所有文件也可以利用相应的命令全部转移,但比较麻烦,建议还是就全部重新设定,感兴趣的可以看下面迁移旧文件部分)

将rtorrent直接迁移到/pub下,分为.session,watch,queue(下设若干分类文件夹,可任意追加)

结构图如下:

A.rTorrent程序文件夹

/pub

    /rtorrent

              /.session  

              /watch

                    /!

Game

                    /!

Video

                    /!

seeding

              /queue

                    /!

Game

                    /!

Video

                    /!

seeding

B.下载文件夹,!

working为下载中任务目录,其他为和A中对应的下载后保存位置。

/pub

    /Downloads

          /!

Game

          /!

Video

          /!

seeding

          /!

working

以上的目录结构时需修改配置文件.rtorrent.rc中的设定有:

#下载时临时存放目录以及session存放目录

directory=/shares/mss-hdd/Public/Downloads/!

working

session=/shares/mss-hdd/Public/rtorrent/.session  

增加相应的不同watch如下:

注:

已实现区分PT、BT种子的强化方法,强烈推荐混PT站的作此设定,详见下面红色标注的强化方法。

标准方法1:

分别建立三组监视目录,并在下载完成后转移文件到对应文件夹下。

(推荐使用,可自动转移)

可以根据自己的情况任意追加和设定分组,只要修改d.set_custom1=后面的目录位置即可。

schedule=wd_1,10,10,"load_start=/pub/rtorrent/watch/!

seeding/*.torrent,d.set_custom1=/pub/Downloads/!

seeding"

schedule=wd_2,20,10,"load_start=/pub/rtorrent/watch/!

Game/*.torrent,d.set_custom1=/pub/Downloads/!

Game"

schedule=wd_3,30,10,"load_start=/pub/rtorrent/watch/!

Video/*.torrent,d.set_custom1=/pub/Downloads/!

Video"

on_finished=move_complete,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1="

标准方法2:

分别建立三组监视目录,直接将文件保存到对应文件夹下。

(不推荐,无法分清未完成和已完成)

schedule=wd_1,10,10,"load_start=/pub/rtorrent/watch/!

seeding/*.torrent,d.set_directory=/pub/Downloads/!

seeding"

schedule=wd_2,20,10,"load_start=/pub/rtorrent/watch/!

Game/*.torrent,d.set_directory=/pub/Downloads/!

Game"

schedule=wd_3,30,10,"load_start=/pub/rtorrent/watch/!

Video/*.torrent,d.set_directory=/pub/Downloads/!

Video"

ratio可以利用0.8.4版本的新功能进行设定.

设定参考如下

默认的分享率设定为下面四句。

是指当上传大于200M且分享率达到50%时自动关闭任务,或者只要达到分享率100%就关闭

ratio.enable=                                                                           

ratio.min.set=50                                                                         

ratio.max.set=100                                                                        

ratio.upload.set=200M      

每个分组的设定要按照下面设定(如果不设定就是用上面的默认分享率,所以只需要对有特殊需要的进行设定,比如长期挂种)

(最小分享率100%并上传100G,最大分享率无限)

group.insert_persistent_view=Ratio100

group.Ratio100.ratio.enable=   

group.Ratio100.ratio.min.set=100    

group.Ratio100.ratio.max.set=0    

group.Ratio100.ratio.upload.set=100000M

schedule=wd_1,10,10,"load_start_verbose=/pub/rtorrent/watch/!

seeding/*.torrent,d.set_custom1=/pub/Downloads/!

seeding,view.set_visible=Ratio100"

注意此处需要修改对应的watch语句

强化方法(混PT站必备)

设定语句如下,可用于测试,与标准方法1(有Group共享)的区分在于加入了branch判断语句。

schedule语句超长,建议在XP下编辑后再逐一的仔细copy到vi编辑下。

schedule=wd_test,10,10,"load_start_verbose=/pub/rtorrent/watch/test/*.torrent,d.set_custom1=/pub/Downloads/test,\"branch={d.is_private=,,{d.set_custom2=BT,view.set_visible=RatioBT}}\""

主义private=后面是两个逗号,第一个逗号后是判断为private的执行命令,第二个是判断为public的执行命令。

作用是在载入watch目录下的种子时,自动判断是否为privatetracker(PT),

BT种子就把任务的custom2设为BT,同时将分享率Group设为RatioBT,

PT种子,custom2为空,分享率执行默认Ratio(其实也可custom2设为PT,但置空,是为了以后更多的复杂判断条件预备。

schedule=wd_test,10,10,"load_start_verbose=/pub/rtorrent/watch/test/*.torrent,d.set_custom1=/pub/Downloads/test,\"branch={d.is_private=,set_visible=RatioPT,{d.set_custom2=BT,view.set_visible=RatioBT}}\""

可分别在test中放入一个PT和BT种子,用下面的命令确认效果。

print=$d.get_custom2=

d.multicall=RatioPT,print=$d.get_name=

如果是BT种子,两个命令的输出应该在屏幕上显示"BT“,”种子文件名“。

再写一个详细范例作为参考,包括了在.rtorrent.rc中与分组有关的全部设定,

整个分类管理只须再加上RTqueue.sh的脚本crontab即可。

##on执行语句部分

#下载完成后将文件转移至指定的custom1文件夹

on_finished=move_complete,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1="

#下载完成后删除watch下.torrent文件

on_finished=remove_tied,"d.delete_tied="

#下载完成后执行4g合并脚本

on_finished=4g,"execute=RT4g.sh,$d.get_base_path=,$d.get_custom2="(注:

脚本已更新)

#删除任务时也将相关文件一并删除(有时会失效,无法解决,是rTorrent本身的问题)

on_erase=rm_complete,"execute=rm,-rf,$d.get_base_path="

##schedule语句,用于监测各分类脚本

#测试用分组,可修改部分用红色标注,分别是

schedule名称(wd_test),开始时间(30秒后),时间间隔(10秒),监视分类目录(/pub/rtorrent/watch/test/),完成存放目录(/pub/Downloads/test)

PT的Ratio分组(RatioPT)

schedule=wd_test,10,10,"load_start_verbose=/pub/rtorrent/watch/test/*.torrent,d.set_custom1=/pub/Downloads/test,\"branch={d.is_private=,{d.set_custom2=PT,view.set_visible=RatioPT}}\""

#正式分组

schedule=wd_1,30,10,"load_start_verbose=/pub/rtorrent/watch/!

seeding/*.torrent,d.set_custom1=/pub/Downloads/!

seeding,\"branch={d.is_private=,,{d.set_custom2=BT,view.set_visible=RatioBT}}\""

schedule=wd_2,30,10,"load_start_verbose=/pub/rtorrent/watch/!

Game/*.torrent,d.set_custom1=/pub/Downloads/!

Game,\"branch={d.is_private=,,{d.set_custom2=BT,view.set_visible=RatioBT}}\""

schedule=wd_3,30,10,"load_start_verbose=/pub/rtorrent/watch/!

Video/*.torrent,d.set_custom1=/pub/Downloads/!

Video,\"branch={d.is_private=,,{d.set_custom2=BT,view.set_visible=RatioBT}}\""

##Ratio设定(只适用于0.8.4版本)

#注意:

做种默认分享率(seeding)与group.ratio(RatioBT)同时有效,所以(seeding)必须是所有组别中最大分享率。

#如果需要对应已存在的任务,可以加上下面的一行命令(此句与分组管理无关,可不设置)

on_start=VerifyBTset,"branch=d.is_private=,,{d.set_custom2=BT,view.set_visible=RatioBT}" 

#新增system.method.set语句,必须设定,用于对应每个分享率组达到后后续处理(测试时可以在后面加上显示任务名的命令,print=$d.get_name=)。

#做种默认分享率(seeding),指当上传大于10G且分享率达到100%或最大分享率200%(如为0则是无限,直到满足10G上传和100%的要求)

ratio.enable=                                                                           

ratio.min.set=100

ratio.max.set=200                                                                        

ratio.upload.set=10000M      

system.method.set=mand,d.close=,d.stop=,d.set_ignore_commands=1

#BT分享率,设为最小分享率10%并上传10M,最大分享率20(下载完成后,判断分享率机制就启用,符合的就执行对应的mand语句)

group.insert_persistent_view=RatioBT

group.RatioBT.ratio.enable=   

group.RatioBT.ratio.min.set=10

group.RatioBT.ratio.max.set=20

group.RatioBT.ratio.upload.set=10M

system.method.set=group.RatioBTmand,d.close=,d.stop=,d.set_ignore_commands=1

(2)自动监测下载任务数(不包含seeding的种子),定义总数为10。

完成度100%,目前实现的是针对watch和queue两个目录的总数量进行管理,

没有涉及分类(实现毫无问题,问题在于按什么规则?

似乎没必要或仍想不到每一个分组的任务控制规则)

实现整个下载分类管理步骤:

queue分类->watch分类->下载完成分类,已经可以实现rt文件完美管理。

注:

在.rtorrent.rc配置文件中加上:

schedule=tied_directory,10,10,start_tied=

加入此条后,如果需要暂时关闭任务,必须到screen下ctrl+k(关闭任务),因为ntorrent中的close只能让任务关闭又被启动。

但又需要注意该任务会被自动加上I标志,下次要执行任务时要到screen下按"I"键取消就可以开始下载了。

新脚本的作用是:

监测watch目录下的种子数,而且支持多级目录,清晰直观。

下载任务队列管理脚本RTqueue.sh如下(附件中已上传),

把它保存到/opt/bin后,然后crontab-e加入一行*/3****/opt/bin/RTqueue.sh

这是我根据下面这个国外脚本缩减为为简易实用的(国外那个功能更强大)

max_active_dl=设最大任务数(128M内存设12为宜)

?

?

?

_dir,是几个相关目录的地址(unknown须建立,用于保存后缀名不是.torrent的文件)

logfile保存脚本的纪录(须建立,可任意指定位置)

#!

/opt/bin/sh                                                                                

#                                                                                        

                                                                                        

#    rTorrentqueuemanager                                                                    

#    rtqm.sh                                                                              

#    2009/01/20                                                                            

                                                                                        

#exportLC_ALL=zh_CN.UTF-8                                                                       

#exportTZ=CST-8                                                                              

max_active_dl=10                                                                              

                                                                                        

queue_dir="/shares/mss-hdd/Public/rtorrent/queue"                                                        

watch_dir="/shares/mss-hdd/Public/rtorrent/watch"                                                        

session_dir="/shares/mss-hdd/Public/rtorrent/.session"                                                     

unknown_dir="/shares/mss-hdd/Public/rtorrent/unknown_file"                                                  

logfile="/shares/mss-hdd/Public/log/rtqm.log"                                                          

                                                                                        

                                                                                     

no_queue_bt=`find$queue_dir/.-typef|wc-l|awk'{print$1}'`;                                            

no_watch_bt=`find$watch_dir/.-typef|wc-l|awk'{print$1}'`;                                            

                                                               

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 理化生

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1