SageTV Community

SageTV Community (http://forums.sagetv.com/forums/index.php)
-   SageTV Customizations (http://forums.sagetv.com/forums/forumdisplay.php?f=27)
-   -   ComChecker for Linux/Mac Script Version (http://forums.sagetv.com/forums/showthread.php?t=44165)

bcjenkins 09-13-2009 04:11 PM

ComChecker for Linux/Mac Script Version
 
ComChecker.sh 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:

Code:

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

Code:

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

Usage:

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.

Thanks,

B

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?

B

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
Code:

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?

B

PS find --version?

find (GNU findutils) 4.4.2

bcjenkins 11-05-2009 08:10 PM

CAUTION
 
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.

Code:

FILE_LIST=$(find ${TVPATH[$x]} -type f | sed 's/.*\///' | cut -d '.' -f1 | uniq)
for FILE in ${FILE_LIST}
do
        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}.*
        fi
done

B

chip33az 11-09-2009 01:13 PM

I created a separate directory and placed some files in it. I modified the comchecker.sh 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:

Code:

FILE_LIST=$(find ${TVPATH[$x]} -type f | sed 's/.*\///' | cut -d '.' -f1 | uniq)
  for FILE in ${FILE_LIST}
    do
      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}.*
      fi
  done

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

B

btf1962 04-30-2010 03:33 PM

Trouble with curl
 
I need a little help.

comchecker.sh 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:

Code:

# SageTV Specific feature: Check recording channel and skip if listed.
SAGETV_ENABLE=TRUE
SAGETV_SERVER=localhost
SAGETV_SERVER_PORT=8080
SAGETV_SERVER_USER=myname
SAGETV_SERVER_PASS=apassword
SAGETV_SKIP_CHAN=( WXXIDT WXXIDT2 WXXIDT3 ) # This is the channel id. eg ( NBC PBS )

Which produces the following curl invocation:

Code:

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:

Code:

<HTML><HEAD><TITLE>404 Not found</TITLE></HEAD><BODY BGCOLOR="#F1D0F2"><H2>404 Not found</H2><HR/><ADDRESS><A HREF="http://tjws.sourceforge.net">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":

Code:

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

Code:

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/realms.properties values are not set correctly.

Here's my latest (unworking) iteration of realms.properties:

Code:

# 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 servlets.properties
# 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:

Code:

JARs/nielm_getrssnews.jar
JARs/nielm_sageimdb.jar
JARs/nielm_sagemenureader.jar
JARs/nielm_sageutls.jar
JARs/nielm_sagewebserver.jar

JARs/nielm_sagexmlinfo.jar

Do I need more? Perhaps nielm_sagexmlinfo.jar?

btf1962 04-30-2010 04: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 08:20 AM.

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