From e009e095ff37bceb14cb89167cba2d0d347e1d5a Mon Sep 17 00:00:00 2001
From: James Meyer <jams@linhes.org>
Date: Thu, 16 Dec 2010 15:57:59 +0000
Subject: linhes-scripts: update screencapture  utils to account for change in
 the way nocover is stored in the db refs: #711 closes:#711

---
 abs/core/linhes-scripts/PKGBUILD         |  6 +++---
 abs/core/linhes-scripts/screenshooter.sh | 20 +++++++-------------
 abs/core/linhes-scripts/shootscreens.sh  | 27 ++++++++++-----------------
 3 files changed, 20 insertions(+), 33 deletions(-)
 mode change 100755 => 100644 abs/core/linhes-scripts/screenshooter.sh
 mode change 100755 => 100644 abs/core/linhes-scripts/shootscreens.sh

diff --git a/abs/core/linhes-scripts/PKGBUILD b/abs/core/linhes-scripts/PKGBUILD
index ee6b036..25ffb61 100644
--- a/abs/core/linhes-scripts/PKGBUILD
+++ b/abs/core/linhes-scripts/PKGBUILD
@@ -3,7 +3,7 @@
 
 pkgname=linhes-scripts
 pkgver=7
-pkgrel=1
+pkgrel=2
 pkgdesc="Various scripts that help to make LinHES, LinHES."
 arch=('i686' 'x86_64')
 license=('GPL2')
@@ -57,7 +57,7 @@ build() {
   cp pause_mythcommflag ${pkgdir}/etc/logrotate.d/
 }
 md5sums=('f56985b2d602e11dc1e10d3e7848b2a5'
-         '9a2181cdc0bc9cc8b42101f19620def8'
+         '448f7ff4b4acc78e2ada919d8149d014'
          '9ae2cd7a0c42d57ad8b5f515d7d60196'
          '1274bad3fb7296f00acd2d44804bad14'
          '47225fa9b6c953d56f6ede84d921a300'
@@ -74,7 +74,7 @@ md5sums=('f56985b2d602e11dc1e10d3e7848b2a5'
          '15f3143d2b1369da431e4268029aba40'
          '3d0adf26280cde55a0c47188fff34826'
          '93aaa2940e33ec9ebb305b839ac46a3e'
-         '27a8b3680f3c631a582064fd26ab8746'
+         '495e44151a06b2cc13e3fa103d6b4a1e'
          'b527b01d119d3bc33b8fa69bdf1082bb'
          'c537c44156d8404016cc4b405b092d45'
          '4e66f302a77f1a857476e7f289d0c157'
diff --git a/abs/core/linhes-scripts/screenshooter.sh b/abs/core/linhes-scripts/screenshooter.sh
old mode 100755
new mode 100644
index 3bacac1..72f6cc0
--- a/abs/core/linhes-scripts/screenshooter.sh
+++ b/abs/core/linhes-scripts/screenshooter.sh
@@ -87,16 +87,11 @@ if [ ! -d "$VIDEO_CAPTURE_HOME" ] ; then
 fi
 
 VIDEO_HOME=$(mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -sNBe "select data from settings where value='VideoStartupDir' limit 1")
-VIDEO_HOME=(${VIDEO_HOME//:/ });
-VIDEO_HOME_COUNT=${#VIDEO_HOME[@]}
-for (( i=0; i<${VIDEO_HOME_COUNT}; i++ ));
-do
-    if [ ! -d "${VIDEO_HOME[${i}]}" ] ; then
-        echo "Directory ${VIDEO_HOME[${i}]} does not exist, nowhere to put the screen shot!"
-        echo "Have you configured MythVideo yet?"
-        exit 1
-    fi
-done
+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##*.}
@@ -135,7 +130,7 @@ if [ "$EXTENSION_CHECK" == "1" ]; then
 	#    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', '', -1, 1, ' ', 0);"
+	#    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
@@ -145,7 +140,7 @@ if [ "$CLOBBER" -eq 0 ]; then
     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" != "" ]]; then
+    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."
@@ -161,7 +156,6 @@ 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"
-    SHOTFILE="000000"$FRAMES_TO_CAPTURE".png"
 else
     FRAMES_TO_CAPTURE="05"
 fi
diff --git a/abs/core/linhes-scripts/shootscreens.sh b/abs/core/linhes-scripts/shootscreens.sh
old mode 100755
new mode 100644
index bb45252..d3e8845
--- a/abs/core/linhes-scripts/shootscreens.sh
+++ b/abs/core/linhes-scripts/shootscreens.sh
@@ -10,14 +10,6 @@
 
 if [ "$1" == "1" ]; then
     OSD=1
-    . /etc/osd_cat.cfg || {
-        color=yellow
-        outline=2
-        outlinecolour=black
-        shadow=0
-        shadowcolour=black
-        font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
-    }
 else
     OSD=0
 fi
@@ -27,18 +19,19 @@ fi
     percentage=0
     # Change IFS to be a newline so that filenames with spaces will be handled properly.
     IFS=$'\n'
-    vidcount=`mysql -u root mythconverg -B -e "select filename from videometadata where coverfile=\"No Cover\";" | wc -l`
+    vidcount=`mysql -u root mythconverg -B -e "select filename from videometadata where coverfile=\"No Cover\" OR coverfile=\"\";" | wc -l`
     increment=$(expr 100 / $vidcount)
-    for vid in `mysql -u root mythconverg -B -e "select filename from videometadata where coverfile=\"No Cover\";" | grep -v -e "^filename$"`
+    for vid in `mysql -u root mythconverg -B -e "select filename from videometadata where coverfile=\"No Cover\" OR coverfile=\"\";" | grep -v -e "^filename$"`
     do
-    	if [ $OSD == 1 ]; then
-            osd_cat --barmode=percentage --percentage=$percentage --pos=middle --align=center --text="Generating Video Thumbnails..." --delay=0 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-            percentage=$(expr $percentage + $increment)
-        fi
-        screenshooter.sh -v $vid
+      if [ $OSD == 1 ]; then
+	osd_cat --barmode=percentage --percentage=$percentage --pos=middle --align=center --color=white --text="Generating Video Thumbnails..." --font=$FONT --shadow=3 --color=yellow --delay=0 &
+	percentage=$(expr $percentage + $increment)
+      fi
+
+      screenshooter.sh -v $vid
     done
     if [ $OSD == 1 ]; then
-        killall -9 osd_cat
-        osd_cat --barmode=percentage --percentage=100 --pos=middle --align=center --text="Video Thumbnails Generated!" --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+	killall -9 osd_cat
+	osd_cat --barmode=percentage --percentage=100 --pos=middle --align=center --color=white --text="Video Thumbnails Generated!" --font=$FONT --shadow=3 --color=yellow --delay=3 &
     fi
 }
\ No newline at end of file
-- 
cgit v0.12

