SageTV Community

SageTV Community (
-   SageTV Customizations (
-   -   ComChecker for Linux/Mac Script Version (

bcjenkins 09-13-2009 03:11 PM

ComChecker for Linux/Mac Script Version is the script only version of the ComChecker software application for Mac. This script is designed to work on Linux and Mac and should be executed as a background process. I run this command on my server to execute and leave running as user sagetv:


su -c 'nohup /opt/sagetv/scripts/ 2>/dev/null 1>/dev/null &' sagetv
For the default root user version run as:


nohup /opt/sagetv/scripts/ 2>/dev/null 1>/dev/null &
Assumes script is placed in the path as noted.


To use this script you must have WINE installed for your distro. It is also helpful to be using the donator version of comskip if you want to scan HDPVR files. Support for comskip as it pertains to accuracy, etc., can be found here. Please edit the script in your favorite editor and adjust the values as needed. Beginning in this version, I have added the ability to specify different multipliers so that you can control how many processes run on a per file type basis. This is handy because TS file scanning is more costly than MPG file scanning.

E.g.: If you set a base number of 50 and your MPG files are set to 10, you will be able to run 5 simultaneous executions of comskip.exe.

All math is treated in whole numbers, please increase the SIMUL variable to fine tune the numbers.

Questions on usage and bug reports should be handled in this thread.

Download here.



Version .6 - 10-31-2009
Added support for nice. Per a user PM request. Thanks!
Version .5 - 9-20-2009
Added the capability to filter shows based on channel id. This requires the use of Stuckless' sagex.api plugin.

chip33az 11-04-2009 11:11 AM

Thank you for writing this!

I was able to set it up and it does find the .mpg files and runs comskip on them, but it doesn't seem to be deleting the old files (edl, txt, etc).

I ran the comchecker program and it says

Looking for old files

Find: paths must precede expression: readme.txt
(along with some other items).

Any suggestions?

chip33az 11-05-2009 11:03 AM

After looking at this for a bit the problem has to do with the txt extension. I really don't know why.

If I do a find for log, edl, etc, everything works. Once I put in txt it crashes.

I removed txt from the CHKEXT array and that seems to have solved it (at least for me).

bcjenkins 11-05-2009 01:01 PM

How does it crash? Is there an error?


chip33az 11-05-2009 01:56 PM

It doesn't crash, but it didn't remove old files. When the program ran, it would show:
Looking for old files

Find: paths must precede expression: readme.txt
(along with some other items).
It would never delete the old files. I found on my box that if I just ran find -name *.txt, I would see the same message. If I ran find -name *.edl, it would show a listing of the files with the edl extension.

I don't know why it doesn't like the txt.

bcjenkins 11-05-2009 03:12 PM

What about

find /var/media/tv -type f -name *.txt

I am working on rewriting that section anyways because it was ugly. But I am still using find. Also, what happens if edl is first in the order?


PS find --version?

find (GNU findutils) 4.4.2

bcjenkins 11-05-2009 08:10 PM

You can test this section of code in the script to see if it solves your problems. Please copy some files to a different directory to test against.


FILE_LIST=$(find ${TVPATH[$x]} -type f | sed 's/.*\///' | cut -d '.' -f1 | uniq)
for FILE in ${FILE_LIST}
        if [[ ! $(find "${TVPATH[$x]}" -type f -regextype posix-awk -regex "(.*.$(echo ${EXTEN[*]}|sed 's/ /\|\.\*\./g'))" | grep "${FILE}") && "${FILE}" != "images" ]]; then
                echo "find ${TVPATH[$x]} -type f -delete -name ${FILE}.*"
                find ${TVPATH[$x]} -type f -delete -name ${FILE}.*


chip33az 11-09-2009 01:13 PM

I created a separate directory and placed some files in it. I modified the to use your new code.

While I don't see any error messages pop up, it does say it is looking for old files, but never displays a listing of files and it never deletes anything.

I made sure to delete one .mpg file to test.

bcjenkins 11-09-2009 03:47 PM

You're right.. I thought it was working, but try this one:


FILE_LIST=$(find ${TVPATH[$x]} -type f | sed 's/.*\///' | cut -d '.' -f1 | uniq)
  for FILE in ${FILE_LIST}
      if [[ -z $(find "${TVPATH[$x]}" -type f -regextype posix-awk -regex "(.*.$(echo ${KEEP[*]}|sed 's/ /\|\.\*\./g'))" | grep "${FILE}") && "${FILE}" != "images" ]]; then
        echo "Deleting file(s): ${TVPATH[$x]}/${FILE}.*"
        rm -i ${TVPATH[$x]}/${FILE}.*

Change -i to -f when ready to let it go.


btf1962 04-30-2010 02:33 PM

Trouble with curl
I need a little help. seems to work for me with one exception. The curl invocations to query the AiringChannel do not work for me.

Here are the config variables I used:


# SageTV Specific feature: Check recording channel and skip if listed.
SAGETV_SKIP_CHAN=( WXXIDT WXXIDT2 WXXIDT3 ) # This is the channel id. eg ( NBC PBS )

Which produces the following curl invocation:


curl --user myname:apassword --silent 'http://localhost:8080/sagex/api?c=GetMediaFileForFilePath&1=/var/media/tv/TheOffice-BodyLanguage-23396-0.mpg'
Which produces the following output:


<HTML><HEAD><TITLE>404 Not found</TITLE></HEAD><BODY BGCOLOR="#F1D0F2"><H2>404 Not found</H2><HR/><ADDRESS><A HREF="">Rogatkin's JWS based on Acme.Serve $Revision: 1.26 $</A></ADDRESS></BODY></HTML>
I've experimented by hand with a few things. Supposedly this is supposed to produce output but I get the same "404 Not Found":


curl --user myname:apassword --silent 'http://localhost:8080/sagex/api?c=GetMediaFiles&1=T'
What works successfully are commands like:


curl --user myname:apassword --silent 'http://localhost:8080/sage/Home'
I realize this uses a different interface which makes me believe my /opt/sagetv/server/webserver/ values are not set correctly.

Here's my latest (unworking) iteration of


# Username/passwords for protected web pages
# Format:
#    Prompt=/path,user:password
# multiple users/passwords can be given for the same prompt/path

# Example customsation
# The following lines protect pages that perform actions
# with different username/password, giving 2 levels of
# priviledge: read-only and read-write
# these must be put before the top level user/password for them
# to take effect.
# replace write:only with a username:password of your choice
# you can also add this username:password as a top level password (below) so that
# it can also be used for read-only actions.
SageTV Web Actions=/sage/Command,myname:apassword
SageTV Web Actions=/sage/AiringCommand,myname:apassword
SageTV Web Actions=/sage/ManualRecord,myname:apassword
SageTV Web Actions=/sage/ResolveConflict,myname:apassword
SageTV Web Actions=/sage/TimedRecord,myname:apassword
SageTV Web Actions=/sage/MediaFileCommand,myname:apassword
SageTV Web Actions=/sage/GlobalCommand,myname:apassword
SageTV Web Actions=/sage/EditShowInfo,myname:apassword
SageTV Web Actions=/sage/EncodeCommand,myname:apassword
SageTV Web Actions=/sage/FavoriteCommand,myname:apassword

SageTV Web Actions=/sages/api,myname:apassword
SageTV Web Actions=/sagex/api,myname:apassword

# top level user:password
SageTV Web Interface=/sage,myname:apassword
SageTV Web Interface=/sages,myname:apassword
SageTV Web Interface=/sagex,myname:apassword

# note that there is now a url defined in
# defined as /sagepublic/MediaFile
# this should be left unprotected to allow media players to play
# files without specifying a username/password.

From the webserver JAR files I have only unzipped the ones in italics:




Do I need more? Perhaps nielm_sagexmlinfo.jar?

btf1962 04-30-2010 03:01 PM

Trouble with curl
OK. I fixed it by following the instructions on this page

All times are GMT -6. The time now is 02:59 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.