Notification not working

General support for problems installing or using Deluge
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

Ok, that worked :) You're the man!
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

Lol, thanks mate, appreciate the kind words, and thanks likewise for feedback and testing :)
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

@mhertz, now that this is fixed here: https://dev.deluge-torrent.org/ticket/3303#comment:7 , does that mean that I can use the official plugin moving forward?
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

Sure does :) Obviously needs using latest develop branch of deluge to have this commit included, though the fix provided is exactly the same fix as Cas previously posted here and I then included in my build, but in short, yes you're correct, and thanks again Cas.

BTW, I just rebuilt the plugin and updated my previous posted link, as there additionally have come an extra commit sometime ago fixing an issue for windows users, just in case anybody needs it.

Edit: Might as well repost link here, so people don't need read back a page:

Notifications-0.4.egg (Fresh git develop build, with added changed entry-points/dirname to take precedense on dockers also, where upped version number not enough, which done by Cas here in newest commit and not me anymore)

Edit2: If preferring a completely vanilla git develop build, as not using docker so my changes unneeded(upped version enough here, done by Cas's new commit), then despite not being an issue whatsoever using above still, then here's fully vanilla build instead:

Notifications-0.4.egg
zzznazt
New User
New User
Posts: 2
Joined: Thu May 05, 2022 11:14 am

Re: Notification not working

Post by zzznazt »

Got the notifications working after I followed this thread and update everything to the latest.

But recently found out that it seems not working when the torrent name have Chinese character.

I restart Deluge in debug and get the below, can anyone help?

Code: Select all

19:04:28 [DEBUG   ][deluge_notifications.common   :116 ] Notification failure using email: [Failure instance: Traceback: <class 'UnicodeEncodeError'>: 'ascii' codec can't encode characters in position 74-75: ordinal not in range(128)
/usr/lib/python3.8/threading.py:932:_bootstrap_inner
/usr/lib/python3.8/threading.py:870:run
/usr/lib/python3/dist-packages/twisted/_threads/_threadworker.py:46:work
/usr/lib/python3/dist-packages/twisted/_threads/_team.py:190:doWork
--- <exception caught here> ---
/usr/lib/python3/dist-packages/twisted/python/threadpool.py:250:inContext
/usr/lib/python3/dist-packages/twisted/python/threadpool.py:266:<lambda>
/usr/lib/python3/dist-packages/twisted/python/context.py:122:callWithContext
/usr/lib/python3/dist-packages/twisted/python/context.py:85:callWithContext
/usr/lib/python3/dist-packages/deluge/plugins/Notifications-0.4.egg/deluge_notifications/core.py:155:_notify_email
/usr/lib/python3.8/smtplib.py:868:sendmail
]
Unhandled error in Deferred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/twisted/_threads/_threadworker.py", line 46, in work
    task()
  File "/usr/lib/python3/dist-packages/twisted/_threads/_team.py", line 190, in doWork
    task()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 250, in inContext
    result = inContext.theWork()
  File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 266, in <lambda>
    inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
  File "/usr/lib/python3/dist-packages/deluge/plugins/Notifications-0.4.egg/deluge_notifications/core.py", line 155, in _notify_email
    server.sendmail(self.config['smtp_from'], to_addrs, message)
  File "/usr/lib/python3.8/smtplib.py", line 868, in sendmail
    msg = _fix_eols(msg).encode('ascii')
builtins.UnicodeEncodeError: 'ascii' codec can't encode characters in position 74-75: ordinal not in range(128)
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

This should fix it: Notifications-0.5.egg. Drop into your deluge-profile's 'plugins' subdir, and it will take precedence over the included version.

For context, smtplib.SMTP.sendmail() expects ascii char string or bytes for message input, and encodes former to bytes through ascii codec, hence error's out upon non-ascii chars. I added encoding to bytes by prepending '.encode('utf-8')' to sendmail() input in core.py, and tested it working by adding a few non-ascii chars to the hardcoded part of message body/subject in core.py, fixing the issue, and reproducing it without said encoding change.

I'll submit a PR soon. Thanks for log and post mate :)
zzznazt
New User
New User
Posts: 2
Joined: Thu May 05, 2022 11:14 am

Re: Notification not working

Post by zzznazt »

Just tested and it works perfectly, thanks for the prompt reply and fix. :D
shinger
Leecher
Leecher
Posts: 83
Joined: Sat Jun 05, 2010 1:02 pm

Re: Notification not working

Post by shinger »

I did not see that the topic was going on..and there was already a fix. Going to try the fix mhertz gave.
===============================================================
Server: Rock 5B 8 Cores (ARM), 16 GB RAM, 2 TB 970 Evo +
OS: Linux Ubuntu 22.04 LTS
Deluge: v2.1.1
Plugins: Blocklist, LabelPlus, ItConfig, MyScheduler, Stats, Notifications, YaRSS2
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

Hi shinger :) I did made a PR for that(forgot edit into post), which got merged and included in deluge 2.1.0, so unless using old version then I'm affraid other issue. I did test the plugin recently for someone, and working for me atleast. If having some error logging then please post if wanted thanks.
shinger
Leecher
Leecher
Posts: 83
Joined: Sat Jun 05, 2010 1:02 pm

Re: Notification not working

Post by shinger »

Hey mhertz,

So are you saying that fix got already merged in to Deluge version 2.1.0? Because i am running Deluge v2.1.1 and still had the issue.

I did put your version of the plugin in the plugin folder and it has already been two days and just checked. I saw it was still working compared to without the edited notifications plugin you provided.
===============================================================
Server: Rock 5B 8 Cores (ARM), 16 GB RAM, 2 TB 970 Evo +
OS: Linux Ubuntu 22.04 LTS
Deluge: v2.1.1
Plugins: Blocklist, LabelPlus, ItConfig, MyScheduler, Stats, Notifications, YaRSS2
Post Reply