bdutro / deluge-labelplus

24 stars 7 forks source link

Magnets added with a label have the label removed when magnet metadata is received #7

Open sammys opened 3 years ago

sammys commented 3 years ago

When on_torrent_added is executed and there is a pending label the label is set correctly. Unfortunately, when the recently added on_torrent_metadata_received is handled it calls on_torrent_added again. On this second call the autolabel value is used whether it is ID_NONE or not. The on_torrent_added handler was not originally designed to be called twice for the same torrent.

This PR makes it possible for it to be called twice. First time it'll use the pending label. Second time it'll use an autolabel only if it is not ID_NONE.