Menu

Sjq4Comskip1

Anonymous

Introduction

This document will guide you through a complete example of how to setup comskip. This is only one way to do this, there are many other ways to accomplish this task in SJQv4. As a matter of fact, you'll find there are many different ways to do the same thing in SJQv4. This is the advantage of moving to a proper, complete scripting environment for SJQv4.

Separating SD and HD Comskip Tasks

My first requirement is that I needed to separate SD and HD tasks. Processing H.264 video is way more taxing on my system that processing MPG2 so I want to separate the two types of tasks. So for this reason, I have two different comskip tasks defined in my setup: "SDCOMSKIP" and "HDCOMSKIP". So for any recording I want comskipped I will actually queue up an SD and HD comskip task and then one of them will be skipped and the other will run, as desired.

Configure the HDCOMSKIP and SDCOMSKIP Tasks

First, you need to configure one or more task clients to perform these tasks. This document assumes you've already installed and configured the engine and at least one task client. See the User Guide if that's not the case.

NOTE: You must have the SJQv4 GUI plugin installed to perform the following actions as described in the document.

Go to Setup > SJQ > Show Clients and select the client you wish to configure. Click on Create New Task. The following screen shot shows my setup. You can copy everything you see, but obviously some paths will have to be changed for your setup.

  • Executable: The path to your comskip exe. I use ShowAnalyzer, you can use whatever you like.
  • Executable Arguments: The variables you see there come from here. It is important to realize that $SJQ4_PATH is the path of the file as reported by the SageTV core. If you are running a task client on a machine other than your SageTV server and the path is not UNC then you CANNOT use the $SJQ4_PATH variable. Instead you will have to wrap your task in a script and convert the $SJQ4_PATH variable manually.
  • Test Script: You can download the test script from here. Copy it and configure this path appropriately for your system.
  • Test Script Args: For SD recordings, the file should have a mpg extension.
  • Max Instances: How many SDCOMSKIPs do you want to run simultaneously? I've chosen two for my setup; configure accordingly.
  • Max/Min Return Code: ShowAnalyzer, like most programs, returns zero on success and any other value means failure. comskip.exe returns zero OR one on success. Configure appropriately.
  • Max Time: Tell SJQ how long this task can run before automatically killing it. This value is in seconds. Do not use the run time ratio setting; it's currently not implemented.
  • Resources: How many resources does this task require? All task clients have exactly 100 resources by default. Tasks only run if there are enough free resources to run them.
  • Schedule: When can this task run? ON means 24x7, OFF means never (i.e. disabled) or you can provide a crontab schedule string for this task, which gives very flexible, powerful scheduling capabilities for your tasks. Details on crontab values can be found here.
  • Max Time Ratio: Currently not implemented.

Save the SDCOMSKIP task and create a new one, HDCOMSKIP. Basically the same thing except replace the mpg arg with ts. You should now have a task client configured to run both SDCOMSKIP and HDCOMSKIP tasks. Now you're ready to queue up tasks to be executed.

Queuing the Comskip Tasks

I've decided to queue up comskip tasks by attaching them to favourites. The advantages of this approach are:

  • I only attach comskip tasks to favourites I know will have commercials; favourites recording from HBO, movie channels, PPV, etc. will never queue up comskip tasks
  • I do not need to create a pretest to check which channel the recording is coming from to decide if I need to comskip the recording.

Disadvantages:

  • Manual, IR, and live tv recordings do not have comskip tasks automatically created. I consider this an advantage because I never want to comskip IR and live tv recordings and when you create a manual recording you'll be given the opportunity to assign tasks for it. Some people may want comskip tasks created for all recordings; another example doc will discuss that option.

For this example, I'll be attaching the comskip tasks to a favourite I already have setup for The Office. Go to Setup > SJQ > Manage Favorites and select any favourite you wish to setup comskip for. Select Add beside SJQ Actions, as shown below.

Next, select SDCOMSKIP and HDCOMSKIP as the tasks to run when this favourite records. You'll notice that I've chosen to queue the tasks when the recording starts. You could also choose to wait and queue the tasks until the recording has stopped. The choice is yours.

Configure Pretest

When you created the tasks you defined a pretest and copied the comskip_test.groovy file. Open that file now. Ignore everything in the file except for the block shown below.

/*************** CONFIGURE VALUES IN THIS BLOCK ONLY! ***************/

boolean checkRecordingType = true; // Check the recording is of the type specified on the command line (i.e. only process mpg recordings)
boolean checkForEdl = true;        // If true, mark the task as skipped if an edl already exists
String edlType = "edl";            // The edl extension (i.e. some people use .txt comskip files instead of .edl files)
boolean comskipLive = false;       // If false, this test will push the task back to the queue while the recording is in progress

/********************************************************************/

You can configure the pretest by changing the values in this block. The comments explain what each option controls. For boolean options you can set them to true or false (case sensitive). The checkForEdl option will skip the task if an edl (or equivalent) already exists for the recording. The comskipLive option will delay the start of comskip until the recording completes.

All Done!

Hopefully, your comskip tasks are being queued. If not then go over this example again and ask questions in the SJQv4 user forum as necessary.


Related

wiki-import: Sjq4Metadata
wiki-import: Sjq4UserGuide