browser magnet links suddenly opening in paused state

General support for problems installing or using Deluge
Post Reply
meeotch
New User
New User
Posts: 6
Joined: Fri Jul 27, 2018 8:04 pm

browser magnet links suddenly opening in paused state

Post by meeotch »

As of a couple of days ago, when I click on a magnet link in firefox, the torrent is added to deluge in paused state. Strangely, normal .torrent links are added in running state.

I've confirmed multiple times that the "Add in Paused State" toggle is *OFF* in the preferences, and that it comes up in the OFF state in the Options tab of the Add Torrents dialog that pops up when I click on a magnet link. I've even tried turning it on, adding a link, then turning it off again and adding a link. Also tried updating to the latest version.

Why are magnets and .torrents acting differently, when there's only a single preference? And is there somewhere in a config file or registry key that I can check?

This is for a client running on Windows 10, connecting to a deluged running on a remote ubuntu system.
mhertz
Moderator
Moderator
Posts: 1198
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: browser magnet links suddenly opening in paused state

Post by mhertz »

Sorry, never heard of this or understand how it could happen??? So you have tried adding a torrent which didn't have this issue after having had the issue repeatedly with magnets? If adding a magnet/torrent of a file already downloaded, then it will say paused, but that shouldn't be a magnet vs torrent issue either.

Please add a magnet and then a torrent and then post the log thanks. You run with logging enabled by e.g. 'deluged -L debug -l deluged.log'. Other then that, I would try cleaning my profile out if possible and also reinstall possibly.
meeotch
New User
New User
Posts: 6
Joined: Fri Jul 27, 2018 8:04 pm

Re: browser magnet links suddenly opening in paused state

Post by meeotch »

So it looks like the error is in the "No Folder" plugin, which I added in order to force single-file torrents to create subfolders for themselves.

[ERROR ] 00:15:27 eventmanager:59 Event handler TorrentAddedEvent failed in <bound method Core.post_torrent_add of <nofolder.core.Core object at 0x7f03ec3d0f10>> with exception list index out of range

The code is pretty short, and though I haven't had time to download and compile it locally so that I can debug, but my guess is that maybe it's dying when it attempts to loop over the files in the torrent, since that info isn't available in a magnet link, and that breaks the torrent submission process somehow, causing it to show up as paused?

https://github.com/tillkrischer/nofolde ... er/core.py
mhertz
Moderator
Moderator
Posts: 1198
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: browser magnet links suddenly opening in paused state

Post by mhertz »

You're correct! :) I see the code always sets a torrent on pause while processing metadata and then resumes when finished, but as you stated no metadata is available initially to process for magnets, hence the stall and no resume happening.

Anyway, I fixed the plugin to work with magnets too, so here's a fixed py2.7 build of NoFolder v0.2:

http://s000.tinyupload.com/index.php?fi ... 1049894439

Fix in patch format:

https://gist.github.com/mhertz/f30eedaa ... a815633b16
meeotch
New User
New User
Posts: 6
Joined: Fri Jul 27, 2018 8:04 pm

Re: browser magnet links suddenly opening in paused state

Post by meeotch »

Thanks for the attempted fix. Unfortunately, it didn't seem to work on my end. For now, I've just disabled the plugin, and re-written some of my other scripts to not rely on the functionality it provides. If I find time to dig into it further, I'll post an update here.
mhertz
Moderator
Moderator
Posts: 1198
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: browser magnet links suddenly opening in paused state

Post by mhertz »

Ohh, i'm sorry, it worked in my testing and for another user here.

There was the same issue in LabelPlus and I remember the author stated when I asked him about it, that he would add a delay when he had time to fix it but never got to it, so I found the right place and added a delay and it worked, and so I did the same with this plugin which worked in my tests. In LabelPlus I just used 1 sec, as that worked in my tests, but didn't in this for some reason, but 2 secs worked in my tests here(I worked my way down from 5 secs to 2 successfully), so I left it at that. I can up the delay if you want(or you can try yourself - see patch).

(I also looked into hooking on libtorrent's metadata-downloaded alert, instead of simply using a static delay, but read that no such alert is triggered for torrents only magnets, so I then would have to also check if it was a magnet first, and since Ratanak also stated just to add a delay, then I just did that)

Edit:

Here's my install-script of this plugin which I just modified for optional variable delays, so just run 'bash nofolder-install [delay]', where delay is delay in seconds(if omitted, a default of '2' is used as per my testings), and the preceding 'bash' is just so you don't need to 'chmod +x' it first. It can be run multiple times with no ill effect for testing different delays and you don't need deleting the previous NoFolder plugin beforehand as it's overwritten.

nofolder-install:

Code: Select all

#!/bin/bash

git clone https://github.com/tillkrischer/nofolder.git
[ -z "$1" ] && set 2
sed -i 's|import re|import re\nfrom time import sleep|' nofolder/nofolder/core.py
sed -i "s|torrent = self.torrents\[torrent_id\]|torrent = self.torrents\[torrent_id\]\n        sleep($1)|" nofolder/nofolder/core.py
cd nofolder
python2 setup.py bdist_egg
cd -
cp nofolder/dist/* ~/.config/deluge/plugins
rm -rf nofolder
pgrep deluged || deluged
deluge-console "plugin -e NoFolder; halt"
Depending on distro, 'python2' could be needing replaced with 'python'(if 'python2' is default instead of 'python3')

'curl' instead of 'git':

Code: Select all

curl -L https://github.com/tillkrischer/nofolder/archive/0.2.tar.gz | tar xz; mv nofolder{-0.2,}
'wget' instead of 'git':

Code: Select all

wget -O- https://github.com/tillkrischer/nofolder/archive/0.2.tar.gz | tar xz; mv nofolder{-0.2,}
meeotch
New User
New User
Posts: 6
Joined: Fri Jul 27, 2018 8:04 pm

Re: browser magnet links suddenly opening in paused state

Post by meeotch »

Very cool - thanks.
Post Reply