Page 2 of 10

[NzbProcess] pass-from-file-to-nzbget2.6.py

Posted: 07 Nov 2013, 11:15
by wusa
On the NSA325 there are two different versions of python installed (with ffp package three).
The full featured version is found in /usr/local/zy-pkgs/bin called python2.6.
So here is an updated version for the NSA325 and now there are no problems with special sign's - I hope.

Tested with file "Test.{{äöü$adb%§ô}}.nzb" set password to "äöü$adb%§ô" in nzbget (without quotes).

Note: This new version can't run under python 3! Worked for v2.7.3.
Edit1: There is a new version in first post. This version doesn't work with nzbget v13 or later.

Re: [NzbProcess] pass-from-file-to-nzbget.py

Posted: 22 Feb 2014, 17:04
by halloei
Hi,

I created categories for my downloads ("Movies", "Series", "Music") and I set them when I add a nzb-file.
But since I use this script, all downloads are saved in my primary dst-folder. They are no longer arranged in the subfolders.

Does anyone have an idea what could cause this issue? And does someone else experience that?

Best regards


//Edit: I had to edit the script a bit to get it running:

Code: Select all

#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-

##############################################################################
### NZBGET NZBPROCESS SCRIPT                                               ###

# extract + replace password from filename and set *Unpack-password @ nzbget #

# [GERMAN]                                                                   #
# Dieses Script setzt das Passwort zum entpacken aus dem Dateinamen in die   #
# "PP-Parameters" und entfernt dieses aus dem NZB-Namen	                     #

# [LESEN!]                                                                   #
# Bitte die erste Zeile "#!/usr/bin/env python" eurem System anpassen!       #

# [ENGLISH]                                                                  #
# This script is filling the Unpack-password from the filename and removes   #
# it from NZB Name.                                                          #

# [FIRST!]                                                                   #
# Check the first line "#!/usr/bin/env python" and adjust it!                #

# File: file.name.test.{{password}}.nzb                                      #
#       file name test {{password}}.nzb                                      #
#       file {{password}} name test.nzb                                      #
#       file.{{password}}.name.test.nzb                                      #
#       file.name.test.{{ password }}.nzb                                    #
#       etc.								     #

# Thx to:                                                                    #
#   freem@n: http://nzbget.sourceforge.net/forum/viewtopic.php?p=5167#p5167  #
#   for his RegExp: ^.*?\{\{(.*?)\}\}                                        #

#   hugbug (Andrey Prygunkov): http://nzbget.sourceforge.net                 #
#   for nzbget, EMail.py and his documentation                               #
#   I hope I can use a little bit from your code (EMail.py)                  #

#   autor: http://www.tutorialspoint.com/python/python_reg_expressions.htm   #
#   for RegExp with Python                                                   #

#   Author of the collected code snippets: wusamba {at] gmail [D o T} com    #
#   pass-from-file-to-nzbget.py                                 v1.2 11.2013 #

### NZBGET NZBPROCESS SCRIPT                                               ###
##############################################################################

import os, re, sys

# Code from EMail.py @ http://nzbget.sourceforge.net
# Exit codes used by NZBGet
POSTPROCESS_ERROR=94

# Code from EMail.py @ http://nzbget.sourceforge.net
# Check if the script is called from nzbget 11.0 or later
if not 'NZBOP_SCRIPTDIR' in os.environ:
	print('*** NZBGet post-processing script ***')
	print('This script is supposed to be called from nzbget (11.0 or later).')
	sys.exit(POSTPROCESS_ERROR)

if not 'NZBNP_NZBNAME' in os.environ:
	print('[WARN] Filename not found in environment')
	sys.exit(POSTPROCESS_ERROR)

# Code from EMail.py @ http://nzbget.sourceforge.net
#print('[INFO] Script successfully started')
#sys.stdout.flush()

fwp = os.environ['NZBNP_NZBNAME']

p = re.match( r'^.*?\{\{[ ]?(.*?)[ ]?\}\}', fwp, re.I)
f = re.sub( r'[ .]?{\{[ ]?(.*?)[ ]?\}\}', '', fwp)

