Page 1 of 9

[Scan-Script] pfftn (formerly

Posted: 05 Sep 2013, 19:15
by wusa
What is this?
This script is filling the Unpack-password from the filename and removes it from NZB Name: file*{{password}}*.nzb

Installation, usage:
x. pfftn_2x, pfftn_3x tested with: nzbget v13, Python v2.7.4, v3.4.1 @ Win8 x64 and Python 2.6.2 @ NSA325 (Linux
1. safe file to ScriptDir and set chown/chmod (for linux only)
2. adjust first line for your OS! (ex. WIN: #!c:/python/python.exe --- LINUX/NAS: #!/usr/local/zy-pkgs/bin/python2.6 or #!/usr/bin/env python)
3. start/restart nzbget (PFFTN_2X or/and PFFTN_3X should appear on left side in settings page of nzbget)
4. nzbget settings -> EXTENSION SCRIPTS -> ScanScript -> Choose (Python v3: / Python v2:

Maybe, the RegEx can be improved!? :)
Problem with some letters in filename (windows only).

Edit1: Changed line endings from attachment and merge posts.
Edit2: New version (only for Python 2.7) explicit tested for NSA325 (ffp) see:
Edit3: New version for nzbget v13; Changed filenames; changes from v1.3 removed

Re: [NzbProcess]

Posted: 08 Sep 2013, 11:05
by wusa
There is a problem with the file environment variable (['NZBNP_NZBNAME'] - dos/win) which is set by nzbget.
The special character % is reserved for env-variables (dos).

If the password contains one of this character it will get lost in the env-variable. This can be fixed, if you (or nzbget - fix/feature) double it.

password: 7$%6Ve7 >> env: 7$6Ve7
fix: 7$%%6Ve7 >> env: 7$%6Ve7

password: 7$%%6Ve7 >> env: 7$%6Ve7
fix: 7$%%%%6Ve7 >> env: 7$%%6Ve7

Re: [NzbProcess]

Posted: 25 Sep 2013, 14:12
by wusa
Edit: merged

Re: [NzbProcess]

Posted: 25 Sep 2013, 14:18
by hugbug
wusa wrote:I tested my script on a Zyxel NSA325. There is a problem with executing python scripts.
Using "#!/ffp/bin/python3" directly in python-script doesn't work?

Re: [NzbProcess]

Posted: 25 Sep 2013, 14:41
by wusa

I have tested many settings:
lrwxrwxrwx 1 root root 9 Jun 6 12:50 /ffp/bin/python3 -> python3.3 <- from ffp-package
-rwxr-xr-x 1 root root 1965604 Jun 6 12:52 /ffp/bin/python3.3
-rwxr-xr-x 1 root root 5656 Aug 23 12:15 /usr/bin/python <- from system v2.6.2

#!/ffp/bin/python3(.3) or #!/usr/bin/python
-> nzbget error: Could not start /i-data/md0/admin/nzbget/nzbp/ No such file or directory
-> bash error: -sh: ./ /ffp/bin/python3^M: bad interpreter: No such file or directory

#!/ffp/bin/env python3 oder #!/bin/env python
-> nzbget error: /ffp/bin/env: python3 : No such file or directory
-> bash error: ': No such file or directory

Re: [NzbProcess]

Posted: 25 Sep 2013, 14:46
by hugbug
Looks like the file was saved using windows line endings.

Re: [NzbProcess]

Posted: 25 Sep 2013, 14:49
by wusa
Yes. I used the script created under windows, just copy the file on the nas and changed first line.
Ok, I will test it.

Re: [NzbProcess]

Posted: 25 Sep 2013, 14:55
by hugbug
Change line endings to UNIX using notepad++ or notepad2 or other editor.

Re: [NzbProcess]

Posted: 25 Sep 2013, 14:59
by wusa
Yes. That's it. Argh. :oops: Thanks! I will change my postings and the attachments.

Re: [NzbProcess]

Posted: 13 Oct 2013, 17:39
by wusa
There is another problem with letters >ord(128) [ASCII] on a Zyxel NSA325.

The Fonz fun_plug (ffp) "doesn't" support a dpkg-reconfigure console-setup or an apt-get install locales.
Python couldn't read this letters, if the environment doesn't support it. So long, I haven't found a solution, yet.

If anyone got the same problems with (äöü ß etc.) the script is setting the first error line from python into the NZBPR_*Unpack:Password field.
To avoid it, please add this code.


Code: Select all

fwp = os.environ['NZBNP_NZBNAME']

Code: Select all

   print('[ERROR] One or more letter(s) could not parse correctly - wrong locales set? Password was not set!')
Nzbget (windows), not the script, have problems with some letters, too.
Example: Test{{äöüߧ}}.nzb
[ERROR] Error parsing nzb-file: System ...
[ERROR] Could not add collection Test{{äöüߧ}}.nzb to queue

Why are such characters used in file names I don't understand. Happens about once a week.