Postprocessing torent&nzbToMedia

So you made CouchPotato even more awsome?
User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

Postprocessing torent&nzbToMedia

Postby clinton.hall » 28 Jun 2012 13:53

*****
Please note. All work contributed to this post is done as a "user" and not as a "moderator". This is a 3rd part script that I have created to provide an alternative to the default processing. it is not officially supported by Ruud Burger or the greater CPS community.

However, as a "User" I will try and provide support to those who wish to use this script. Just don't go posting bugs on github ;)

This script provides an alternative method of triggering the renamer (or manage folder update) on complete download, and download of the next release on failed download. The actual renaming is still done by CPS and the end results are the same. The only difference is the way these are called (on-demand) and the fact that this method does not require regular scanning of directory and regular polling of SABnzbd via api. This can reduce CPU loading on some systems and can allow hdds to spin down when not downloading.
*****
This script is now hosted at github
https://github.com/clinton-hall/nzbToMedia
you can use a git clone etc or you can download as a zip from
https://github.com/clinton-hall/nzbToMedia/archive/master.zip

Links to compiled windows builds are on the installation wiki page at https://github.com/clinton-hall/nzbToMedia/wiki/installation

User avatar
IVIik
Junior Member
Posts: 2
Joined: 28 Jun 2012 16:11
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby IVIik » 28 Jun 2012 21:06

Hi Clinton, in continuation of my post over on the qnap forum http://is.gd/LYyjzx

I have deleted the py scripts and cfg file and recreated them and all is now working - I guess I just did some sloppy cut 'n' pasting!

Thanks for the assistance though.

IVIik
HP N40L Microserver \ 8GB Ram \ 8.25TB Storage
FreeNAS 8 \ SABNzbd \ Sickbeard \ CouchPotatoServer

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby clinton.hall » 28 Jun 2012 23:39

Hi IVIik,

I am puzzled since the script appeared to run first time, but glad it appears to run for you now.

Sorry to swap forums, but I had helped with a few windows installs and noticed the QNAP forum was in the top few google searches for this subject. I figured this forum was a better place for this platform independant script.

Let me know if you have any further issues, or otherwise feel free to share your experience to help others set it up.

Cheers,

Clinton

User avatar
saitoh183
Junior Member
Posts: 19
Joined: 02 Jul 2012 17:27
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby saitoh183 » 02 Jul 2012 22:41

clinton.hall wrote:
make sure sab2CouchPotato.py is executable (for windows you need to compile or add .py to executable file type)


Sabnzb doesnt need a compile version of the script to use it. Using version 0.7 of Sab, it will see the .py file.

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby clinton.hall » 02 Jul 2012 23:19

Hi saitoh183,

Thanks for this. I discovered this change after I had made the post. I understand this is only true for SABnzbd 0.7.0 and later and I read in another forum that SABnzbd 0.7.0 has a bug and has been withdrawn. Current stable is 0.6.15 until 0.7.1 is released.

Also, if people are running the SABnzbd windows packages (not installing python and manually installing SABnzbd) I don't believe these packages allow for easy updating.

In any case, compiling code won't be a requirement going forward, but it is easier to mention this up-front for anyone maintaining an older release of SABnzbd.

Cheers,

Clinton

User avatar
saitoh183
Junior Member
Posts: 19
Joined: 02 Jul 2012 17:27
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby saitoh183 » 04 Jul 2012 00:02

Im still using 0.7.0Beta8 with no issues. I think for those that are still using 0.6.15 you must add .py to the environment variables (PATHEXT ...;.py) and that should allow SAB to see script.

Click Start – Right Click My Computer – Click Properties – Click Advance tab or Advance System Settings in Vista/7
Click Environment Variables …… Under system Variables find PATHEXT – Highlight PATHEXT - Click Edit and add; .PY; .PYW …… Click OK and Restart Sab (might need an entire PC reboot if your using XP or Vista)
[hr]
clinton.hall wrote:I read in another forum that SABnzbd 0.7.0 has a bug and has been withdrawn.


