Code Monkey home page Code Monkey logo

Comments (10)

caronc avatar caronc commented on May 12, 2024

That's strange; the OS that hosts your NAS (the custom Linux distribution) basically can't determine where your python executable is from your environment. You could try changing the very first line of Notify.py which currently reads:

#!/usr/bin/env python

And change it to:

#!/usr/bin/env python2

If that doesn't work; here is another line that might solve the issue.

#!/usr/bin/python

You could peak at what your other working (python) scripts have as their first line and use it too. But the current method in place is preferred. If you feel ambitious; you could report it to ASUS too (as they aren't correctly supporting the /usr/bin/env command which was designed to make things like this easy) :).

One more small note; the script currently doesn't support python v 3.x at this time. I don't think there is much effort involved to make it work with it; but i just haven't had time. So hopefully your NAS is running a copy of python v2.x instead (most people haven't made the switch yet anyway so you're probably safe here).

from nzb-notify.

gibxxi avatar gibxxi commented on May 12, 2024

It's running Python 2.7.3 (r13) as reported by the App Center on the NAS. The Python package is a user-installable package not shipped with the unit by default. I'll try to locate where it's stored and compare with your code samples. Even though this is ASUS' own Linux distribution, it must be based on an existing distro I would of thought.

Netgear NASes use Debian primarily, although heavily customized / stripped down. This isn't like those as the file/folder structure is noticeably different.

Will report back if I get any success.

from nzb-notify.

gibxxi avatar gibxxi commented on May 12, 2024

Just checked Email.py, the built-in email script for NZBGet, and the first line in that file is the same as in yours. Email.py is working fine, yours isn't.

One thing I did notice is the import statements differ:

Email.py:

import os
import sys
import datetime
(removed smtplib line as it's not relevant)

Notify.py:

import sys
import re
from os.path import join
from os.path import dirname
from urllib import unquote

In any case, simply typing "python" in the terminal window starts python fine. However it's not located in /usr/bin or usr/bin/env. No python-related files in that folder (/usr/bin) and that folder has no sub-folders at all.

from nzb-notify.

caronc avatar caronc commented on May 12, 2024

You can type the following to predetermine that if you want. Also you can take the very first line from the Email.py file and place it in the Notify.py if you want; (just the #!/path/to.. line though).

# find out which executable we're calling
which python

Make sure Notify.py is executable too:

chmod 755 /path/to/Notify.py

from nzb-notify.

gibxxi avatar gibxxi commented on May 12, 2024

I found it. It's located in usr/local (symlinked to folder .@Plugins)/bin/python.

I've also made Notify.py "Executable" as it was missing that permission.

from nzb-notify.

caronc avatar caronc commented on May 12, 2024

Great!
If you have some way of adding it to your global path; that would probably fix the /usr/bin/env issue. Keep me posted if all goes well or not. If not pass along the new error message so we can dig deeper!

# Something like:
export PATH=$PATH:/path/to/plugins/bin

from nzb-notify.

gibxxi avatar gibxxi commented on May 12, 2024

No joy. It seems (sitting at this end) that NZBGet simply isn't using the script. I don't know why. I've set all the options for the script within NZBGet itself, but the "Notify.py" file remains unchanged from defaults. i.e: the options section in the actual file is stock, is this supposed to be the case?

Nothing gets sent notifications-wise. The error I sent last night showed up in the queue log folder in NZBGet (Download folder/NZBGet/Queue).

The reason I'm suspicious is that on several occasions I've noticed that my settings for your script all get reset to defaults within NZBGet. This might be on a NAS reboot, I don't know at this stage. I'll look at it again on my days off, I have to work tonight, so I'm out of time today.

CLI notifications are working fine, but nothing triggered from within NZBGet apart from the scripts it's bundled with seem to be working for me. The addon was authored by the same guy who makes the nzbtomedia scripts (Clinton Hall) so he must have an Asustor NAS too. I'm simply at a loss as to why this isn't working.

from nzb-notify.

caronc avatar caronc commented on May 12, 2024

Yeah, that's definitely not cool at all. I noticed you said you're using NZBGet v16. What if you try falling back to an earlier version (I'm still using v15 at home at the moment)? I'm not saying that's the solution; but you never know. If your settings aren't being correctly saved, then that tells me that NZBGet is having a hard time writing it's configuration it uses to disk (after you set it). Remember that you also need to Reload NZBGet after you update the configuration (but it's pretty good for telling you that and putting the Reload button right in your face afterwards). :)

Now I use a custom build of NZBGet where i actually specifically patch this very thing (because I wanted my conf details to be saved in my /home/user/dir). What you could do is locate the current configuration file; it might be something like /usr/local/share/nzbget/nzbget.conf by i can't promise you that (I've never used the NAS you have). But if you can locate it; try making sure the file is writeable.

chmod ug+w /path/to/nzbget.conf

Under the hood NZBGet uses a template file that it reads to give you the basic information already pre-loaded. Then afterwards when you hit save (after making an update), it rights to a different location (leaving the template as it was).

Sooo for this reasons, there may be several .conf files (not sure) (and thus chmod'ing the template won't help you).

One thing you can try though is from the System menu (in the NZBGet Configuration), choose Backup Settings. It'll export you a small file... but more importantly try importing that file back using the Restore Settings. I'm curious to know if that works, or if it spits back an error like 'can't save configuration' or something.

Anyway maybe it'll shed more light on the directly that it can't save the configuration to. I'm not an NZBGet developer; but right now the issue definitely may just be related to the environment not being correctly set the way you want it (like you're already eluding to).

from nzb-notify.

gibxxi avatar gibxxi commented on May 12, 2024

Well i just looked at the NZBGet logs again for another test snatch, and have seen the following entries:

Thu Aug 06 2015 17:00:39 Executing post-process-script Notify.py for {Item Name Removed}
Thu Aug 06 2015 17:00:39 Notify: Fixing permissions for /usr/local/AppCentral/nzbget/nzbget/scripts/Notify.py

Well that shouldn't be needed as the permissions for Notify.py were already fixed. The file was uploaded to the NAS as the "admin" user, (not root), which is the same user I believe NZBGet runs under, and the permissions were/are 755...

Thu Aug 06 2015 17:00:39 Notify: Could not start /usr/local/AppCentral/nzbget/nzbget/scripts/Notify.py: Permission denied
Thu Aug 06 2015 17:00:39 Post-process-script Notify.py for {Item name removed} failed (terminated with unknown status)

I did notice my category for "Movies" was incorrect in CouchPotato, but this shouldn't prevent the Queue notifications working, just the post-processing ones. I will try your suggestions when I get time. The Updates aren't part of the add-on, they are distributed via in-app updates, so I may try reverting to stock, and see. Only thing there is, I think every release I've seen compatible with this NAS is a form of Beta, if memory serves. Will look at it again in a few days.

from nzb-notify.

gibxxi avatar gibxxi commented on May 12, 2024

I have reverted NZBGet to version 15, which also meant having to re-copy the Notify script to the NAS as the folder contents were deleted. Also double checked my config settings within NZBGet and it now seems to work as expected.

I'm not completely sure the reversion is what fixed it, as there were a couple of other things settings-wise I changed, but it is now working as expected. I will wait for a "stable" release of NZBGet 16 before upgrading again.

Dan/Gib.

from nzb-notify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.