[Windows] Post Processing Scripts

Come up with a useful post-processing script? Share it here!
ipnface
Newbie
Newbie
Posts: 1
Joined: April 28th, 2011, 4:52 pm

Re: [Windows] Post Processing Scripts

Post by ipnface »

Hi,

I'm a bit stuck trying to get this script to work and would greatly appreciate any help! I primarily want the avi join feature
to work, but at present nothing works!

I have put mencoder.exe and movies.exe and the config file into the script folder. I have changed the config file to use a set log file path and to point  to my movies directory.

SABnzbd reorganises and renames the downloaded file and folder and places them in a completed download folder for movies.
The movies script then starts but windows 7 just says it has stopped working and nothing happens.

I have .Net Framework 4.0, but not 2.0 and am running x86 Win7. I have not changed the path variable as mencoder is left in the script folder.

There is no log created. I don't know how to run the script manually.

What have I missed? Appreciate any help!
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: [Windows] Post Processing Scripts

Post by markus101 »

It sounds like the application is is launching, which is good, Windows 7 should already come with .Net 2.0, so that doesn't seem to be the issue.

Have you tried running the application manually? Pass in the path to the video (wrapped in quotes if it contains spaces), 2, then the NZB title, for example:

Code: Select all

movies.exe "C:\Path\To\Movie" 2 "Movie Name"
Any errors should then be written to the command window.

Does the path that you configured for the log directory exist, if the folder doesn't exist this could be the issue.

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
Dekks
Newbie
Newbie
Posts: 2
Joined: May 8th, 2011, 9:44 am

Re: [Windows] Post Processing Scripts

Post by Dekks »

I can't seem to make SABnzbd run a script automatically after each item downloads.

I have a simple script that runs a program which converts MKVs into xbox360 friendly mp4s. At one point, after each download was completed, SABnzbd would automatically launch the script on each item in turn, now it only launches the script if I individually mark each item in the queue to run the script, otherwise it doesn't appear to fire at all.

I'm not doing a great of explaining it I think, but essentially it seems that the default behaviour is to not run any post processing scripts, even though I have the script selected in the 'On queue finish' drop down. Yet if I select the script manually for each item on my queue, it'll run without any problems at all.

Is there any way to make my script run after each item is downloaded? (Note there is no problem with the script itself, I just don't know how to make it be included in the normal processing actions after each download without manually selecting it).
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: [Windows] Post Processing Scripts

Post by markus101 »

You don't want it to run when the queue is finished (that won't do anything for each of the items), you want to setup the default script, for Plush on 0.6.0 its set here on the Categories Config Page: http://localhost:8080/config/categories/ is the default URL.

You can also configure it to only run for a specific category here as well.

Hope that helps:

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
Dekks
Newbie
Newbie
Posts: 2
Joined: May 8th, 2011, 9:44 am

Re: [Windows] Post Processing Scripts

Post by Dekks »

markus101 wrote: You don't want it to run when the queue is finished (that won't do anything for each of the items), you want to setup the default script, for Plush on 0.6.0 its set here on the Categories Config Page: http://localhost:8080/config/categories/ is the default URL.

You can also configure it to only run for a specific category here as well.

Hope that helps:

-Markus
Yep that is exactly what I was looking for, I had assumed that section was purely for when using category based NZB index sites and never given it more than a cursory glance. My script is now the default action for all downloads which is exactly what I wanted (as if the file is not a MKV, it is ignored by the script).

I feel rather foolish for not figuring this out myself :)
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: [Windows] Post Processing Scripts

Post by markus101 »

Haha, it's quite alright, glad its sorted now.

Enjoy the automation support that SABnzbd provides, I hardly have a reason to look at the SMB shares anymore.  ;D

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
neuralclone
Newbie
Newbie
Posts: 3
Joined: June 9th, 2011, 12:16 am

Re: [Windows] Post Processing Scripts

Post by neuralclone »

Hey Markus, quick question - I've been using movies.exe for a while now and have a problem I can't figure out.

Everything works fine except for the XBMC Library Update. The script runs successfully it seems, and it does move the movie to the right place and deletes the leftover folder with no problem.

However, in XBMC I always need to do a manual library update to see the movie.

Is there any way I can check/verify what the problem is? Running Windows 7 with XBMC 10.1. I have no password set for XBMC, so maybe that has something to do with it?

Here's my config:

