Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]Add "Last Active" date/time for each torrent feature #305

Open
Corin-EU opened this issue Jun 19, 2015 · 5 comments
Open

Comments

@Corin-EU
Copy link

Would it be possible to add a date/time "Last Active" feature to libtorrent/rtorrent which shows the date/time that the torrent downloading or seeding was last active.

Transmission/transmissiongui has this feature which is extremely useful for determining whether or not a torrent is "stuck" downloading (ie never likely to complete) or not in demand for being seeded, and thus should be removed.

@chros73
Copy link
Contributor

chros73 commented Jun 22, 2015

Well, it won't be on the interface, but you can use these (pyroscope has created these amazing configs (I only modified a bit), along with the interface modification, if you don't know it then check it out: https://github.com/pyroscope/rtorrent-ps ):

  1. add this in .rtorrent.rc : this adds a custom field last_active to every torrent, which will contain a UNIX timestamp value, and updating this value according to some events.
# SCHEDULE: Set "last_active" custom field for items that have peers
method.insert = d.last_active, simple|value, "if=$d.peers_connected=,$cat=$system.time=,$d.custom=last_active"
method.insert = d.last_active.set, simple|private, "d.custom.set=last_active,$cat=$system.time="
schedule = update_last_active, 24, 42, "d.multicall2=started,\"branch=$d.peers_connected=,d.last_active.set=\""
method.insert = d.last_active.print, simple|private, "print=\"$cat={$convert.date=$d.last_active=, \\\" \\\", $convert.time=$d.last_active=}\""
method.insert  = d.last_active.check, simple|private, "or={d.peers_connected=,not=$d.custom=last_active}"
method.set_key = event.download.resumed, last_active_r, "branch={d.last_active.check=,d.last_active.set= ;d.save_full_session=}"
method.set_key = event.download.finished, last_active_f, "d.last_active.set= ;d.save_full_session="
  1. You can print out the human readable version of this value when you select a torrent on the interface using: CTRL+X d.last_active.print=
  2. You can sort any existing view to use this value, e.g the started view. Add this into you .rtorrent.rc:
# UI/VIEW: SORT the STARTED view (in view #3) by LAST ACTIVE desc
# Items are grouped into incomplete, complete in that order.
# Each group is devided again into subgroups by throttle name (e.g. slowup).
# Within each subgroup, they're sorted by last_active field desc.
branch=pyro.extended=,false=,"view.sort_current = started,greater=d.custom=last_active"
branch=pyro.extended=,"view.sort_current = started,\"compare=++-,d.complete=,d.throttle_name=,d.custom=last_active\""
  • If you use rtorrent, when you go to the started view ('kill -INT' problem  #3), the most active torrents will be at top. If you want to get the reserve order, you less instead of greater in the above sort line.
  • if you use rtorrent-ps, then this view will be grouped together into incomplete then complete torrents, and in each of every group is devided again into subgroups by throttle name (e.g. slowup), then they are sorted by last_active descending.

EDIT: fixing config entries in 1. and adding rtorrent-ps configuration to 3.

  • there was a problem in the code (resumed event part) that made the property updated after restarting rtorrent v0.9.4.

EDIT2: removed scheduling sorting for the started view (it made the view unuseable with long list)

@mrvn
Copy link

mrvn commented Aug 18, 2015

How about the last time all the missing chunks where seen?

@chros73
Copy link
Contributor

chros73 commented Aug 18, 2015

Well, what do you want to accomplish exactly?
You can use the 'd.size_chunks' (e.g. 870) and the 'd.chunks_hashed' (e.g. 640) values to determine whether it's already downloaded or not and then you can do something similar as it is in the above example.
But: why would this be valuable info? What about this instead (also coming from pyroscope config, slightly modified):
A. create a start date for every torrent which has been started called 'tm_started':

# EVENTS: Timestamps
#   tm_loaded = time loaded into client
#   tm_started = time of *first* start
#   tm_completed = time of completion
method.insert  = pyro.tm_started.now,simple|private,"d.custom.set=tm_started,$cat=$system.time= ;d.save_full_session="
method.set_key = event.download.resumed,time_stamp_r,"branch=d.custom=tm_started,false=,pyro.tm_started.now="
method.set_key = event.download.inserted_new,time_stamp_i,"d.custom.set=tm_loaded,$cat=$system.time= ;d.save_full_session="
method.insert  = pyro.tm_completed.now,simple|private,"d.custom.set=tm_completed,$cat=$system.time= ;d.save_full_session="
method.set_key = event.download.finished,time_stamp_f,"pyro.tm_completed.now="
method.insert  = pyro.tm_completed.check,simple,"and={d.complete=,not=$d.custom=tm_completed}"
method.set_key = event.download.hash_done,time_stamp_h,"branch=pyro.tm_completed.check=,pyro.tm_completed.now="

B. create a new view or sort and existing one by this new 'tm_started', and you'll see if a torrent is old but not finished.

@rakshasa
Copy link
Owner

This should be an easy feature to implement, add the call to libtorrent, an api call to rtorrent and such. Any torrent active would return current time, else last stopped or something.

@LightTemplar
Copy link

My use case is to understand, if there is still demand for torrent or not. And if its last time transfer was long ago, I can remove it from seeding then. I use this in Deluge and would like to have it in rTorrent too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants