Giter VIP home page Giter VIP logo

Comments (20)

pyroscope avatar pyroscope commented on June 4, 2024 1

Look at the code, all this is already 80% solved.

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

Start out with one of the new fields in #29 to make @chros73 happy

:D Thank You!!!
This feature will be freaking awesome!!!

Btw, I use 2 more columns (I don't plan to add more):

  • chros73#17 Data-directory column
    • this one can be also interesting for you (maybe multiple flavours can be implemented)
  • chros73#15 Unsafe-data (deletable) column
    • this is how I determine whether a torrent is deletable or not
    • there are 3 state of it: [0|1|2] , 2 means it should be deleted first (these downloads has higher priority when delete task runs)

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

A little more about the deletable variable:

  • the idea is simple but the result is really powerful
  • it allows us to create a proper sweep functionality (as part of the downloading queue manager)
  • this property can be set in my setup:

And at last I'll be ready to switch completely to use pyrocore (instead of the file-based setup) if every aspect of this can be handled by it. (I think only the proper sweep functionality is missing from it).

from rtorrent-ps.

pyroscope avatar pyroscope commented on June 4, 2024

See https://github.com/pyroscope/pimp-my-box/blob/master/roles/rtorrent-ps/templates/rtorrent/rtorrent.d/05-rt-ps-columns.rc for config.

from rtorrent-ps.

pyroscope avatar pyroscope commented on June 4, 2024

Ad-hoc removal of a column:

rtxmlrpc -i 'method.set_key = ui.column.render, "~100:3:⋉ "'

This opens interesting possibilities of special views (add a column when showing a view, remove it when leaving it). Hmmm, I guess we need event.view.changed.

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

I just took a quick look at the config sample: it's really powerful! :)
Here's an idea about it:

  • string.map is indeed really powerful!
  • for throttle and Data-directory column:
    • we can create new commands for them (similar to string.map) that will auto-return the required 1 character:

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

Can be this made that if there's no column definitions in config files then a default inbuilt def is used? (as in main.cc of rtorent)

from rtorrent-ps.

pyroscope avatar pyroscope commented on June 4, 2024

built-in defaults

Certainly not a prio when all you need is an import of a default set. Possibly an extra mention in the setup docs, and a reference to the p-m-b default.

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

So, finally I managed to get to this point to play with it (after backporting it): pretty interesting, thanks! :)

A. Good things

a. built-in defaults

It's easy to do this, just like in main.cc in rtorrent.
(Note that I modded the uploaded data column a bit, added Unsafe data and Number of connected peers, and I haven't included the throttle column (I use my own).)

Custom columns defined in this way still can be:

  • disabled via config: method.set_key = ui.column.render, "100:1:☢ "
  • overridden via config: method.set_key = ui.column.render, "900:6: ⊼ ", ((convert.human_size, ((d.up.total)), (value, 0) ))

So, it's perfect! :)

b. toggle custom columns

An interesting use-case is when a given terminal has a smaller width than usually, so we can toggle custom columns to see the important information (probably it can be done with multi-method but here it is in the old way toggling 2 columns):

method.insert = ui.columns.extra.state, value|private, 1

method.insert = ui.columns.extra.enable,  simple|private, "\
       method.set_key = ui.column.render, \"100:1:☢ \", ((string.map, ((cat, ((d.is_open)), ((d.is_active)))), {00, \"▪ \"}, {01, \"▪ \"}, {10, \"╍ \"}, {11, \"▹ \"}));\
       method.set_key = ui.column.render, \"120:1:⌘ \", ((if, ((d.ignore_commands)), ((cat, \"◌ \")), ((cat, \"⚒ \"))));\
       ui.columns.extra.state.set=1"
method.insert = ui.columns.extra.disable, simple|private, "\
       method.set_key = ui.column.render, \"100:1:☢ \";\
       method.set_key = ui.column.render, \"120:1:⌘ \";\
       ui.columns.extra.state.set=0"
method.insert = ui.columns.extra.toggle,  simple, "branch=$ui.columns.extra.state=, ui.columns.extra.disable=, ui.columns.extra.enable="

branch=pyro.extended=,"schedule2 = disable_extra_columns,0,0,\"ui.bind_key=download_list,/,ui.columns.extra.toggle=\""

B. Bad things

Unfortunately it's still not usable for me in this state (hence I created a branch for it):

a. order of built-in/custom columns

Currently there's no way to put a custom column in between 2 built-in ones, isn't it?

Probably this feature would help this: "Existing columns might be factored into commands, to make everything configurable", meaning every column will be custom column. And with the above "built-in defaults" it's not a problem anymore. :)

b. coloring chars/columns

Currently coloring is broken:

  • somehow we need to keep track which characters in a given column needs to be colorised
    • in this way it won't matter which order the given column resides

C. Summary

Amazing job, as always, thanks! :)

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

