[Scan-Script] pfftn (formerly pass-from-file-to-nzbget.py)

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
wusa
Posts: 22
Joined: 05 Sep 2013, 18:39

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

Post by wusa » 07 Nov 2013, 11:15

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.
Attachments
pass-from-file-to-nzbget2.6.py
v1.3 for Python v2
(3.52 KiB) Downloaded 867 times
Last edited by wusa on 04 Aug 2014, 14:24, edited 3 times in total.

halloei

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

Post by halloei » 22 Feb 2014, 17:04

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')

Telman12
Posts: 16
Joined: 01 Nov 2013, 21:10

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

Post by Telman12 » 22 Feb 2014, 17:44

this script runs under python 2.7.6

a post about it

halloei

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

Post by halloei » 22 Feb 2014, 18:02

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.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

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

Post by hugbug » 22 Feb 2014, 22:19

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?

halloei

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

Post by halloei » 23 Feb 2014, 01:09

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!

thechosen
Posts: 3
Joined: 24 Feb 2014, 13:11

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

Post by thechosen » 26 Feb 2014, 19:38

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

halloei

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

Post by halloei » 05 Mar 2014, 07:20

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

wusa
Posts: 22
Joined: 05 Sep 2013, 18:39

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

Post by wusa » 24 Mar 2014, 10:17

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()".
Last edited by wusa on 04 Aug 2014, 14:27, edited 3 times in total.

d4f0rc3_
Posts: 4
Joined: 14 May 2014, 13:49

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

Post by d4f0rc3_ » 14 May 2014, 13:53

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?)

Post Reply

Who is online

Users browsing this forum: No registered users and 41 guests