Where did you hear this? cuz you can still download 0.7.0 from the site
http://sourceforge.net/projects/sabnzbd ... lus/0.7.0/

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby clinton.hall » 04 Jul 2012 13:40

Hi saitoh183,

This information was provided in the QNAP forums after the author of a SABnzbd qpkg (install package for QNAP NAS) contacted the SABnzbd development team.

The QPKG supports updates via GitHub but while the files were still there, they were not listed as "stable" releases and therefore severel people found errors in the update script if they had updated to 0.7.0 and those who had not updated were unable to do so unless they changed a setting to use "unstable" builds.

On the sorceforge site, it also shows the 0.7.0 as available, but it actually stated "Looking for the latest version? Download SABnzbd-0.6.15-src.tar.gz (1.9 MB)" at the top, so this also appears to show 0.6.15 as the current stable release.

I myself am running 0.7.0 and this is not causing me any issues. I also note that GitHub shows a recent "0.7.1 final" so I think most systems should be updating to that soon.

It certainly will be easier for most people to set up post processing with SABnzbd supporting scripts that are not set with executable settings.

Thanks for the detailed instructions for adding py as PATHEXT in Windows.

User avatar
saitoh183
Junior Member
Posts: 19
Joined: 02 Jul 2012 17:27
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby saitoh183 » 04 Jul 2012 14:43

Thanks Clinton for clearing that up :)

Guido
Junior Member
Posts: 6
Joined: 17 Jul 2012 10:17
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby Guido » 17 Jul 2012 10:30

Nice work, but I'm missing the config option to set urlbase.
Thats needed when using a reverse proxy.

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby clinton.hall » 17 Jul 2012 10:56

Guido wrote:Nice work, but I'm missing the config option to set urlbase.
Thats needed when using a reverse proxy.


Good catch. I presume this is the web_root paramter that was used in the SickBeard postprocessing? I never knew what it was actually for, and the setups we have on QNAP don't require it...

Anyway, have put it back in and uploaded. Please let me know if this does what is needed or if aomething needs to be added.

Guido
Junior Member
Posts: 6
Joined: 17 Jul 2012 10:17
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby Guido » 17 Jul 2012 11:34

Yes, in the couchpotato config.ini the parameter is called urlbase but its the same functionality (maybe rename it?).
It's needed when you add them as a reverse proxy in your apache config. You don't need to open extra ports then to able to browse them from outside. See: http://couchpotato.tenderapp.com/kb/tips/reverse-proxy
I'll test if it works.

Guido
Junior Member
Posts: 6
Joined: 17 Jul 2012 10:17
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby Guido » 17 Jul 2012 14:00

It does work, but I'm getting this error on my synology nas: Exit(127) env: python : No such file or directory (More)

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby clinton.hall » 17 Jul 2012 14:06

Guido wrote:It does work, but I'm getting this error on my synology nas: Exit(127) env: python : No such file or directory (More)


Can you expand the "more" and post the full output so I can try and figure out what's happening?

When you say it does work, does that mean it is causing CPS to run the renamer?

Guido
Junior Member
Posts: 6
Joined: 17 Jul 2012 10:17
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby Guido » 17 Jul 2012 14:17

Yes, its renamed/moved and even the trailer is downloaded but the script only outputs this in sabnzbd 0.7.1:
env: python
: No such file or directory

See my attached settings for cp.

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby clinton.hall » 17 Jul 2012 14:42

Guido wrote:Yes, its renamed/moved and even the trailer is downloaded but the script only outputs this in sabnzbd 0.7.1:
env: python
: No such file or directory

See my attached settings for cp.


Curious. It almost seems that it is running, but failing to pass-back the messages to be logged. I'm not familiar with the setup on Synology, what version of python are you running?

Are you able to ssh into your NAS, go to your postprocess scripts directory and run this via "python2.x sabToCouchPotato.py" where x is replaced with your python version? If you can get a copy of the output of that it would help.

Does sabToCouchPotato.py have execute permissions? Try chmod to 755 (I think) and see if that works any better.

