Skip to content

Commit

Permalink
Renamed project and added installation details
Browse files Browse the repository at this point in the history
  • Loading branch information
thorli committed Nov 25, 2012
1 parent 8d7bea8 commit 301e889
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 71 deletions.
133 changes: 82 additions & 51 deletions README.md
@@ -1,51 +1,82 @@
nzbgetToCouchPotato
===================

Provides NZBGet postprocessing for CouchPotatoServer, based on sabToCouchPotato from clinton-hall

To get this to work with NZBGet you have to do the following:

1) Put all the files eg. in a directory wherever you want to keep them (eg. /scripts/ in the home directory of nzbget) and change the permission accordingly so nzbget has access to this files.

2) Add the following lines into nzbget's postprocess.conf in the "PATH" section:

# Set the full path to sabToCouchpotato.py for Couchpotato's postprocessing
SabToCouchpotato=<your_path>/sabToCouchpotato.py

3) Add the following lines into nzbget's postprocess.sh right before the line "# Check if destination directory was set in postprocessing parameters"

if [ $NZBPP_CATEGORY = "movies" -a -e "$SabToCouchpotato" ]; then
# Call Couchpotatos postprocessing script
echo "[INFO] Post-Process: Running Couchpotato's postprocessing script ($SabToCouchpotato $NZBPP_DIRECTORY $NZBPP_NZBFILENAME)"
$PythonCmd $SabToCouchpotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" >/dev/null 2>&1
fi

4)Rename the file autoProcessMovie.cfg.sample to autoProcessMovie.cfg and fill in the appropriate fields as they apply to your installation.

[Notes_On_Delay]
delay must be a minimum of 60 seconds for the renamer.scan to run successfully. CouchPotato
performs a test to ensure files/folder are not newer than 1 minute to prevent renaming of
files that are still extracting.

[Notes_On_Method_renamer]
method "renamer" is the default which will cause CouchPotato to move and rename downloaded files
as specified in the CouchPotato renamer settings.
This will also add the movie to the manage list and initiate any configured notifications.
In this case SABnzbd (or your download client) must extract the files to the "from" folder
as specified in your CouchPotato renamer settings. Renamer must be enabled but you should
increase the "run every" option in CouchPotato renamer settings (advanced settings) to only
run daily (1440) or weekly (10080) or automatic scan can be disabled by setting run every =0.

[Notes_On_Method_manage]
method "manage" will make CouchPotato update the list of managed movies if manager
is enabled but renamer is not enabled.
In this case SABnzbd (or your download client) must extract the files directly
to your final movies folder (as configured in CouchPotato manage settings) and Manage must
be enabled.

If you have added .py to your PATHEXT (in windows) or you have given sabToCouchPotato.py executable
permissions, or you are using the compiled executables you can manually call this process outside of
your nzbclient for testing your configuration or in case a postprocessing event failed.
To do this, execute sabToCouchPotato.py
e.g. via ssl issue the following command: #./sabToCouchPotato.py
when in the directory where sabToCouchPotato.py is located.
nzbToCouchPotato
================

