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')
You've edited the post. Does it mean the issue is gone or should I take a look into it?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?
No, the problem persists. It would be great if you could check what's going on!hugbug wrote:You've edited the post. Does it mean the issue is gone or should I take a look into it?
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 ^
Hi,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.
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()".thechosen wrote:Hello,
i am getting the followin error:
The Script is called by nzbget 11.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 ^
Any Solution? Thanks!
-so long
Users browsing this forum: No registered users and 44 guests