I finished it, it was a big chunk of work :)

Commits: chros73#119

A. Coloring columns

a. Theory

That was the tricky part. Initially I wanted to modify the render_columns method to do coloring there but I realized that later they will be overridden.

So the idea is to track all the positions of all the columns all the time in render_columns using a simple map for this:

  • we use the label of the columns (from the column definition) as key in the map, e.g.
    • they are unique anyway, since we have the in-built default columns
  • after that we just check whether the given label is available (column is visible)
  • we have to empty this map all the time: columns can be removed on the fly

b. Limitations

  • user created custom columns can't be colorized
  • funky coloring effects can happen if a user overrides a colored column or create a new one with the same label

I'll write more (if I'll have time) about what I did and why, but in the meantime you can go through all the commits if you're interested (they are on develop branch for now, although I considered this feature as finished).

This feature is simply amazing, I'd never have thought of this: Thank You! :)

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

B. Name of commands

Can you take a look at the name of commands that I gave them, whether you like them or not?

  • here and this
    • d.tracker_scrape.downloaded
    • d.tracker_scrape.complete
    • d.tracker_scrape.incomplete
    • d.parent_dir
  • and here : I couldn't come up better names for them (that is short and descriptive)
    • d.ui.message
    • d.ui.completion
    • d.ui.ratio
    • d.ui.uprate_tm
    • d.ui.downrate_tm

These commands (especially the d.ui.* ones) always return back the proper string that needs to be displayed, colorized later.

Notes:

  • I modified the uprate column to display the approximate time since last active state as well (similarly to downrate column), this one is also colorized
  • I didn't do this: "Move 'tagged' to its own column", I like the way as it is

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

C. Replacing couple of glyphs

I had to (!) replace these glyphs ⚡ ⌚ with these ones ⋮ ⌬ on my setup.

That's actually a concerning issue.
It's a bug in PuTTY/KiTTY v0.70 (v0.69 works fine), I reported the bug to the PuTTY team.

The point is that with the wrong reported width, label rendering was off.
Since this issue doesn't relate to the actual chars, that means any user can experience such rendering problems with any (?) multibyte chars and we can't really do much about it, only telling them to change those and recompile the client.

D. Other small changes

a. column rendering changes

  • header text is also chopped by the length defined in the header
    • user can enter more chars than the specified length otherwise and it'd cause wrong label rendering
  • column labels and their values are updated to the proper length to not to confuse users

b. fixing rendering issue with name column

  • if the width of the canvas (terminal) was smaller then the width of defined columns then the name of download overwrote all the other info in the same line

c. changing width of couple of old columns

d. fixing old coloring issue

  • characters in tracker labels were colored (due to the colored columns) if canvas was small
    • this commit fixes it, by
      • modifying decorate_download_title method
      • and moving the calling of decorate_download_title method to the end of the coloring section
  • this line isn't needed since it's overridden by this

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

I added section D.d. above. This was the last change I wanted to make.

So, what do you think about the name of the above new commands in section B.?
Do I have to change them, or is it good with you? It's up to You entirely, let me know what you think :)

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

OK, I released it:

C. Replacing couple of glyphs

It turned out that it's not a tmux issue but it's a bug in PuTTY/KiTTY v0.70 (v0.69 works fine), I reported the bug to the PuTTY team.

from rtorrent-ps.

pyroscope avatar pyroscope commented on June 4, 2024

Example for custom columns with custom colors (subject to change):

ui.color.custom2.set = "bright green"

method.insert = _pyro.middot_custom2, private|simple, \
    "ui.canvas_color.set=$ui.color.custom2.index= ; cat=\"  · \""
method.set_key = ui.column.render, "900:4C21/3C2/1: Σ⇈ ",\
    ((if, ((d.up.total)), \
        ((convert.human_size, ((d.up.total)), (value, 10))), \
        ((_pyro.middot_custom2)) \
    ))

