caronc / nzb-notify

Push Notifications to a large number of supported services for NZBGet and SABnzbd (based on Apprise)
GNU General Public License v3.0
129 stars 15 forks source link

SABnzbd + freenas not working #11

Closed sahnebar closed 7 years ago

sahnebar commented 7 years ago

Hello,

i got some Problem with you Script, so when i test the notification script then it works correctly. But when SABnzbd finished a download then i will get this error:

"2016-11-04 18:11:16,666 - 6931 - ERROR - Fatal Exception: Traceback (most recent call last): File "/media/scripts/nzbToMedia/Notify/nzbget/ScriptBase.py", line 2418, in run exit_code = main_function(*args, **kwargs) File "/media/scripts/nzbToMedia/Notify.py", line 1102, in main notify_type=notify_type, File "/media/scripts/nzbToMedia/Notify.py", line 894, in notify nobj.notify(body=body, title=title, notify_type=notify_type) File "/media/scripts/nzbToMedia/Notify/pnotify/NotifyBase.py", line 380, in notify **kwargs): File "/media/scripts/nzbToMedia/Notify/pnotify/NotifyTelegram.py", line 263, in _notify self.escape_html(title), File "/media/scripts/nzbToMedia/Notify/pnotify/NotifyBase.py", line 318, in escape_html replace(u'\t', u' ').\ UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc in position 23: ordinal not in range(128)

What i am doing wrong? I use your script with freenas:

root@sabnzbd_1:/media/scripts/nzbToMedia # uname -a FreeBSD sabnzbd_1 10.3-STABLE FreeBSD 10.3-STABLE #0 r295946+0ea9076(9.10-STABLE): Mon Oct 3 06:51:23 UTC 2016 root@gauntlet:/freenas-9.10-releng/_BE/objs/freenas-9.10-releng/_BE/os/sys/FreeNAS.amd64 amd64

and the Files have 755 rights.

root@sabnzbd_1:/media/scripts/nzbnotify/nzb-notify-master # ll total 109 -rw-r--r-- 1 root media 675 Oct 29 05:34 .gitignore -rwxr-xr-x 1 media media 35121 Oct 29 05:34 LICENSE* drwxr-xr-x 14 media media 17 Nov 4 18:00 Notify/ -rwxr-xr-x 1 media media 45668 Oct 29 05:34 Notify.py* drwxr-xr-x 15 media media 15 Oct 25 09:59 Notify_Licensing/ -rwxr-xr-x 1 media media 14402 Oct 29 05:34 README.md* drwxr-xr-x 2 media media 6 Nov 4 18:00 patches/ -rwxr-xr-x 1 media media 7744 Oct 29 05:34 sabnzbd-notify.py*

sahnebar commented 7 years ago

Okey now i found the problem, SABnzbd starts your script with umlauts. So we get the errors.

2016-11-04 18:11:16,530::INFO::[newsunpack:191] Running user script /media/scripts/nzbToMedia/sabnzbd-notify.py(complete, SABnzbd: Auftrag ausgef<C3><BC>hrt)

Can we add some umlauts translation? :)

ä → ae
ö → oe
ü → ue
Ä → Ae
Ö → Oe
Ü → Ue
ß → ss (or SZ)

The SZ is only for words in capitals (and I think for old spelling).

caronc commented 7 years ago

On a side note, make sure you tell SABnzbd to point to sabnzbd-notify.py and not Notify.py. There isn't enough information from the error you pasted to hint that you aren't already doing this. Just letting you know (in case) though.

The bug would appear to be on my end anyway and not yours. But if you wouldn't mind, could you try downloading a copy of the NZB-Notify Tool from the Master branch here? I may have resolved this problem already in a recent commit made last week. I just never made an official release from it yet.

sahnebar commented 7 years ago

Yes i use the sabnzbd-notify.py :)

Now i fixed it, the Problem is the German spelling.

caronc commented 7 years ago

Great! I'm glad you fixed it :)

But I wouldn't expect (or want) you to rename anything you ever want to be notified about (eliminating the special characters)! Did you actually implement a fix in the code? I'm curious to know if you'd still like me to dig deeper?

You bring up a decent point that the script should still be able to handle different (character) encodings. The only problem I see (without further thought) is that I can't just 'default' the encoding to utf-8, or latin-1, etc. I would break the script systems in other parts of the world that use different encodings (Polish, Turkish, etc) if did.

sahnebar commented 7 years ago

No no, my programming skills arn't deeper as yours. ;) There was no problem with your script, the problem was the OS where its running. It could'n interpret the signs right, so i got the ISO/IEC 8859-1 code, like , and when this happens your script will freak out with this special characters. :P Now i chanced the spelling and it works.
Thank you for your help.