Code: Select all

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="logDir" value="E:\Logs"/>
    <add key="movieDir" value="E:\Movies"/>
    <add key="hdMovieDir" value="E:\Movies"/>
    <add key="ipodMovieDir" value="E:\Movies"/>
    <!--Delete Movie Folder?-->
    <add key ="deleteFolder" value="true"/>
    <!--Use Folder Name as Movie Name?-->
    <add key="useFolderName" value="true"/>
    <!-- Update XBMC Library?-->
    <add key ="updateXbmc" value="true"/>
    <!-- XBMC Path to Movies-->
    <add key ="xbmcMoviePath" value="E:\Movies"/>
    <!-- XBMC Path to HD Movies-->
    <add key ="xbmcHdMoviePath" value="E:\Movies"/>
    <!-- XBMC Hostname/IP Address-->
    <add key ="xbmcInfo" value="localhost"/>
    <!-- XBMC HTTP Username-->
    <add key ="xbmcUsername" value="xbmc"/>
    <!-- XBMC HTTP Password-->
    <add key ="xbmcPassword" value=""/>
  </appSettings>
</configuration>
Thanks a bunch!
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: [Windows] Post Processing Scripts

Post by markus101 »

I believe you are using an older version of the Movies script (The config file looks to be incorrect), the new one no longer uses the HTTP Server (which is being deprecated from XBMC), but uses the EventServer, it looks like you have XBMC on the same machine, so you will need to ensure under XBMC Network Settings you have "Allow Programs on this System to Control XBMC" enabled.

Hopefully this helps, if not, if you can post you log or part of the log on pastebin (or similar) I may be able to look into it further.

Downloads, 2.4 is the latest version online for Movies.exe.

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
neuralclone
Newbie
Newbie
Posts: 3
Joined: June 9th, 2011, 12:16 am

Re: [Windows] Post Processing Scripts

Post by neuralclone »

Thanks for the reply! I am using 0.2.4, I verified that. I compared my config file to the one from a new download of 0.2.4 and they look the same to me (didn't see any differences beyond the default values), but maybe I am wrong.

I am running XBMC on the same machine, and I do have "Allow Programs on this System to Control XBMC" enabled (I use Sick Beard pretty heavily). Funny thing is that Movies.exe, despite working, has never written out log files for me, despite defining the directory. Are there any tests I can do or special commands I can run to make it output a log file? That would certainly be helpful.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: [Windows] Post Processing Scripts

Post by markus101 »

Sorry about that, I was incorrect in saying that the config may have been wrong, this was due to myself using a modified version that no longer used the HTTP server, but used the Event Server.

I was able to do some testing with the version 2.4 and ran into no issues when XBMC was set to no password.

Upon looking at your config once again I think the issue is that you have not set which port the XBMC web server is running on, your xbmcInfo line should be:

Code: Select all

<add key ="xbmcInfo" value="localhost:8000"/>
Where 8000 is the default port that XBMC uses. I believe SickBeard uses the HTTP server so that should already be enabled, "Allow Control of XBMC via HTTP" should already be set in XBMC.

Hopefully I have it right this time.

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
neuralclone
Newbie
Newbie
Posts: 3
Joined: June 9th, 2011, 12:16 am

Re: [Windows] Post Processing Scripts

Post by neuralclone »

It works now! Looks like the problem was not having the port defined. Fixed that and it updated correctly. Thanks so much Markus, you're a genius :)
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: [Windows] Post Processing Scripts

Post by markus101 »

Awesome! Happy to help.

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
apawsey
Newbie
Newbie
Posts: 3
Joined: July 13th, 2011, 7:27 am

Re: [Windows] Post Processing Scripts

Post by apawsey »

Just a note markus, when joining movies, with the deletefolder option off, the resulting movie does not get moved to the new folder in the destination directory, but rather just to the destination directory.

Just to outline...
Source folder D:\MyMovie
Source files D:\MyMovie\MyMovie.cd1.avi D:\MyMovie\MyMovie.cd2.avi
Destination folder E:\Movies

Result
Destination folder contains E:\Movies\MyMovie
Destination file is E:\Movies\MyMovie.avi

Problem comes because in the parameters passed to mencoder, the destination file path does not contain the film folder name, just the destination folder.

I'm going to ask a really cheeky question. I would like to develop another post-processing script for myself based on the mencoder approach you used. Would you mind? I just ask because I don't want you to be offended if I end up posting it here.

Thanks,
Adam.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: [Windows] Post Processing Scripts

Post by markus101 »

Based on the code, specifically these two lines (when it should keep the folder)

Code: Select all

string aviMovieDir = _movieDir + "\\" + movieName;
movieFilename = aviMovieDir + "\\" + movieName + ".avi";
It does put the file into the folder, but It isn't something that I use and the lack of unit tests means issues slip through.

By all means feel free to create your own script, most of mine are customizations of others I have found, or pieces I have found useful and please post your script so everyone can benefit.

-Markus
apawsey
Newbie
Newbie
Posts: 3
Joined: July 13th, 2011, 7:27 am

Re: [Windows] Post Processing Scripts

Post by apawsey »

I downloaded the version from google code, and looking at in reflector, the code clearly does not reference the avi movie folder... perhaps I've somehow managed to get an out of date version???

But thanks for the reply anyway!
Locked