method.set_key = ui.column.render, "910:4C21/3C2/1: ✇  ", \
    ((convert.human_size, ((d.size_bytes)) ))

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

method.insert = _pyro.middot_custom1, simple, "ui.canvas_color.set=22 ; cat=" · ""

I've been thinking about this as well while I've been backporting the feature:

  • can't we use just the already defined colors for that?
    • instead of setting the actual color here, it could come from the the above color definitions

It would be generalized if:

  • e.g. _pyro.middot_custom1 will include only the color(s) info (using similar thing like with string.map):
    • method.insert = _pyro.column_color.status_tied, simple, "{ui.color.incomplete}"
  • problem is that we can have multiple color definitions for cols that have more than 1 char in it e.g. Downrate column
    • so in _pyro.column_color.* we could define multiple color values if we want and the rendering would apply them to every chars in the given order, e.g. using Downrate column for only time value when seeding (in this case we need 5 colors):
      • method.insert = _pyro.column_color.up_time_seeding, simple, "{ui.color.info, ui.color.seeding, ui.color.info, ui.color.info, ui.color.seeding}"
      • if only 1 color is given then it will apply to all the chars in the column
      • if more than 1 but less then 5 is given e.g. 3, then we can just colorize the first 3 chars in the column
      • if more then 5 is given then we just dismiss the rest that isn't needed
    • and the tricky part would be to apply the different conditions to a given column, something like you suggested:
      • either creating a new method for the condition that will return back the defined color defs _pyro.column_color.*:
        • method.insert = _pyro.color_cond.up_rate_time, simple, "branch= ... , _pyro.column_color.up_time_seeding, ... , _pyro.column_color.up_time_leeching, ... ... ... ..."
        • and apply to the col rendering: method.set_key = ui.column.render, "900:4: Σ⇈ ", ((if, ((d.up.total)), ((convert.human_size, ((d.up.total)), (value, 10))), ((_pyro.color_cond.up_rate_time)) ))
      • or if it's just simple color def without any condition then we could just add the color def itself at the end as you suggested

I know it's freaking complicated, but if it could work like this that would be the real killer feature! :)
And, as usual, thanks!

from rtorrent-ps.

pyroscope avatar pyroscope commented on June 4, 2024

@chros73 giving up on dynamic colors for now – the example at the top should work, but doesn't (color is always the dynamic one from the render call). Maybe you can find out what's wrong.

from rtorrent-ps.

chros73 avatar chros73 commented on June 4, 2024

giving up on dynamic colors for now

No worries at all. It's not really important for me:

  • I like the idea of theming (although noone else seems to really care about it, apart from us :) ), and if it's not implemented properly then theming will be screwed (maybe I'll take a look how these 4 season ones look with ps :) )
  • too much color can be too much :) , although I like the scraping/peers color change (maybe the 2 yellow could be swapped)

Later we can get back to it if we feel the need for it, but:

  • I have been thinking about what other columns we would need (by looking at other clients) and I couldn't come up any of them :) , it's really informative as it is now
    • only a "remaining time/last xfer" column popped in my mind but Only when something is being leeched, but I'm not sure about this one either, so I haven't done it in my setup project (could be dynamically visible/hidden)
    • the only reason is why I think custom columns is great because the terminal size can be small sometimes (e.g. with mobile devices in portrait mode), so visibility of non critical columns can be toggled

So built-in colorizing isn't a problem, at least that's what I think.

You can go through/grab what I did (do a diff), along the documentation, and make a release, it's well worth it. :)

Maybe you can find out what's wrong.

If You, The Master couldn't then it's a slight chance that I can. :) Anyway I'll take a look when I'll have time and I'll be in the mood for it. Create a branch for it for reference, please.

And as I said earlier, thanks for the brilliant idea and the clever, clean implementation, I'd have never thought of this by myself!

from rtorrent-ps.

pyroscope avatar pyroscope commented on June 4, 2024

Done-done now with the canvas config, time display is "up rate / leech time", and "down rate / completion or loaded time" (with "leech = completed - (started or loaded)").

from rtorrent-ps.

pyroscope avatar pyroscope commented on June 4, 2024

With the upcoming change, minimum usable terminal size is 40×15 (usable = no strange overlaps).

The footer and item panels are pretty useless though at that size. A full footer needs 117 chars. See #85.

I guess we can call rT-PS ‘responsive’ now. 😼

from rtorrent-ps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.