if p:
   print('[NZB] NZBPR_*Unpack:Password=' + p.group(1))
# Next line can be removed if wanted or set to [DETAIL] logging
   print('[INFO] Password added to PP-Parameters')
   if f:
      print('[NZB] NZBNAME=' + f)
# Next line can be removed if wanted or set to [DETAIL] logging
#      print('[INFO] Name changed')

Re: [NzbProcess] pass-from-file-to-nzbget.py

Posted: 22 Feb 2014, 17:44
by Telman12
this script runs under python 2.7.6

a post about it

Re: [NzbProcess] pass-from-file-to-nzbget.py

Posted: 22 Feb 2014, 18:02
by halloei
The latest version I can get through my Synology-Package-Center and through ipkg-packages is 2.7.3 and I'm using that one.

Re: [NzbProcess] pass-from-file-to-nzbget.py

Posted: 22 Feb 2014, 22:19
by hugbug
halloei wrote:I created categories for my downloads ("Movies", "Series", "Music") and I set them when I add a nzb-file.
But since I use this script, all downloads are saved in my primary dst-folder. They are no longer arranged in the subfolders.
Does anyone have an idea what could cause this issue?
You've edited the post. Does it mean the issue is gone or should I take a look into it?

Re: [NzbProcess] pass-from-file-to-nzbget.py

Posted: 23 Feb 2014, 01:09
by halloei
hugbug wrote:You've edited the post. Does it mean the issue is gone or should I take a look into it?
No, the problem persists. It would be great if you could check what's going on!

Re: [NzbProcess] pass-from-file-to-nzbget.py

Posted: 26 Feb 2014, 19:38
by thechosen
Hello,

i am getting the followin error:

Code: Select all

Wed Feb 26 00:16:08 2014	INFO	  File "/media/NAS/Temp/NZBget/ppscripts/incoming/pass-from-file-to-nzbget2.6.py", line 57
Wed Feb 26 00:16:08 2014	INFO	    print('This script is supposed to be called from nzbget (11.0 or later).')
Wed Feb 26 00:16:08 2014	INFO	    ^
The Script is called by nzbget 11.

Any Solution? Thanks!

-so long

Re: [NzbProcess] pass-from-file-to-nzbget.py

Posted: 05 Mar 2014, 07:20
by halloei
halloei wrote:I created categories for my downloads ("Movies", "Series", "Music") and I set them when I add a nzb-file.
But since I use this script, all downloads are saved in my primary dst-folder. They are no longer arranged in the subfolders.
Hi,

i reinstalled nzbget to be sure. And I found out that not the script caused the error.
At quiet the same time I began to use the script, I updated nzbget from version 11 to 12. I think something must gone wrong as the updater tried to keep my nzbget-configurations.

Thanks anyway,
best regards

Re: [NzbProcess] pass-from-file-to-nzbget.py

Posted: 24 Mar 2014, 10:17
by wusa
thechosen wrote:Hello,

i am getting the followin error:

Code: Select all

Wed Feb 26 00:16:08 2014	INFO	  File "/media/NAS/Temp/NZBget/ppscripts/incoming/pass-from-file-to-nzbget2.6.py", line 57
Wed Feb 26 00:16:08 2014	INFO	    print('This script is supposed to be called from nzbget (11.0 or later).')
Wed Feb 26 00:16:08 2014	INFO	    ^
The Script is called by nzbget 11.

Any Solution? Thanks!

-so long
Edit: Please verify that this script is running on Python v2.x. My environment is running with Python v2.6.2. You can check this by running python on command line (shell). You can close it with "exit()" or "quit()".

Re: [NzbProcess] pass-from-file-to-nzbget.py

Posted: 14 May 2014, 13:53
by d4f0rc3_
Hi guys, I have little problem with this script on my Synology DS213+.

The script cannot be started due to the error "permission denied".

The script file has the owner nzbget:users and the permissions 755 (777 doesn't work either). I put the file in different folders, even in the ppscript folder, but it fails with the same "permission denied" error all the time.
The other pp script with the same owner and permissions which are in the ppscript folder do work just fine.

Can you help me out?


(btw can this script be expanded by settings a designated category from the filename?)