Tensai75 / NZBDonkey

The utlimate NZB downloader extension for Chrome and Firefox
https://tensai75.github.io/NZBDonkey/
MIT License
61 stars 6 forks source link

Settings to keep the {{password}} within the directory name #12

Closed H34dl3ss closed 3 years ago

H34dl3ss commented 3 years ago

I noticed in some cases the NZBDonkey will not name the directory like the corresponding nzb file. Usually the nzb file name contains the password in {{curly braces}}. When using the "add" in nzbget the download directory will always be named according to the nzb-filename. This means the password in curly braces will be part of the directory name that contain the downloaded files. Due to ressources shortage on my raspberry pi, I'm copying the directory for later batch-processing to my PC. The missing {{password}} in the directory name is braking the workflow because my batch-script cannot extract the password. Is it possible to keep the directory format including the password in {{curly braces}}? I played with the "NZB file processing" settings but that does't seem to do what I need. Thank you for considering.

Tensai75 commented 3 years ago

Is it possible to keep the directory format including the password in {{curly braces}}?

Not if you use the option to directly send the NZB file to NZBGet. NZBDonkey sends the title/filename and password to NZBGet seperately which is the correct and intended way NZBDonkey works.

Alternatively you can use the option to download the NZB file to a folder and then have NZBGet watch this folder for incoming NZB files. In this case NZBDonkey will save the file as "title{{password}}.nzb" and when NZBGet adds the NZB file it will show the name with the password in the curly braces and subsequently save the downloaded files in a folder named like this.

Tensai75 commented 3 years ago

@H34dl3ss I wrote a short NZBGet post-processing script which will always rename the destination folder for the downloaded files to "title{{password}}" if a password was provided:

https://github.com/Tensai75/ReverseGetPW.py

With this post-processing script you can still use the add to NZBGet option in NZBDonkey.

Hope this helps!

H34dl3ss commented 3 years ago

Thanks for providing the workaround via this extension. Unfortunately something is not running smoothly yet. I'm using the NZBget docker from Linuxserver.io running on a Pi4. I copied the .py to the nzb config directory and set the path accordingly. After fixing some permission issues I get this error in the nzb-log.

Sat Jan  2 08:56:37 2021    INFO    Executing post-process-script ReverseGetPW.py for FILENAMECHANGED
Sat Jan  2 08:56:37 2021    ERROR   ReverseGetPW: Could not start /downloads/nzb_config/scripts/ReverseGetPW.py: No such file or directory
Sat Jan  2 08:56:37 2021    ERROR   Post-process-script ReverseGetPW.py for FILENAMECHANGED failed

When executing the script inside the container I get this:

root@PiVPN:/downloads/nzb_config/scripts# python ReverseGetPW.py  
File "ReverseGetPW.py", line 26  
print '[ERROR] %s. Error: %s'%(m, e)
          ^
SyntaxError: invalid syntax

Python works so there must be something else. It seems the path is not correct. Maybe related to the docker mappings? Or maybe because I moved the scripts-directory?

The docker mappings are like so:

/media/usb2/downloads/nzb/nzb_config | /config
/media/usb2/downloads/nzb | /downloads

The correct path to the script file is: /downloads/nzb/nzb_config/scripts/ReverseGetPW.py

The content of /nzb looks like this:

drwxrwxr-x+ 49 pi users      4096 Jan  2 09:43 completed
drwxrwxr-x+  2 pi users      4096 Jan  2 09:43 intermediate
drwxr-xr-x   2 pi users     16384 Jan  2 09:42 nzb
drwxr-xr-x   3 pi users      4096 Jan  2 09:36 nzb_config
-rw-r--r--   1 pi users 111066153 Jan  2 10:28 nzbget.log
drwxr-xr-x   2 pi users     20480 Jan  2 10:26 queue
drwxr-xr-x   2 pi users      4096 Jan  2 09:42 tmp
Tensai75 commented 3 years ago

First, I will close this issue here now. Next time please open an new issue in the corresponding repository.

I have also installed the NZBGet docker from linuxserver.io and it worked perfectly for me. Your setting in NZBGet for the scripts folder obviously is wrong:

Sat Jan  2 08:56:37 2021  ERROR   ReverseGetPW: Could not start /downloads/nzb_config/scripts/ReverseGetPW.py: No such file or directory

NZBGet is looking for it in /downloads/nzb_config/scripts/ but you said it is located in /downloads/nzb/nzb_config/scripts/

The correct path to the script file is: /downloads/nzb/nzb_config/scripts/ReverseGetPW.py

Btw, I have completely rewritten the script again for python 3.x, made the log output more verbose and added an additional check for invalid characters in the password (which would result into an error when trying to rename).

Regards, Tensai

H34dl3ss commented 3 years ago

The new version of the script is working perfectly on my side also! I had to replace the script only. Thank you once again!