Closed lenormf closed 4 years ago
Thank you for the first serious contribution! The code looks great.
I'll pull tomorrow and try to find bugs.
I haven't run this branch for an extended amount of time. I ran make test
on my own system, and tested connecting to the daemon initialized as follows:
# No incomplete directory enabled
$ transmission-daemon -T -w ~/Downloads --no-incomplete-dir
# Two different download directories filesystems/sizes
$ transmission-daemon -T -w ~/Downloads --incomplete-dir /tmp
It works almost perfectly. I found only one bug.
With srv.path.incomplete being disabled initially:
Can you fix that?
I also increased the spacer between the free space and the torrent counters and I added labels so you know what those numbers say. I hope that's alright with you.
I've also added a hook that polls from srvapi.freespace every time the relevant settings are set.
Thanks again. Great work.
No problem! I will look into the bug.
I don't mind the cosmetic changes. Just hoping that the widget will behave well if the download path looks ugly or is very long.
Regarding the hooks on the path settings, don't we want to implement skip_ongoing_request()
on FreeSpaceAPI()
, so that we can interrupt any pending updates before we force a poll? It's not clear to me whether RequestPoller.poll()
does that by default already.
Calling RequestPoller.poll()
doesn't actually perform a request, it just cancels the
sleep()
in the endless loop.
But you might be right. Actually, you might have found that heisenbug I've pretty much given up on where opening a torrent list in a new tab doesn't populate the list until the next poll interval.
You've set 1024 bytes as the threshold before the free space display becomes highlighted. That seems very low. Any particular reason for that number?
I would also like to make this configurable with a setting, e.g. "tui.free-space.low". Would you like to implement that or should I do it?
I just wanted the threshold to represent space within which no meaningful amount of data could possibly be stored, instead of a boring 0.
Feel free to tweak the number and implement a new option, I don't know when I'll come back to this PR yet.
OK. I can also fix the bug I mentioned previously if you're busy. No problem.
This commit adds a widget in the bottom bar that displays the amount of space left in the download directory.
A new poller is implemented that queries the path to the download directory from the Transmission daemon, and sends it back in a standard "Free Space" query[1].
If the "incomplete download directory" feature is not disabled and is different than the regular download directory, it will also be displayed (separated from the other number with a slash).
Both numbers are pretty printed (e.g. "1KB" instead of "1024"), and tagged as "important" when below 104 bytes.
[1] https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt#L603
Fixes #146