[Plugin] Fixed deluge2-included AutoAdd plugin
Posted: Wed Jun 23, 2021 7:10 pm
As title, untill Cas fixes it, then this is a fixed version of the included AutoAdd plugin of deluge2, which recently broke magnet support in 2.0.4.dev56, used e.g. on arch-linux and binhex dockers etc, but had issues also before(e.g deluge 2.0.3) where labels not applied for magnets and .magnet files renamed .invalid.
I previously posted a version in other thread, which just unbroke magnet support of dev56 but left the other issues unfixed, but this here is full fix for all deluge2 versions, so no .magnet files labeled .invalid anymore for no reason, is correctly deleted/renamed after adding, and labels work again for them.
The issue btw was that add_torrent_magnet() isn't returning a defered object like add_torrent_file_async(), so the scheduled deferred of magnets never ran and error'ed out with attribute-error(as the returned torrent_id string didn't have no addCallback attribute i.e. not a deferred), and disables watchdir. Pre-dev56, then on_torrent_added() never called for magnets, and so at next poll-interval would try readd, fail and hence rename .invalid. Anyway, so I changed the call for magnets from a twisted addCallback into instead direct function call, and added the addCallback/addErrback only for torrents and not magnets, making magnets and labels work again. I reported this to Cas on bugtracker also.
Just drop into your deluge profile's plugins folder, restart deluge, and it will take precedense over the included version. I also upped version from 1.8 to 1.9 and changed entry-points needed for taking precedence also on dockers.
AutoAdd-1.9.egg
Edit: Rebuilt using Cas' official fix from develop branch, and so only need my rebuild if using under 2.0.4.dev57.
I previously posted a version in other thread, which just unbroke magnet support of dev56 but left the other issues unfixed, but this here is full fix for all deluge2 versions, so no .magnet files labeled .invalid anymore for no reason, is correctly deleted/renamed after adding, and labels work again for them.
The issue btw was that add_torrent_magnet() isn't returning a defered object like add_torrent_file_async(), so the scheduled deferred of magnets never ran and error'ed out with attribute-error(as the returned torrent_id string didn't have no addCallback attribute i.e. not a deferred), and disables watchdir. Pre-dev56, then on_torrent_added() never called for magnets, and so at next poll-interval would try readd, fail and hence rename .invalid. Anyway, so I changed the call for magnets from a twisted addCallback into instead direct function call, and added the addCallback/addErrback only for torrents and not magnets, making magnets and labels work again. I reported this to Cas on bugtracker also.
Just drop into your deluge profile's plugins folder, restart deluge, and it will take precedense over the included version. I also upped version from 1.8 to 1.9 and changed entry-points needed for taking precedence also on dockers.
AutoAdd-1.9.egg
Edit: Rebuilt using Cas' official fix from develop branch, and so only need my rebuild if using under 2.0.4.dev57.