Multiple view sort options

329 views
Skip to first unread message

shmoe

unread,
Jun 17, 2015, 9:50:39 PM6/17/15
to pyrosco...@googlegroups.com
Hi (sorry if I posted this twice)

I am using rtorrent-ps 0.9.4 and am having trouble understanding how to sort a view by multiple fields. Could someone please show me a simple example?

I want to sort by (high->low) priority and then (old->new) time loaded

I have tried a few concoctions I have come across but cant seem to get any right!

Cheers

-shmoe


Krisztian Kovacs

unread,
Jun 18, 2015, 5:55:47 AM6/18/15
to pyrosco...@googlegroups.com
There are examples in ~/.pyroscope/rtorrent-0.8.9.rc.default (if you installed pyrocore already, which is highly suggested :) ).
You need the 'compare' method for this (only available in rtorrent-ps)  https://code.google.com/p/pyroscope/wiki/RtorrentExtended#compare=order,command1=[,...]
You can do something like this:

# UI/VIEW: SORT the MAIN view (in view #0) by the LOADED DATE grouped by PRIORITY
branch
=pyro.extended=,false=,"view.sort_current = main,greater=d.custom=tm_loaded"
branch
=pyro.extended=,"view.sort_current = main,\"compare=-+,d.priority=,d.custom=tm_loaded\""


What it does:
- it distinguishes between normal rtorrent (using only its 'greater' method) and rtorrent-ps (using its more advanced 'compare' method that allows grouping)
- as you can see it in the manual, the '-+' part of of the compare method means:
-- '-' : sort the 1st param in descending order , which is the priority
-- '+' : sort the second param in ascending order, which is the tm_loaded field
- we don't need the extra 'schedule' method for this view, because it already exist
- you need this in your config as well:

# Set "pyro.extended" to 1 to activate rTorrent-PS features!
# LEAVE THIS AT 0 IF YOU RUN A VANILLA rTorrent!
method
.insert = pyro.extended, value|const, 1



1. Here is what I use for the main view: it sorts torrents by the modify date of their meta (torrent) file (it can be useful, if you already had the torrent file in another client).

# SORT the MAIN view by DOWNLOADED TIME
# Helper methods to list of main items by the date desc their torrent file was downloaded, Store time when torrent file was downloaded in a custome field (tm_downloaded)
method
.insert     = d.tm_downloaded,string|simple,"execute.capture=sh,-c,\"echo -n \$(stat -c %Y \\\"$1\\\")\",getDownloadedDate,$d.tied_to_file="
method
.insert     = d.tm_downloaded.set,simple,"d.custom.set=tm_downloaded,$cat=$d.tm_downloaded=;d.save_full_session="
method
.set_key    = event.download.inserted_new,set_downloaded_date,"d.tm_downloaded.set="
view
.sort_current = main,greater=d.custom=tm_downloaded

And you can easily add this new custom field for your existing torrents when you go to the main view, hit CTRL+X, then:

d.multicall=,d.tm_downloaded.set=

d.multicall=,d.save_full_session=


2. Sort started and complete views


# UI/VIEW: SORT the STARTED view by STARTED TIME
view
.sort_current = started,greater=d.custom=tm_started
# UI/VIEW: SORT the COMPLETE view by COMPLETED TIME
view
.sort_current = complete,greater=d.custom=tm_completed


3. Sort  seeding view, like active view is done in pryroscope config, but group together:

# UI/VIEW: SORT the SEEDING view (in view #8) by the UPLOAD RATE (grouped by throttle name (e.g. slowup) and only show torrents with peers
# Each group is devided again into subgroups by throttle name (e.g. slowup).
# Within each subgroup, they're sorted by download and then upload speed.
branch
=pyro.extended=,false=,"view.sort_current = seeding,greater=d.up.rate="
branch
=pyro.extended=,"view.sort_current = seeding,\"compare=+-,d.throttle_name=,d.up.rate=\""
schedule
= sort_seeding,12,20,"view.filter = seeding,\"and={d.complete=,d.peers_connected=}\" ;view.sort=seeding"


4. And finally add new 'datasize' view:

# UI/VIEW: SORT torrents by DATASIZE (grouped by throttle name (e.g. slowup) and  bound to 'i' in rT-PS)
view
.add = datasize
branch
=pyro.extended=,"view.collapsed.toggle=datasize"
branch
=pyro.extended=,false=,"view.sort_current = datasize,greater=d.size_bytes="
branch
=pyro.extended=,"view.sort_current = datasize,\"compare=+-,d.throttle_name=,d.size_bytes=\""
view
.sort = datasize
branch
=pyro.extended=,"schedule = bind_datasize,0,0,\"ui.bind_key=download_list,i,ui.current_view.set=datasize\""



I use more, but these examples can give you an idea what you want to accomplish. :)
Reply all
Reply to author
Forward
0 new messages