diff options
Diffstat (limited to 'abs/core/linhes-scripts')
-rw-r--r-- | abs/core/linhes-scripts/PKGBUILD | 18 | ||||
-rw-r--r-- | abs/core/linhes-scripts/find_orphans.py | 2 | ||||
-rw-r--r-- | abs/core/linhes-scripts/screenshooter.sh.orig | 224 |
3 files changed, 10 insertions, 234 deletions
diff --git a/abs/core/linhes-scripts/PKGBUILD b/abs/core/linhes-scripts/PKGBUILD index 1dfe1ed..4d851d8 100644 --- a/abs/core/linhes-scripts/PKGBUILD +++ b/abs/core/linhes-scripts/PKGBUILD @@ -3,12 +3,12 @@ pkgname=linhes-scripts pkgver=7 -pkgrel=51 +pkgrel=46 pkgdesc="Various scripts that help to make LinHES, LinHES." arch=('i686' 'x86_64') license=('GPL2') depends=('xosd' 'cpulimit' 'screen' 'mencoder' 'tablet-encode' 'mplayer' - 'normalize' 'handbrake-cli' 'mkvtoolnix' 'gnu-netcat') + 'normalize' 'handbrake-cli' 'mkvtoolnix') url="http://linhes.org/" install="linhes-scripts.install" source=( @@ -59,7 +59,7 @@ build() { cd ${srcdir} install -d ${pkgdir}/usr/LH/bin install -d ${pkgdir}/usr/LH/etc - install -D -m755 myth2* *.sh *.pl *.py vdpau* run-* LinHES* ${pkgdir}/usr/LH/bin/ + install -D -m755 myth2* *.sh *.pl *.py vdpau* run-* pause_* LinHES* ${pkgdir}/usr/LH/bin/ install -D -m755 upgrade_screen_rc ${pkgdir}/usr/LH/etc/ mkdir -p ${pkgdir}/etc/sv/pause-mythcommflag/supervise cp run-pause-mythcommflag ${pkgdir}/etc/sv/pause-mythcommflag/run @@ -77,15 +77,15 @@ md5sums=('f56985b2d602e11dc1e10d3e7848b2a5' 'f8df7665903ddf822f5148bc8a074e4a' '18263972b6326e140bbef0bb7dfa2da9' '410795ef9039e4c6c0484e706ecfd567' - 'ad98d51e79f83df7c03f828dbeaea7f4' + '0750d7c65109d12aa536f312a38410d1' 'ac2a4a6b4100f4d7bfb9ecd9356c8c6e' 'd2b475821f902c5e081e7da43a35e6ac' '95c092f67036a361ef7a57436f44332e' - '92950f0ffb1faf1ed64c6be2b8fbc3f6' + '565ebca7b88bcd083322b7324f8e56e5' '3b776bbff68906ddc2f62b7e0dde3fe4' - 'a57641fb63d7bb6d92a438f1ea779a57' + '15f3143d2b1369da431e4268029aba40' '3d0adf26280cde55a0c47188fff34826' - 'c3ada01d3a739abe3f920b02d4ea3f6e' + '25dd5b8ec0482d561b481bfce051d648' 'b2c3dd48a4abb976eda2d5fbf22a173a' 'b527b01d119d3bc33b8fa69bdf1082bb' '9d077c24d102fa02e4f417d639d8b00a' @@ -103,9 +103,9 @@ md5sums=('f56985b2d602e11dc1e10d3e7848b2a5' 'a94fe6d980f4b810f2e2ae5352084b39' '974c137d3fcb85942ba8945a1bc815fe' 'f454faeabfa153b10389a9a3bfd51c4a' - 'd8838461af9d446a1fd7e7883fdc75d1' + '34fc1f58ad1eabf4eff4979d420760c0' 'cc9cdabcdfc969c2829b58c0e513488c' '54a478660d0f8150fe10112a9ecf2740' - '503df99218373dfc75e7e7f5e449a44e' + 'bb8eae5de8a0d22f1722b3e7b2e32468' 'b608044c9e7530a400d8f5b88fdfe6e6' 'e2e24dd59d5d576cc33feafb329fa302') diff --git a/abs/core/linhes-scripts/find_orphans.py b/abs/core/linhes-scripts/find_orphans.py index ec2cae1..cdc03d4 100644 --- a/abs/core/linhes-scripts/find_orphans.py +++ b/abs/core/linhes-scripts/find_orphans.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 from MythTV import MythDB, MythBE, Recorded, MythError from socket import timeout diff --git a/abs/core/linhes-scripts/screenshooter.sh.orig b/abs/core/linhes-scripts/screenshooter.sh.orig deleted file mode 100644 index 72f6cc0..0000000 --- a/abs/core/linhes-scripts/screenshooter.sh.orig +++ /dev/null @@ -1,224 +0,0 @@ -#!/bin/bash - -# Written by Bob Igo from the MythTV Store at http://MythiC.TV -# with contributions from TJC and Sarah Hayes -# Email: bob@stormlogic.com -# -# If you run into problems with this script, please send me email - -# This is alpha code to auto-generate thumbnails for previews in MythVideo. -# It won't currently work on some filenames that have spaces in them. -# It's surely just a matter of escaping or quoting, but I have yet to find -# the right incantation. - -# example usage: -# find -L /myth/video -wholename '*.covers' -prune -o -name '*.resume' -o -type f -exec screenshooter.sh -v {} \; - -# limitations: -# -- -# In an MBE/SBE/FE setup this might get the settings for the wrong machine... -# The script has no AI to know if a grabbed frame is useful to identify the video, only that it was able to grab it. -# Doesn't clean up after itself if videos are deleted, though MythTV may do this on its own. -# Minimum theoretical compatible video length is 4 seconds. Shorter videos will not work with this version. -# Surely more limitations I can't think of because it's my baby :) - -Usage() { - echo "USAGE:" - echo `basename $0` "-v PATHNAME [-s SECONDS] [-c] [-b HOSTNAME] [-u USERNAME] [-p PASSWORD] [-o]" - echo "-v: pathname to Video" - echo "-s: number of Seconds to skip before capturing (270 by default)" - echo "-c: Clobber any previous screenshot found for this video (off by default)" - echo "-b: mysql server (Backend) hostname (localhost by default)" - echo "-u: mysql Username (mythtv by default)" - echo "-p: mysql Password (mythtv by default)" - echo "-o: verbOse mode (off by default)" - echo "-x: check for valid video eXtension (off by default)" - echo - echo "EXAMPLE: $0 -v /myth/video/HDTV/shuttle.mpg -c -s 30" - exit 3 -} - -if [ -z $1 ]; then - Usage -fi - -V_MISSING=1 - -while getopts "v:sbupochx" FLAG ; do - case "$FLAG" in - v) VIDEO_PATHNAME="$OPTARG" - V_MISSING=0;; - s) SKIPAHEAD="$OPTARG";; - c) CLOBBER=1;; - b) BACKEND_HOSTNAME="$OPTARG";; - u) DBUSERNAME="$OPTARG";; - p) DBPASSWORD="$OPTARG";; - o) VERBOSE=1;; - x) EXTENSION_CHECK=1;; - *) Usage;; - esac -done - -if [ $V_MISSING == 1 ]; then - Usage -fi - -# Declaring Variables here and assigning sensible defaults. - -# SKIPAHEAD is the number of seconds to skip ahead before starting the frame capture. -# Set it to an arbitrary value if none is specified. -SKIPAHEAD=${SKIPAHEAD:-"270"} -BACKEND_HOSTNAME=${BACKEND_HOSTNAME:-"localhost"} -DBUSERNAME=${DBUSERNAME:-"mythtv"} -DBPASSWORD=${DBPASSWORD:-"mythtv"} -# Defaults to quiet. -VERBOSE=${VERBOSE:-0} -# Unless otherwise told, do not clobber existing cover files. -CLOBBER=${CLOBBER:-0} -# Unless otherwise told, do not check the file extension against -# MythTV's list of registered video file types. -EXTENSION_CHECK=${EXTENSION_CHECK:-0} - -VIDEO_CAPTURE_HOME=$(mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -sNBe "select data from settings where value='VideoArtworkDir' limit 1") -if [ ! -d "$VIDEO_CAPTURE_HOME" ] ; then - echo "Directory $VIDEO_CAPTURE_HOME does not exist, nowhere to put the screen shot!" - echo "Have you configured MythVideo yet?" - exit 1 -fi - -VIDEO_HOME=$(mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -sNBe "select data from settings where value='VideoStartupDir' limit 1") -if [ ! -d "$VIDEO_HOME" ] ; then - echo "Directory $VIDEO_HOME does not exist, nowhere to put the screen shot!" - echo "Have you configured MythVideo yet?" - exit 1 -fi - -VIDEO_FILENAME=$(basename "$VIDEO_PATHNAME") -VIDEO_EXTENSION=${VIDEO_FILENAME##*.} -# Since we cron'd lets first make sure the validity of the file -if [ "$EXTENSION_CHECK" == "1" ]; then - EXCHECK=$(mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -sNBe "select f_ignore from videotypes where extension=\"$VIDEO_EXTENSION\";") - #excheck returns blank, it found nothing. - if [ "$EXCHECK" == "" ]; then - if [ "$VERBOSE" == "1" ]; then - echo "$VIDEO_EXTENSION does not appear to be a valid media file, skipping." - fi - exit 1 - else - # It is valid, but should we ignore it. If so then excheck will equal 1. - if [ "EXCHECK" == "1" ]; then - if [ "$VERBOSE" == "1" ]; then - echo "$VIDEO_EXTENSION is set to ignore." - fi - exit 1 - fi - # It is valid, it's not set to ignore. - if [ "$VERBOSE" == "1" ]; then - echo "$VIDEO_EXTENSION appears in the Database, checking further." - fi - EXCHECK=$(mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -sNBe "select title from videometadata where filename=\"$VIDEO_PATHNAME\";") - #Right, the file is supposed to be playable. Has it been imported to the Db yet? - if [ "$EXCHECK" == "" ] ; then - if [ "$VERBOSE" == "1" ]; then - echo "$VIDEO_FILENAME does not exist in the database." - fi - exit 1 - # If you decide you want the system to 'auto import' the video then comment out - # the exit line and uncomment the rest of it. Bewarned, this is sucky SQL at - # the best but will give sensible defaults. - # - # if [ "$VERBOSE" == "1" ]; then - # echo "Importing $VIDEO_FILENAME in to database." - # fi - # mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -sNBe "insert into videometadata (intid, title, director, plot, rating, inetref, year, userrating, length, showlevel, filename, coverfile, childid, browse, playcommand, category) values (' ', '$VIDEO_FILENAME', 'Unknown', 'Unknown', 'NR', '00000000', 1895, 0.0, 0, 1, '$VIDEO_PATHNAME', 'No Cover', -1, 1, ' ', 0);" - fi - fi -fi - -if [ "$CLOBBER" -eq 0 ]; then - # Since we're not clobbering, first check to see if this video already has a coverfile entry in MySQL: - SQL_CMD="select coverfile from videometadata where filename=\"$VIDEO_PATHNAME\";" - CURRENT_COVERFILE=`mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -B -e "$SQL_CMD" | tail -1` - - if [[ "$CURRENT_COVERFILE" != "" ]] && [[ "$CURRENT_COVERFILE" != "No Cover" ]]; then - # there's already a cover file for this video - if [ "$VERBOSE" == "1" ]; then - echo "$VIDEO_FILENAME has cover file, skipping." - fi - exit 2 - fi -fi - - -# Swap the video file extension for png. Should work assuming the extension only appears ONCE! -VIDEO_CAPTURE_PATHNAME="$VIDEO_CAPTURE_HOME/$VIDEO_FILENAME.png" - -# How many frames of video to capture. We'll grab the last frame as our screenshot. -if [ "$VIDEO_EXTENSION" == "m4v" ]; then - FRAMES_TO_CAPTURE="90" -else - FRAMES_TO_CAPTURE="05" -fi - -SHOTFILE="000000"$FRAMES_TO_CAPTURE".png" -VIDEO_STATS="/tmp/screenshooter_video_stats.txt" - -cd /tmp - -# The video we're processing may be shorter than SKIPAHEAD seconds. -# Keep trying to capture until we find a SKIPAHEAD value within the length of the video. -# Give up if we reach 0 seconds. -while [ ! -f "$SHOTFILE" ]; do - /usr/bin/mplayer -ss $SKIPAHEAD -vf scale=640:-2 -ao null -vo png -quiet -frames $FRAMES_TO_CAPTURE -identify "$VIDEO_PATHNAME" &> $VIDEO_STATS & - TIMEOUT=9 - - # Some video formats will play audio only. This loop gives the above command 20 seconds to - # finish, otherwise it gets killed. - while [ -n "`ps -p $! --no-heading`" ]; do - TIMEOUT=$(expr $TIMEOUT - 1) - if [ "$TIMEOUT" -le 0 ]; then - kill -9 $! - break - fi - sleep 1 - done - - SKIPAHEAD=$(expr $SKIPAHEAD / 2) - if [ "$SKIPAHEAD" -le 0 ]; then - break - fi -done - -if [ -f "$SHOTFILE" ]; then - # Now, the video_capture is taken, and the name of the shot is in $SHOTFILE - # Rename it and move it to the place where video_captures live. - /bin/mv -f "$SHOTFILE" "$VIDEO_CAPTURE_PATHNAME" - /bin/rm -f 000000*png - chown mythtv: "$VIDEO_CAPTURE_PATHNAME" - - # We've got the shotfile nailed, now calculate video run length. - VIDEO_LENGTH_IN_SECONDS=`grep ID_LENGTH $VIDEO_STATS | awk -F'=' '{print $2}'` - VIDEO_LENGTH_IN_INTEGER_SECONDS=${VIDEO_LENGTH_IN_SECONDS/%.*/} - if [ $VIDEO_LENGTH_IN_INTEGER_SECONDS -lt 60 ]; then - VIDEO_LENGTH_IN_MINUTES="1" - else - VIDEO_LENGTH_IN_MINUTES=$(expr $VIDEO_LENGTH_IN_INTEGER_SECONDS / 60) - fi - - SQL_CMD="update videometadata set length=\"$MIN_LENGTH\" where filename=\"$VIDEO_PATHNAME\";" - mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -e "$SQL_CMD" - - - # put the screenshot pathname and any runlength info into videometadatatable - - # Pre-escape any single or double quotes for the SQL command. - - VIDEO_CAPTURE_PATHNAME=`echo $VIDEO_CAPTURE_PATHNAME | sed -e "s/'/\\\'/g" -e 's/"/\\\"/g' ` - VIDEO_PATHNAME=`echo $VIDEO_PATHNAME | sed -e "s/'/\\\'/g" -e 's/"/\\\"/g' ` - SQL_CMD="update videometadata set coverfile=\"$VIDEO_CAPTURE_PATHNAME\", length=\"$VIDEO_LENGTH_IN_MINUTES\" where filename=\"$VIDEO_PATHNAME\";" - - mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -e "$SQL_CMD" -else - echo "No image could be captured from $VIDEO_PATHNAME" - exit 1 -fi |