Remove files before executing script

General support for problems installing or using Deluge
Post Reply
vidyava
New User
New User
Posts: 2
Joined: Sun Apr 16, 2023 9:07 pm

Remove files before executing script

Post by vidyava »

Hello,
I've recently updated to Deluge 2.0 from an old 1.3 instance, and found that the behavior of "Remove with Data" relative to the Execute plugin's "Torrent Removed" call seems to have changed. Previously, it would remove the data and no script would be executed (or would attempt to execute second), but now the script seems to execute first. I can understand why this would be desired, but I'm hoping someone knows of a means to replicate the old behavior. As far as I can tell, the script call doesn't have any way to discern whether the torrent was just removed or removed with data.

My use case has two situations:
1. Something Sonarr downloaded, which has been automatically copied to the correct folder and the original can just be deleted when seeding is done.
2. Something manually downloaded, which should be moved to the correct folder by a script once seeding is done and it's manually removed.

Previously, "Remove with Data" covered situation 1, and "Remove Torrent" with a move script called on "Torrent Removed" covered situation 2. Now both options call the move script and copy the data. Does anyone know of a workflow/script that could handle this problem?

Thanks
User avatar
ambipro
Moderator
Moderator
Posts: 444
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Remove files before executing script

Post by ambipro »

I'd suggest you look into utilizing hardlinking if possible to remove the need for duplicating data across your setup, you can find a guide @ https://trash-guides.info/Hardlinks/Har ... ant-Moves/ and googling about hardlinks will explain what they do (essentially two locations pointing to the same data on a file system)

You would be able to seed and have the movie imported into plex/jellyfin and *arr, by *arr automatically with only one set of the data used on disk. You would be able to seed this indefinitely, if you so chose, or delete the torrent from your torrent client and it would not affect your other references to the data until all references were then removed - at which point the data is THEN considered abandoned and is deleted from the file system.

This is the ideal setup for torrenting with *arr, and takes a bit of learning and configuring, but moving torrent files and having duplicates is unnecessary with such a setup.

I can't give you much help with your question otherwise, but I recommend you look into this if you haven't already or have some reason it wouldn't work (there are a few instances that hardlinking isn't possible, across drives, on certain NAS setups, etc) - but it's worth investigating and implementing wherever possible in my opinion.

Good luck.
vidyava
New User
New User
Posts: 2
Joined: Sun Apr 16, 2023 9:07 pm

Re: Remove files before executing script

Post by vidyava »

I unfortunately can't use hardlinks due to some of the moving taking place across an NFS mount (and also due to some downloads being directories I'd like to keep intact), but I appreciate the info all the same. My issue also isn't so much that things are taking up twice the space, it's that I end up with some things that are already organized by Sonarr alongside some things that aren't organized at all and I have to go through double checking which is which (for the non-obvious cases) before deleting anything.

I was hoping there was a way to just pass either the remove/delete intention to the script, or pass labels to it, but in digging into that possibility I found out you can set completed folder based on label, so now I'm just specifying a Sonarr-specific completion folder based on label and then if the torrent removal script detects that path it'll just remove the files too.
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Remove files before executing script

Post by mhertz »

There's nothing changed in execute plugin regarding this(between latest 1.x and current), so must be something else affecting this in either deluge or libtorrent, regarding event signaling properties/timing(as script also would be tried run in 1.x).

Possibly I could hack the execute plugin to pass the remove_data bool over(if possible from plugin only, which I'm not even sure about honestly), as an extra var available to our script, but as you already fixed your own issue(kudos btw :)), plus I don't really know how prevailant this issue really is for people, then I have not really delved into it myself honestly.
Post Reply