I am not much of a python coder. I have been using AI to try and help generate this, but so far no luck.
The problem is trying to protect from unsafe torrents. There is a rash of them going around.
See this for my /r post:
https://www.reddit.com/r/sonarr/comment ... _episodes/
Anyway, it is clear that Deluge is lacking the ability to restrict downloading certain file types.
I believe this can be rectified with a plugin.
The plugin logic needs to be:
1) On any torrent/magnet being added, wait until metadata is loaded (as we need to know the file list)
2) Search the files in the torrent for certain extensions (as defined in a UI for the plugin).
3) Once those files are found, set them to "do not download".
I'm fairly confident I can write a python script to enumerate all current running torrents and do actions #2/#3, however I don't know how to write a plugin that can monitor all newly added torrents.
I am hoping someone else sees the need for this (especially in light of the above /r post) and would work with me to create such a thing?
Assistance in writing a sorely needed security plugin.
Re: Assistance in writing a sorely needed security plugin.
It's not a plugin (yet), but here's a python script I'm using to accomplish the same thing: https://github.com/Yeraze/deluge_block
Re: Assistance in writing a sorely needed security plugin.
I saw your post over on Reddit as well. I've actually written my own solution to work with Sonarr. It's in two parts:
deluge-banned-files-rpc.py
https://gist.github.com/bengalih/1341b5 ... fca17ccbf8
sonarr-blacklist.py
https://gist.github.com/bengalih/bd80a9 ... a5b600c32c
The first script is what monitors added torrents. It works differently then yours as it doesn't run continuously, it waits for the metadata to load and then if a banned file is there it only pauses it (see next script). It can be modified fairly easily however to change behaviors.
The seconds script sends the paused torrent ID to sonarr to tell it to blacklist the file. In doing so Sonarr also removes it from deluge.
I've been running this close to 2 months and it is performing fantastically, I get on average 4-5 a week that get banned and blacklisted, and retried automatically.
I would still love for someone familiar with deluge plugin format to convert my first script into something that will run continually until the metadata is found and then act on the invalid files. Either pause, delete, or simply choose not to download the files that are banned.
deluge-banned-files-rpc.py
https://gist.github.com/bengalih/1341b5 ... fca17ccbf8
sonarr-blacklist.py
https://gist.github.com/bengalih/bd80a9 ... a5b600c32c
The first script is what monitors added torrents. It works differently then yours as it doesn't run continuously, it waits for the metadata to load and then if a banned file is there it only pauses it (see next script). It can be modified fairly easily however to change behaviors.
The seconds script sends the paused torrent ID to sonarr to tell it to blacklist the file. In doing so Sonarr also removes it from deluge.
I've been running this close to 2 months and it is performing fantastically, I get on average 4-5 a week that get banned and blacklisted, and retried automatically.
I would still love for someone familiar with deluge plugin format to convert my first script into something that will run continually until the metadata is found and then act on the invalid files. Either pause, delete, or simply choose not to download the files that are banned.