Provides an efficient way to handle postprocessing for [CouchPotatoServer](https://couchpota.to/ "CouchPotatoServer")
when using one of the popular NZB download clients like [SABnzbd](http://sabnzbd.org/) and [NZBGet](http://nzbget.sourceforge.net/ "NZBGet") on low performance systems like a NAS.
This script is based on [sabToCouchPotato] (https://github.com/clinton-hall/sabToCouchPotato "sabToCouchPotato") from Clinton Hall, but extends the original script with the support for NZBGet.

Introduction
------------
My Synology DS211j was too weak to provide decent downloads rates with SABnzbd and CouchPotatoServer even by using sabToCouchPotato.
The only alternative was to switch to NZBGet which uses far less resources and helped to reach the full download speed.
But i was still unsatisfied as i could not use sabToCouchPotato anymore.
Even worse the renamer of CouchPotatoServer caused broken downloads by interfering with NZBGet while it was still unpacking the files.
In needed a solution and out of this motivation i started working on a own version of sabToCouchPotato named "nzbToCouchPotato".

Installation
------------
### General
1. Put all files in a directory wherever you want to keep them (eg. /scripts/ in the home directory of your nzb client)
and change the permission accordingly so the nzb client can access to this files.

2. Rename the file autoProcessMovie.cfg.sample to autoProcessMovie.cfg and fill in the appropriate
fields as they apply to your installation.

[Notes_On_Delay]
Delay must be a minimum of 60 seconds for the renamer.scan to run successfully. CouchPotato
performs a test to ensure files/folder are not newer than 1 minute to prevent renaming of
files that are still extracting.

[Notes_On_Method_renamer]
Method "renamer" is the default which will cause CouchPotato to move and rename downloaded files
as specified in the CouchPotato renamer settings.
This will also add the movie to the manage list and initiate any configured notifications.
In this case your nzb client must extract the files to the "from" folder
as specified in your CouchPotato renamer settings. Renamer must be enabled
but automatic scan can be disabled by setting "Run Every" to "0".

[Notes_On_Method_manage]
Method "manage" will make CouchPotato update the list of managed movies if manager
is enabled but renamer is not enabled.
In this case your nzb client must extract the files directly
to your final movies folder (as configured in CouchPotato manage settings) and Manage must
be enabled.

3. If you have added .py to your PATHEXT (in windows) or you have given nzbToCouchPotato.py executable
permissions, or you are using the compiled executables you can manually call this process outside of
your nzb client for testing your configuration or in case a postprocessing event failed.
To do this, execute nzbToCouchPotato.py e.g. via ssl issue the following command:
$ ./nzbToCouchPotato.py when in the directory where nzbToCouchPotato.py is located.

### SABnzbd
If you are using SABnzbd perform the following steps to configure postprocessing for "nzbToCouchPotato":

1. In SABnzbd go to "Config" -> "Folders", then configure in the section "User Folders"
the option "Post-Processing Scripts Folder" with the path where you keep the post-processings scripts for SABnzbd.

2. Then go to "Config" -> "Categories"
and configure the category which you want to use for CouchPotato (eg. movies)
then select "nzbToCouchPotato.py" as the script that shall be executed after the job was finished by SABnzbd.

3. For better handling of failed downloads in version 0.7.5 of SABnzbd a new special parameter named "empty_postproc" was introduced,
so at last go to "Config" -> "Special" in the web-interface and tick the option "empty_postproc".

Description of this special parameter according to SABnzbd manual:
> Do post-processing and run the user script even if nothing has been downloaded.
This is useful in combination with tools like SickBeard, for which running the script on an empty or failed download is a trigger to try an alternative NZB.
Note that the "Status" parameter for the script will be -1. [0.7.5+ only]

### NZBGet
If you are using NZBGet perform the following steps to configure postprocessing for "nzbToCouchPotato":

1. Replace the config files with the ones from the download below according to the version you are using (0.8.0 or 9.0):
https://github.com/downloads/thorli/nzbToCouchPotato/nzbget-postprocessing-files.zip

These files enable additional postprocessing settings for CouchPotato (and SickBeard as well) in the NZBGet webinterface.
If NZBGet is running either restart (0.8.0) or reload (9.0) to activate the changes after you have replaced the files.
To be on the safe side, don't forget to make a backup of the existing files!

2. In NZBGet go to "POSTPROCESSING SCRIPT" -> "PATHS" and apply the option "NzbToCouchpotato" according to your environment,
this setting configures the path where NZBGet has to look for "nzbToCouchpotato.py".

3. Then go to "POSTPROCESSING SCRIPT" -> "OPTIONS" and set there the category which you want to use for CouchPotato post-processing.
32 changes: 32 additions & 0 deletions nzbToCouchPotato.py
@@ -0,0 +1,32 @@
#!/usr/bin/env python

import sys
import autoProcessMovie

# SABnzbd
if len(sys.argv) == 8:
# SABnzbd argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# 3 Clean version of the job name (no path info and ".nzb" removed)
# 4 Indexer's report number (if supported)
# 5 User-defined category
# 6 Group that the NZB was posted in e.g. alt.binaries.x
# 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2
print "Script triggered from SABnzbd, starting autoProcessMovie..."
autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[7])

# NZBGet
elif len(sys.argv) == 3:
# NZBGet argv:
# 1 The final directory of the job (full path)
# 2 The original name of the NZB file
# From NZBGet only successful downloads are triggered so status is set to "0"
print "Script triggered from NZBGet, starting autoProcessMovie..."

autoProcessMovie.process(sys.argv[1], sys.argv[2], 0)

else:
print "Invalid number of arguments received from client."
print "Running autoProcessMovie as a manual run..."
autoProcessMovie.process('Manual Run', 'Manual Run', 0)
20 changes: 0 additions & 20 deletions sabToCouchPotato.py

This file was deleted.

0 comments on commit 301e889

Please sign in to comment.