Notification not working

General support for problems installing or using Deluge
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

Recently dakkar posted in my submitted ticket about this, that he suspected it was because one of the function-calls expected a list instead of dict, so I took a look and experimented some, but however always have problems personally with said function-call referenced when having played with it for other reasons before myself, as always returns deferred object, a twisted object like a pointer/handle I guess, instead of the right value, and so I guess I have to add a callback or whatever(sorry being noob at this :) ), and reason for me changing the function-call to other one from api which doesn't use deferred objects, and so I decided to do the same here, and so I used another function call that only returns name and changed the mail template to not try output the missing value(number of files in torrent, though probably another call could be added for that too, presumably, but personally don't really see that as important, though also not using this plugin myself even either), so now it works but only output's name of torrent as torrent info in mail and not number of files. Thanks again dakkar for giving the clues to fixing(well, workarounding) it :)

https://paste.c-net.org/QumarTrolley (EDIT: updated link)

It can be either placed just in the 'plugins' folder of your deluge-profile folder, which takes precedense over the included version, or can also be directly overwritten old file with the new if wanted.

I tested this with a gmail account, selecting ssl with port 587, and got a mail first from google about an unsecure app trying to access my google account, and then after enabling access to unsecure apps in google account settings, then I got the proper mail upon finished download.
Last edited by mhertz on Mon Jan 04, 2021 8:50 pm, edited 1 time in total.
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

@mhertz

If I just put in the plugins folder and restart Deluge, how do I know that deluge will be using your updated version?
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

I just tested that it worked, and after deleting it, it didnt(so no mail gotten upon finished download), so that plugins folder under appdata takes precedence seemingly. I tested also before that with direct overwriting btw.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

It's fine to overwrite instead, if wanted, e.g on my distro it's under:

'usr/lib/python3.9/site-packages/deluge/plugins/Notifications-0.3-py3.9.egg'
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

I tried putting it in the plugins folder and configuring Gmail (I don't have app security enabled) but it still doesn't work.
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

I also tried replacing the egg file in /usr/lib/python3/dist-packages/deluge/plugins and it still doesn't work.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

Damn, I apologize, you're right :( I fixed and tested it working on my win10 VM, as have the GTKUI there already and had just did some work there anyway to help another user out, this was in my unofficial 2.0.3 and 2.0.4.dev38 installers. For some reason it doesn't work in linux, but perfectly in windows??? I will look more into it and post back if finding a solution and if not, then again, i'm sorry for getting ahead of myself.

Btw, for others interested, this is the error on linux with the changed version:

Code: Select all

18:00:43.856 [DEBUG   ][deluge_notifications.core         :177 ] Handler for TorrentFinishedEvent called for CORE
18:00:43.856 [DEBUG   ][deluge_notifications.core         :78  ] Spawning new thread to send email with subject: Finished Torrent "debian-10.7.0-amd64-netinst.iso": This email is to inform you that Deluge has finished downloading "debian-10.7.0-amd64-netinst.iso".
To stop receiving these alerts, simply turn off email notification in Deluge's preferences.

Thank you,
Deluge.
18:00:43.856 [DEBUG   ][deluge_notifications.common       :47  ] Calling CORE custom blink providers for TorrentFinishedEvent: ('cb6ecbc1853e57124937757967abad3fd136fe57',) {}
18:00:43.856 [DEBUG   ][deluge_notifications.core         :98  ] Email prepared
18:00:43.857 [DEBUG   ][deluge_notifications.common       :47  ] Calling CORE custom sound providers for TorrentFinishedEvent: ('cb6ecbc1853e57124937757967abad3fd136fe57',) {}
18:00:43.858 [DEBUG   ][deluge_notifications.common       :47  ] Calling CORE custom popup providers for TorrentFinishedEvent: ('cb6ecbc1853e57124937757967abad3fd136fe57',) {}
18:00:43.858 [ERROR   ][deluge_notifications.core         :128 ] There was an error sending the notification email: [Errno -2] Name or service not known
And on windows, it's same debug-log with just the last error-line replaced with the following success line:

Code: Select all

18:20:06 [DEBUG   ][deluge_notifications.common       :65  ] Notification success using email: Notification email sent.
@others, as stated above, the link only works on windows and deluge2 there, either built yourself or from my unofficial installer - sorry.

Edit: There's no special ifdef windows/linux code, and online several reports about code-sections utilizing smtplib(like here) works fine in windows, but fails on linux, and/or vice-versa. It's even exact same python version on both ends in my system and VM - 3.9.1, and same deluge version - 2.0.4.dev38 and same network as bridged in VM.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

Update - sorry I was a moron seemingly(not biggest surprice neither but whatever ;) ) and my fixed version of plugin works fine in both linux and windows, and after much digging e.g. setting up own smtp localhost server for sniffing transfered data, I noticed I stupidly had set my own email address as smtp server on linux, but not windows where it was correct - doh! :)