Guido
Junior Member
Posts: 6
Joined: 17 Jul 2012 10:17
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby Guido » 17 Jul 2012 15:50

I have python 2.7...seems something went wrong with making the files.
From SSH it's working now.

DiskStation> ./python2.7 /usr/local/sabnzbd/var/scripts/sabToCouchPotato.py
No folder supplied - is this being called from SABnzbd?
Running autoProcessMovie as a manual run
Loading config from /usr/local/sabnzbd/var/scripts/autoProcessMovie.cfg
waiting for 60.0 seconds to allow CPS to process newly extracted files
Opening URL: http://localhost:5050/couchpotato/api/x ... namer.scan
{"success": true}
renamer.scan started on CouchPotatoServer for Manual Run

I'll try it again from cpv2.

Edit: Still the same error.
But it also seems that with a setting of 0 for run every (Search for new movies inside the folder every X minutes.) cp still renames/moves.

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby clinton.hall » 17 Jul 2012 23:43

Guido wrote:I have python 2.7...seems something went wrong with making the files.
From SSH it's working now.

DiskStation> ./python2.7 /usr/local/sabnzbd/var/scripts/sabToCouchPotato.py
No folder supplied - is this being called from SABnzbd?
Running autoProcessMovie as a manual run
Loading config from /usr/local/sabnzbd/var/scripts/autoProcessMovie.cfg
waiting for 60.0 seconds to allow CPS to process newly extracted files
Opening URL: http://localhost:5050/couchpotato/api/d ... namer.scan
{"success": true}
renamer.scan started on CouchPotatoServer for Manual Run

I'll try it again from cpv2.

Edit: Still the same error.
But it also seems that with a setting of 0 for run every (Search for new movies inside the folder every X minutes.) cp still renames/moves.


Just for protection, edit your last post to xxxxxx out part of the api key...... As I have done in this quote.....

Interesting indeed. I never tested the run every = 0 in CPS. I was told this would stop it auto running, but obviously not.

So we know the script runs, but I am guessing that the downloaded files are being processed before the script has a chance to run, so SABnzbd gives the no folder error without even running this script.

Try setting run every = 1440 so that the scan runs daily, and see if that works.

The other thing to check is that the changed parameter is applied... Restart CPS after changing the parameter and ensure this is correctly applied after restarting.

Guido
Junior Member
Posts: 6
Joined: 17 Jul 2012 10:17
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby Guido » 18 Jul 2012 15:23

I changed sabToCouchPotato.py: #!/usr/local/sabnzbd/env/bin/python
Now it does work :)

I don't know why the sickbeard postprocessing works from sabnzbd with #!/usr/bin/env python ...because it doesnt from commandline.

DiskStation> ./sabToSickBeard.py
env: python: No such file or directory

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby clinton.hall » 18 Jul 2012 23:50

Guido wrote:I changed sabToCouchPotato.py: #!/usr/local/sabnzbd/env/bin/python
Now it does work :)

I don't know why the sickbeard postprocessing works from sabnzbd with #!/usr/bin/env python ...because it doesnt from commandline.

DiskStation> ./sabToSickBeard.py
env: python: No such file or directory


Great that you got it to work. I might have to try and collate some of these problems and create a troubleshooter.

It almost appears your python install hasn't quite registered correctly? I am wondering if a shortcut/link from usr/bin/env/python to usr/local/SABnzbd/env/bin/python would also fix this. That should make you python (which appears to have been installed for SABnzbd) a global install that can be accessed from anywhere.

VinceVal
Junior Member
Posts: 7
Joined: 21 Jul 2012 03:17
Contact:
Status: Offline

RE: sab2CouchPotato postprocessing

Postby VinceVal » 21 Jul 2012 20:24

Guido, I think the behavior you're seeing is caused by DOS (CRLF) line endings in the script instead of UNIX (LF).

Try:

unzip -a sabToCouchPotato.zip

The -a parameter will convert text files to UNIX format. You can also use vim or dos2unix to convert your existing files.

-Vince


Return to “External Tools”