Skip to content

Commit

Permalink
Support public torrents (Closes #108)
Browse files Browse the repository at this point in the history
  • Loading branch information
chros authored and chros committed May 16, 2017
1 parent 742d21c commit 066a3ed
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ubuntu-14.04/home/chros73/.pyroscope/rtorrent-ps.rc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ method.insert = network.history.auto_scale.ui_toggle, simple|private, "network.h
branch=pyro.extended=,"schedule2 = bind_auto_scale,0,0,\"ui.bind_key=download_list,=,network.history.auto_scale.ui_toggle=\""

# UI/STATUS: Display additional throttle up info in status bar (it needs rT-PS-CH)
branch=pyro.extended=,"branch=pyro.extended.ch=,\"ui.status.throttle.up.set = slowup\""
branch=pyro.extended=,"branch=pyro.extended.ch=,\"ui.status.throttle.up.set = slowup,tardyup\""

### end: Other UI enhancements ###

Expand Down
32 changes: 29 additions & 3 deletions ubuntu-14.04/home/chros73/.rtorrent-config.rc
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,38 @@ throttle.max_uploads.set = 50
# You can assign throttles to a stopped download with Ctrl-T. The NULL throttle is a special unlimited throttle that bypasses the global throttle.
# Limits the upload rate to 600 kb/s for the "slowup" throttle group. We also use this property to distinguish between "special" and "others" group. (This value will be auto-adjusted by a helper script in Favouring section of main config file.)
throttle.up = slowup,600
throttle.up = tardyup,300

# Slowup group values for the previous similar 3 settings that will be overriden by per torrent settings in Favouring section of main config file.
# cfg.slowup.d.peers_min ~ throttle.min_peers.normal , cfg.slowup.d.peers_max ~ throttle.max_peers.normal , cfg.slowup.d.uploads_max ~ throttle.max_uploads
method.insert = cfg.slowup.d.peers_min, value|private, 29
method.insert = cfg.slowup.d.peers_max, value|private, 50
method.insert = cfg.slowup.d.uploads_max, value|private, 15
method.insert = cfg.slowup.d.peers_min, value, 29
method.insert = cfg.slowup.d.peers_max, value, 50
method.insert = cfg.slowup.d.uploads_max, value, 15


## Variables for getting upload rate limit and upload slots for throttle groups
# Max, Min value of uprate limit throttle in KB and Max number of upload slots for slowup throttle group
method.insert = cfg.slowup.uprate.max, value, 1600
method.insert = cfg.slowup.uprate.min, value, 75
method.insert = cfg.slowup.upslots.max, value, 125
# Max, Min value of uprate limit throttle in KB and Max number of upload slots for tardyup throttle group
method.insert = cfg.tardyup.uprate.max, value, 1200
method.insert = cfg.tardyup.uprate.min, value, 25
method.insert = cfg.tardyup.upslots.max, value, 75

## Variables for getting global downrate limit
# Max, Min value of global downrate in KB
method.insert = cfg.global.downrate.max, value, 9999
method.insert = cfg.global.downrate.min, value, 8000
# Threshold values for global and special group uprate in KB
method.insert = cfg.global.upall.threshold, value, 1600
method.insert = cfg.global.upmain.threshold,value, 1100

# Min value of uprate per upload slot (unchoked peers) in KB
method.insert = cfg.global.slot.uprate.min, value, 5




# Set the numwant field sent to the tracker, which indicates how many peers we want. A negative value disables this feature. Default: -1 (tracker_numwant)
trackers.numwant.set = 100
Expand Down
42 changes: 30 additions & 12 deletions ubuntu-14.04/home/chros73/.rtorrent.rc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ method.insert = d.get_data_full_path, simple, "branch=((d.is_multi_file)),((cat,
method.insert = d.unsafe_data.set, simple|private, "d.custom.set=unsafe_data,(argument.0); d.save_full_session="
# helper method: sets priority and throttle (or removes it) for torrents based upon its arguments
method.insert = d.modify_rest, simple|private, "d.priority.set=(argument.0); d.throttle_name.set=(argument.1)"
# helper method: calls 'd.modify_rest' method with the proper arguments based upon the 2nd argument; special group: sets priority to normal, removes throttle group; other torrents: sets priority to low, sets slowup throttle group
method.insert = d.is_special_group, simple|private, "branch=((argument.0)),((d.modify_rest,2,)),((d.modify_rest,1,slowup))"
# helper method: calls 'd.modify_rest' method with the proper arguments based upon whether a throttled download is private; other torrents: sets priority to low, sets slowup or tardyup throttle group
method.insert = d.is_private_throttled, simple|private, "branch=((d.is_private)),((d.modify_rest,1,slowup)),((d.modify_rest,1,tardyup))"
# helper method: calls 'd.modify_rest' or 'd.is_private_throttled' method with the proper arguments based upon the 2nd argument; special group: sets priority to normal, removes throttle group
method.insert = d.is_special_group, simple|private, "branch=((argument.0)),((d.modify_rest,2,)),((d.is_private_throttled))"
# helper method: sets custom 'data_dir', 'meta_dir' variables, priority, throttle of a torrent. Requires 2 parameters, usage e.g.: 'd.attribs.set.helper=rotating,1'
method.insert = d.attribs.set.helper, simple|private, "d.custom.set=data_dir,(cat,(cfg.dir.main),(argument.0)); d.custom.set=meta_dir,(cat,(cfg.dir.meta_compl),(argument.0)); d.is_special_group=(argument.1)"
# helper method: calls 'd.attribs.set.helper' method (sets custom 'data_dir', 'meta_dir' variables, priority, throttle) and sets 'unsafe_data' variable of a torrent. Requires 3 parameters, usage e.g.: 'd.attribs.set=unsafe,,1'
Expand Down Expand Up @@ -167,21 +169,37 @@ method.insert = d.move_to, simple, "d.move_to.check_data_dir=$argument.0=,$argum

##### begin: Favouring special group of torrents over the rest #####

# Set choke group to one of the default ones if there's no throttle or throttle is special one (NULL) otherwise sets it to one of the throttle name ones
method.insert = d.modify_choke_group, simple, "branch=((and,((d.throttle_name)),((not,((equal,((d.throttle_name)),((cat,NULL)))))))),((d.group.set,(cat,(d.throttle_name),_,(d.connection_current)))),((d.group.set,(cat,default_,(d.connection_current))))"
# helper method: Modifies the peers_min, peers_max, max_uploads values of a torrent for both downloading and uploading
method.insert = d.modify_slots, simple|private, "d.peers_min.set=(argument.0); d.peers_max.set=(argument.1); d.uploads_max.set=(argument.2)"
# Modifies the above properties for a torrent based on which group it belongs to
method.insert = d.modify_slots_both, simple, "branch=((not,(d.throttle_name))),((d.modify_slots,(throttle.min_peers.normal),(throttle.max_peers.normal),(throttle.max_uploads))),((d.modify_slots,(cfg.slowup.d.peers_min),(cfg.slowup.d.peers_max),(cfg.slowup.d.uploads_max)))"
# Modify both group values when a torrent is resumed (even after hashchecking or after rtorrent is restarted)
method.set_key = event.download.resumed, modify_slots_resumed_both, "d.modify_slots_both="

# helper method: gets one of the below info with the help of getLimits.sh script (Variables are inside the script, you have to edit those values there!)
method.insert = get_limit, simple|private, "execute.capture=\"$cat=$pyro.bin_dir=,getLimits,$cfg.postfix=,.sh\",$argument.0=,$argument.1=,$argument.2=,$argument.3="
# Dynamically adjusts the 2nd group (slowup throttle) uprate (upload speed) to always leave enough bandwidth to the 1st main group. (More info in getLimits.sh script.)
schedule2 = adjust_throttle_slowup, 14, 20, "throttle.up=slowup,\"$get_limit=$cat=up,$convert.kb=$throttle.global_up.rate=,$convert.kb=$throttle.up.rate=slowup\""
# Dynamically adjusts the global download rate to always leave enough bandwidth to the 1st main group upload rate. It's good for async connection (e.g. ADSL) where upload speed can be slowed down if download speed is close to max. Comment it out if you don't need it.
schedule2 = adjust_throttle_global_down_max_rate, 54, 60, "throttle.global_down.max_rate.set_kb=\"$get_limit=$cat=down,$convert.kb=$throttle.global_up.rate=,$convert.kb=$throttle.up.rate=slowup\""
# Helper method to display the current rate information: after CTRL+x , you can use: i= . It displays: MainUpRate: 1440 , ThrottleUpRate: 92 , ThrottleLimit: 100
method.insert = i, simple, "print=\"$get_limit=$cat=info,$convert.kb=$throttle.global_up.rate=,$convert.kb=$throttle.up.rate=slowup,$convert.kb=$throttle.up.max=slowup\""
method.set_key = event.download.resumed, modify_slots_resumed_both, "d.modify_slots_both=; d.modify_choke_group="
method.set_key = event.download.finished, modify_finished_choke_group, "d.modify_choke_group="
method.set_key = event.download.partially_restarted, modify_partially_restarted_choke_group, "d.modify_choke_group="

# helper method: get current uprate in KB for special group
method.insert = get_uprate_main, simple, "math.max=0,(math.div,(math.sub,(throttle.global_up.rate),(throttle.up.rate,slowup),(throttle.up.rate,tardyup)),1024)"
# helper methods: get new uprate limit in KB (based on special group uprate) for slowup and tardyup throttle groups
method.insert = get_uprate_slowup, simple|private, "math.min=(cfg.slowup.uprate.max),(math.max,(cfg.slowup.uprate.min),(math.sub,(cfg.slowup.uprate.max),(get_uprate_main),(math.div,(throttle.up.rate,tardyup),1024)))"
method.insert = get_uprate_tardyup, simple|private, "math.min=(cfg.tardyup.uprate.max),(math.max,(cfg.tardyup.uprate.min),(math.sub,(cfg.tardyup.uprate.max),(get_uprate_main),(math.div,(throttle.up.rate,slowup),1024)))"
# Set new uprate limit for slowup and tardyup throttle groups in every 20 seconds
schedule2 = adjust_throttle_slowup, 14, 20, "throttle.up=slowup,(cat,(get_uprate_slowup))"
schedule2 = adjust_throttle_tardyup, 15, 20, "throttle.up=tardyup,(cat,(get_uprate_tardyup))"

# helper method: get new global downrate limit in KB (based on special group uprate and given threshold values)
method.insert = get_downrate_global, simple|private, "branch=(and,((greater,((math.div,(throttle.global_up.rate),1024)),((cfg.global.upall.threshold)))),((greater,((get_uprate_main)),((cfg.global.upmain.threshold))))),(cfg.global.downrate.min),(cfg.global.downrate.max)"
# Set new global downrate limit in every 60 seconds
schedule2 = adjust_throttle_global_down_max_rate, 54, 60, "throttle.global_down.max_rate.set_kb=(get_downrate_global)"

# helper methods: get new upload slots limit for slowup_seed and tardyup_seed choke groups (based on their current uprate and the given cfg values)
method.insert = get_slots_slowup, simple|private, "math.min=(cfg.slowup.upslots.max),(math.max,(math.div,(cfg.slowup.uprate.min),(cfg.global.slot.uprate.min)),(math.div,(throttle.up.rate,slowup),1024,(cfg.global.slot.uprate.min)))"
method.insert = get_slots_tardyup, simple|private, "math.min=(cfg.tardyup.upslots.max),(math.max,(math.div,(cfg.tardyup.uprate.min),(cfg.global.slot.uprate.min)),(math.div,(throttle.up.rate,tardyup),1024,(cfg.global.slot.uprate.min)))"
# Set new upload slots (unchoked peers) limit for slowup_seed and tardyup_seed choke groups in every 100 seconds
schedule2 = adjust_slots_slowup, 47, 100,"choke_group.up.max.set=slowup_seed,(cat,(get_slots_slowup))"
schedule2 = adjust_slots_tardyup, 48, 100,"choke_group.up.max.set=tardyup_seed,(cat,(get_slots_tardyup))"

##### end: Favouring special group of torrents over the rest #####

Expand Down

0 comments on commit 066a3ed

Please sign in to comment.