So the link provided can be downloaded and used by all, but the trick of just placing it in deluge profile plugins folder(as taking precedense) does only work on windows, so on linux, you either need to replace original file, or delete it/rename-it-to-not-end-in-egg and then add it to deluge profile plugins folder(or as said before, just at original place).

@kevindd992002 - I'm sorry it doesn't work for you - can you please make a debug run and post error line(s) here, thanks.

@all, the plugin I uploaded is build from develop deluge-branch, but still works for stable deluge 2.0.3 also. Btw, this is the default path of plugin in latest ubuntu I just looked-up as probably the most popular i'm guessing: '/usr/lib/python3/dist-packages/deluge/plugins/Notifications-0.3.egg' (like kevindd992002 posted also before).
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

Here you go:

Code: Select all

Line 395: 11:03:57 [DEBUG   ][deluge_notifications.core     :212 ] ENABLING CORE NOTIFICATIONS
	Line 5993: 11:11:34 [DEBUG   ][deluge_notifications.common   :52  ] Calling CORE custom email providers for TorrentFinishedEvent: ('5fff0e1c8ac414860310bcc1cb76ac28e960efbe',) {}
	Line 5994: 11:11:34 [DEBUG   ][deluge_notifications.common   :56  ] Found handler for kind email: <bound method CoreNotifications._on_torrent_finished_event of <deluge_notifications.core.Core object at 0x7f30283acef0>>
	Line 5994: 11:11:34 [DEBUG   ][deluge_notifications.common   :56  ] Found handler for kind email: <bound method CoreNotifications._on_torrent_finished_event of <deluge_notifications.core.Core object at 0x7f30283acef0>>
	Line 5995: 11:11:34 [DEBUG   ][deluge_notifications.core     :177 ] Handler for TorrentFinishedEvent called for CORE
	Line 5996: 11:11:34 [DEBUG   ][deluge_notifications.common   :116 ] Notification failure using email: [Failure instance: Traceback: <class 'KeyError'>: 'name'
	Line 5999: /usr/lib/python3/dist-packages/deluge/plugins/Notifications-0.3.egg/deluge_notifications/common.py:70:wrapper
	Line 6000: /usr/lib/python3/dist-packages/deluge/plugins/Notifications-0.3.egg/deluge_notifications/common.py:58:_handle_custom_providers
	Line 6003: /usr/lib/python3/dist-packages/deluge/plugins/Notifications-0.3.egg/deluge_notifications/core.py:181:_on_torrent_finished_event
	Line 6010: /usr/lib/python3/dist-packages/deluge/plugins/Notifications-0.3.egg/deluge_notifications/common.py:70:wrapper
	Line 6011: /usr/lib/python3/dist-packages/deluge/plugins/Notifications-0.3.egg/deluge_notifications/common.py:58:_handle_custom_providers
	Line 6014: /usr/lib/python3/dist-packages/deluge/plugins/Notifications-0.3.egg/deluge_notifications/core.py:181:_on_torrent_finished_event
	Line 8917: 11:16:06 [DEBUG   ][deluge_notifications.core     :215 ] DISABLING CORE NOTIFICATIONS
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

I'm sorry, I cannot reproduce your issue, so cannot troubleshoot further unfortunetly. I just tested also on latest ubuntu regular(20.10) and LTS(20.04.1), from there livecds I quickly downbloaded and ran in VMs, both working fine with my fixed version, so now have verified it on arch-linux, win10 and ubuntu latest regular and LTS. I know you're using a docker setup, LSIO, but have never messed with such myself(and just now it's ubuntu-based if not mistaken).

Last thing, could you remove the fixed version, and also delete or rename original Notifications-0.3.egg to not end in '.egg', restart deluge and check that there's no Notifications plugin available in the plugin list of deluge settings, and then add the fixed version, restart deluge and test again - Just to make sure that you are using the correct plugin - E.g. I saw on the ubuntu's that there where several python folders under '/usr/lib' e.g. 'python3' and 'python3.8' etc, so I wanted to make sure you didn't have replaced the file onto some old/other leftover install-files or something.

Btw, this is my notifications-core.conf from deluge profile folder, with just mail-address and password removed:

Code: Select all

{
    "file": 1,
    "format": 1
}{
    "smtp_enabled": true,
    "smtp_from": "",
    "smtp_host": "smtp.gmail.com",
    "smtp_pass": "xxxxxxxxxx",
    "smtp_port": 587,
    "smtp_recipients": [
        "foo@gmail.com"
    ],
    "smtp_tls": true,
    "smtp_user": "foo@gmail.com",
    "subscriptions": {
        "email": [
            "TorrentFinishedEvent"
        ]
    }
}
Other than this, then i'm out of ideas :(
Post Reply