Page 1 of 1

Monitor a read-only folder with torrents and act only as a seeder

Posted: Mon Apr 24, 2023 9:40 pm
by pipe
I'm sharing files from my server using bittorrent and I want to use Deluge to automatically seed all valid torrents but I can't quite get there the way I think would be optimal.

Basically I'm looking to use Deluge as the "origin" in the BitTorrent Protocol Specification:
Bram Cohen wrote: To start serving, a host goes through the following steps:
  1. Start running a tracker (or, more likely, have one running already).
  2. Start running an ordinary web server, such as apache, or have one already.
  3. Associate the extension .torrent with mimetype application/x-bittorrent on their web server (or have done so already).
  4. Generate a metainfo (.torrent) file using the complete file to be served and the URL of the tracker.
  5. Put the metainfo file on the web server.
  6. Link to the metainfo (.torrent) file from some other web page.
  7. Start a downloader which already has the complete file (the 'origin').
This means I already have the files and torrents, and ideally I would Deluge to automatically pick these up when added, and to stop seeding when removed.

I tried using AutoAdd but I could not get it to work in a way that leaves the torrent files intact. That is, I would like it to monitor a folder with torrents for changes instead of taking ownership of a folder (the exposed server only has read-access to the served files).

Can anyone figure out a way to do this with Deluge?

Right now I have to use rTorrent which can be configured to do exactly this:

Code: Select all

schedule2 = auto_load,10,10,((load.start,(cat,(cfg.torrents),"*.torrent")))
schedule2 = untied_directory,11,10,remove_untied=
But rTorrent is clumsy to work with and I would rather use Deluge which I'm more comfortable with. I'm almost considering trying to write my own plugin, but it's a bit of a threshold. Likewise, I would like to avoid external cronjobs and scripts, and I'm not even sure that I could get Deluge to stop seeding that way.

Re: Monitor a read-only folder with torrents and act only as a seeder

Posted: Mon Apr 24, 2023 11:28 pm
by ambipro
I'm not entirely sure about exactly the details of the features you are asking about (forgive me) but if I understand correctly then the following should address some of this...

AutoAdd plugin does not have the ability to remove torrents from deluge based on whether not a .torrent file is persistently in a folder. After it is "picked up" by the plugin, it is added to the client and a copy is placed in the "state" folder in your config folder, and data about it's status is written to a state file. After this, the .torrent file's presence in the "watch" folder is irrelevant as far as I am aware.

I also don't believe there are any plugins that would accomplish this task, if I understand correctly, but it could be accomplished with a few simple webUI or console commands (using curl or console) alongside deleting the .torrent file, either as scripts in deluge custom plugin, perhaps, or natively in whatever program triggers the deletion of your files.

Also, not sure if this matters, but deluge having read-only access to the original location where .torrent files are loaded from also is fine. These watched folders are really only relevant, as far as I'm aware, when a new file is added to the directory being watched, and then it is read and that's it.

Not sure if this helps much, but figured i'd chime in.

Re: Monitor a read-only folder with torrents and act only as a seeder

Posted: Wed Apr 26, 2023 5:02 pm
by pipe
Thanks, I think you got exactly what I wanted, and you seem to confirm what I found. I've since realized that I still need to modify or copy my shared torrent files anyway so the built-in AutoAdd would work. I also realized that if I delete my torrents, the tracker will stop tracking them and Deluge will show them as Error, making them very easy to find and manually remove.

Re: Monitor a read-only folder with torrents and act only as a seeder

Posted: Wed Apr 26, 2023 8:51 pm
by ambipro
Something to note, and @mhertz may correct me on this as I may be wrong and this is speculation, when you delete the data of a torrent that is currently seeding, until it is attempted to be read and found to be missing (or the torrent client is restarted) the torrent will remain "Seeding"...so that's not an instant indicator.

As I said, if you have a script or program deleting the torrent files, look into using external calls (such as curl or webUI) to delete the torrent from deluge as well if possible. It may not be super simple, but it should be possible.