Pomoc 2 suggestions to improve rTorrent

altaroinj

Passing Basics
Beginner
31 Marzec 2018
14
1
3
43
QNAP
TS-x53
Ethernet
1 GbE
Hello all,

first of all, and I may repeat myself, thanks again for rtorrent. It's one of the few apps I did not hesitate to pay for, and I don't regret it.

Then, I would like to suggest @Silas Mariusz 2 things to improve.

1. If it's not possible to automatically backup main configuration page at each stop/start of the app for example, do you think we could have a way to export/import it ?
Because, each time the app is updated, we need to reconfigure everything as the configuration is reset to default.

2. I use the feature that allows me to execute script on finished downloads. I use it mainly for sending notification on my phone using pushover service (I can share my script if someone wants to do the same).
But, rtorrent handles a lot of event types and some I would like to use too.
So I renamed "_event.download.finished" into "_event.download", and modified it in order to be able to do the same, but for all event types.
You can find it attached to the thread (with sh extension because otherwise it was not accepted).
Just to explain, I only set the 3 first arguments as mandatory, because for inserted* events there is no path yet for the downloaded file.
And I splitted log files (one by event type) as differrent event types can occur at the same time and logs of executed scripts would be mixed between each other if I hadn't.
I kept the main log file for debug purpose (if the DEBUG variable is set to 1).

So with this new script, I modified "rtorrent/etc/rtorrent.conf" in order to comment the line :
Kod:
# method.set_key = event.download.finished,bash_handlers2,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download.finished\"),$d.hash=,$d.name=,$d.base_path=,$d.custom1="

And I added these lines instead :
Kod:
method.set_key = event.download.closed,closed_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),closed,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.erased,erased_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),erased,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.finished,finished_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),finished,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.hash_done,hash_done_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),hash_done,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.hash_queued,hash_queued_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),hash_queued,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.hash_removed,hash_removed_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),hash_removed,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.inserted,inserted_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),inserted,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.inserted_new,inserted_new_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),inserted_new,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.inserted_session,inserted_session_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),inserted_session,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.opened,opened_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),opened,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.paused,paused_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),paused,$d.hash=,$d.name=,$d.base_path=,$d.custom1="
method.set_key = event.download.resumed,resumed_bash_handler,"execute.nothrow.bg=(cat,(cfg.scripts),\"_event.download\"),resumed,$d.hash=,$d.name=,$d.base_path=,$d.custom1="

Everything worked as expected.

My question now is, do you think @Silas Mariusz that these enhancements could be part of one of your further release (in order to avoid resetup everything after each update) ?

Thanks in advance for your response.

Firmware version: 4.4.2.1270 Build 20200410
Model name: QNAP TS-253Pro
 

Załączniki

  • _event.download.sh
    1,7 KB · Wyświetleń: 60
1. If it's not possible to automatically backup main configuration page at each stop/start of the app for example, do you think we could have a way to export/import it ?
Because, each time the app is updated, we need to reconfigure everything as the configuration is reset to default.
FYI: There are plans to rewrite settings panel and use qpkg.conf to store all settings including user accounts. However I discovered that QNAP sometimes is overwriting qpkg.conf with old backup config. Until this thing is not solved by QNAP we cannot implement it. Stay tuned!

(I can share my script if someone wants to do the same).
Please share :)

My question now is, do you think
1.gif
@Silas Mariusz that these enhancements could be part of one of your further release (in order to avoid resetup everything after each update) ?
I like your idea with many types events. Honestly no one asked for this before, but my idea is to execute all these events from the scripts in subdirs like:
Rdownload\scripts\event.download.closed\_execute.script
Rdownload\scripts\event.download.erased\_execute.script
Rdownload\scripts\event.download.finished\_execute.script
...
Rdownload\scripts\event.download.resumed
So if you use same script for all events you will have to put it in each event directory. Is this okay?

I appreciate for your feedback.
Thank you!
 
Until this thing is not solved by QNAP we cannot implement it. Stay tuned!
In the meantime, could you tell me where the configuration is located in order to do a backup ?

my idea is to execute all these events from the scripts in subdirs like:
Kod:
Rdownload\scripts\event.download.closed\_execute.script
I didn't really understand what you mean. Do you mean that you will duplicate _event.download script for each event in a subfloder, and that script will handle all scripts in its subfolder ?
Or do you mean, you will have a single script _event.download at root scripts folder, that will execute all scripts located in subfolders according to event type that triggered it ?
I must confess, I prefer the 2nd solution, and in fact, you are right to think about subfolders because it would be more organized : log files at root folder, scripts in subfolders.
And we could also consider having a special subfolder in which scripts are executed for all events (in this case, first argument passed to the scripts would be the event type) :
Kod:
Rdownload\scripts\event.download.all\
If I have time today (especially because my wife said yesterday I spent too much time in front of my computer ;)), I will amend the _event.download script to process scripts in subfolders.

I will, I need to translate it first and remove my credentials
So here are the modified _event.download script that handles subfolders (including 'all' one) and my pushover.sh script (that I moved into download.event.all subfolder).
 

Załączniki

  • _event.download.sh
    2,6 KB · Wyświetleń: 55
  • pushover.sh
    1,2 KB · Wyświetleń: 52
What about the function to name all files of a torrent, while its in the process to be downloaded, in .Active or .name.Ext.Incomplete and once its finished, remove the extension after the real extension ? As an addon to the autotools function ?

Maybe one single point of Tag generation that holds all possible tag names, and also creates the subdirectorys in the Watch direcotry ?
 
What about the function to name all files of a torrent, while its in the process to be downloaded, in .Active or .name.Ext.Incomplete and once its finished, remove the extension after the real extension ? As an addon to the autotools function ?
You mean renaming files while are still incomplete?
For me this makes no sense and requires core changes.
 
What about the function to name all files of a torrent, while its in the process to be downloaded, in .Active or .name.Ext.Incomplete and once its finished, remove the extension after the real extension ? As an addon to the autotools function ?
You mean renaming files while are still incomplete?
For me this makes no sense and requires core changes.
No, files that are incomplete should have an extension that separates them from complete ones.
As i explained, once they are finished, even within a torrent in progress, finished files should get the additional extension (.incomplete) removed, so the finished files can be identified).
Now, all files already have their final name and extension, even while they are in progress to be downloaded.....

Clear ?
 
What about a script that checks all torrents in the que ?
Checks against torrents that can not be handled and errors and offers a script based way to resolve them ?
Log file check and guided cleanup ?
 
Are you using public trackers? Man try to switch to private trackers only and you will forgot about anything.
No access to private trackers..
And my download rates are quick for public as well.
So, unless i have access to private trackers (I seed many things for long time to keep them alive anyway), there is no other solution for me.

I do think many people might have the same problem, if not even most ?
 
Hello @Silas Mariusz ,

I’ve just received a notification regarding the new version of rtorrent-pro.
Does this version include the evolutions of events script we talked about ?
Or do I need to backup my scripts first before making the upgrade ?

Thanks.
 
Cool, thanks !
B-)
Hello @Silas Mariusz,
I’ve installed the version that includes the new scripts this WE.
And I noticed that you renamed the main script into _event.download.sh, but you forgot to update the rtorrent.conf file to reflect the new name.

Regards.