From 1c50b2d2a54fc1c0b3f39c5d08ab80c5f8b5e64e Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Fri, 10 Jul 2009 11:59:01 -0500
Subject: Linhes-config: set remote type to none when auto detect falls through

---
 abs/core-testing/LinHES-config/PKGBUILD             |  2 +-
 abs/core-testing/LinHES-config/install_functions.sh | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index a31f7d4..5ad1a9c 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.0
-pkgrel=52
+pkgrel=53
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
 depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates rsync python-parted ddcxinfo python-pexpect python-netifaces LinHES-timezone)
diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh
index 6775337..9b39437 100755
--- a/abs/core-testing/LinHES-config/install_functions.sh
+++ b/abs/core-testing/LinHES-config/install_functions.sh
@@ -11,7 +11,7 @@ CMDLINE=$(cat /proc/cmdline)
 hostname=`hostname`
 MYSQLCMD_C="mysql -u$MYTHDBUSER  -p$MYTHTVPASSWD mythconverg -B --exec"
 BASE=""
-
+found_remote=1
 
 function update_db_settings () {
 
@@ -117,6 +117,7 @@ do
              esac
         fi
         update_db_settings  HostReceiverType $FoundReceiverType
+        found_remote=0
         setupremote
         break
     fi
@@ -125,7 +126,7 @@ done
 
 
 function scan_for_usb_remote () {
-found_remote=1
+#found_remote=1
 printhl "   Scanning for usb receiver/remote"
 while read line
 do
@@ -149,6 +150,13 @@ if lsusb | grep 04d8:0004 > /dev/null 2>/dev/null
 then
 	/usr/bin/PyroUsb.py > /dev/null 2>&1 &
 fi
+
+if [ $found_remote -eq 1  ]
+then
+#No remote found_remote
+     update_db_settings HostRemoteType  "no_remote"
+fi
+
 }
 
 function rest_of_network () {
-- 
cgit v0.12


From 9f8bc208627357551940322fff22b500a6930921 Mon Sep 17 00:00:00 2001
From: Greg Frost <gregfrost1@bigpond.com>
Date: Sat, 11 Jul 2009 09:00:20 +0930
Subject: LinHES-system: logverbose for xinit

---
 abs/core-testing/LinHES-system/LinHES-start | 2 +-
 abs/core-testing/LinHES-system/PKGBUILD     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/abs/core-testing/LinHES-system/LinHES-start b/abs/core-testing/LinHES-system/LinHES-start
index e638334..3157a2e 100755
--- a/abs/core-testing/LinHES-system/LinHES-start
+++ b/abs/core-testing/LinHES-system/LinHES-start
@@ -140,7 +140,7 @@ EOF
 done
 
 
-xinit $client $clientargs -- $server $display $serverargs
+xinit $client $clientargs -- $server $display -logverbose 6 $serverargs
 
 if [ x"$removelist" != x ]; then
     xauth remove $removelist
diff --git a/abs/core-testing/LinHES-system/PKGBUILD b/abs/core-testing/LinHES-system/PKGBUILD
index 0fad05d..2920d11 100644
--- a/abs/core-testing/LinHES-system/PKGBUILD
+++ b/abs/core-testing/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=1.0
-pkgrel=55
+pkgrel=56
 arch=('i686')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
-- 
cgit v0.12


From 2d1365854903501d405d05b2078d6dfb226487be Mon Sep 17 00:00:00 2001
From: Greg Frost <gregfrost1@bigpond.com>
Date: Sat, 11 Jul 2009 09:49:18 +0930
Subject: shepherd: package created

---
 abs/extra-testing/shepherd/PKGBUILD                     |  16 ++++++++++++++++
 abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz | Bin 0 -> 43066 bytes
 2 files changed, 16 insertions(+)
 create mode 100644 abs/extra-testing/shepherd/PKGBUILD
 create mode 100644 abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz

diff --git a/abs/extra-testing/shepherd/PKGBUILD b/abs/extra-testing/shepherd/PKGBUILD
new file mode 100644
index 0000000..28b2005
--- /dev/null
+++ b/abs/extra-testing/shepherd/PKGBUILD
@@ -0,0 +1,16 @@
+# $Id: PKGBUILD 23123 2009-01-03 02:43:02Z kevin $
+# Maintainer: Greg Frost <gregfrost1@bigpond.com>
+pkgname=shepherd
+pkgver=1
+pkgrel=1
+pkgdesc="Australian EPG Grabber."
+arch=i686
+depends=(perl-pathtools perl-digest-sha1 perl-algorithm-diff perl-javascript perl-list-compare)
+makedepends=()
+source=(http://www.whuffy.com/shepherd/shepherd)
+
+build() {
+    mkdir -p ${startdir}/pkg/usr/bin/
+    install -m 0755 shepherd ${startdir}/pkg/usr/bin/
+}
+md5sums=('2b826e4a08810d360e9f6843beb6aa42')
diff --git a/abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz b/abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz
new file mode 100644
index 0000000..fc27d84
Binary files /dev/null and b/abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz differ
-- 
cgit v0.12


From 0f86eafff7f08b67668b380b9cd32090d1514d3d Mon Sep 17 00:00:00 2001
From: Greg Frost <gregfrost1@bigpond.com>
Date: Sat, 11 Jul 2009 09:50:10 +0930
Subject: shepherd: removed binary package

---
 abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz | Bin 43066 -> 0 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz

diff --git a/abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz b/abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz
deleted file mode 100644
index fc27d84..0000000
Binary files a/abs/extra-testing/shepherd/shepherd-1-1-i686.pkg.tar.gz and /dev/null differ
-- 
cgit v0.12


From 8f6f144efb012ee8acd9855fd78403be35d09bd5 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 13 Jul 2009 11:49:28 -0500
Subject: linhes-config: add request_dhcp function

---
 abs/core-testing/LinHES-config/PKGBUILD            |  4 +-
 .../LinHES-config/install_functions.sh             | 47 ++++++++++++++++++++++
 2 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 5ad1a9c..8ebf3f8 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,9 +1,9 @@
 pkgname=LinHES-config
 pkgver=2.0
-pkgrel=53
+pkgrel=56
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
-depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates rsync python-parted ddcxinfo python-pexpect python-netifaces LinHES-timezone)
+depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates rsync python-parted ddcxinfo python-pexpect python-netifaces LinHES-timezone python-iplib)
 arch=('i686')
 
 source=(mv_install.py mv_config.py mythinstall.bin myth_user_call file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh autocard.py restore_km_db_chroot.sh README  mv_advanced.py  mv_common.py   mv_ir.py  mv_misc.py  mv_network.py  mv_screensaver.py  mv_smolt.py  mv_software.py  mv_webuser.py mv_hostype.py systemconfig.py myth_user_call.py)
diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh
index 9b39437..94b4375 100755
--- a/abs/core-testing/LinHES-config/install_functions.sh
+++ b/abs/core-testing/LinHES-config/install_functions.sh
@@ -232,6 +232,53 @@ function init_network {
             rest_of_network
         fi
     fi
+
+
+
+
+}
+
+function dev_up_check(){
+    /sbin/ifconfig $1 1>/dev/null 2>/dev/null
+    status=$?
+    if [ $status -eq 1 ]
+    then
+        return 0
+    else
+        devip=`/sbin/ifconfig  | grep -C1 $1| grep inet|grep -v inet6  | cut -d: -f2 | awk '{ print $1}'`
+        if [  "x$devip" = "x" ]
+        then
+            return 1
+        else
+            return 0
+        fi
+    fi
+}
+
+function request_dhcp(){
+    for ndev in eth0 eth1 wlan0 wlan1 ath0
+    do
+        dev_up_check $ndev
+        status=$?
+        if [ $status -eq 1 ]
+        then
+            #interface is down, lets see if dhcp responds
+            dhcpcd -Td -t2 $ndev > /tmp/dhcpinfo.$ndev
+            TEMPVAR=`grep IPADDR /tmp/dhcpinfo.$ndev |cut -d\' -f2`
+            if [ ! x$TEMPVAR = x ]
+            then
+                update_db_settings HostIP$ndev "$TEMPVAR"
+                TEMPVAR=`grep NETMASK /tmp/dhcpinfo.$ndev |cut -d\' -f2`
+                nm=`/usr/bin/nmconv.py -obits  $TEMPVAR`
+                TEMPVAR="/$nm    $TEMPVAR"
+                update_db_settings HostNETMASK$ndev "$TEMPVAR"
+                TEMPVAR=`grep GATEWAYS /tmp/dhcpinfo.$ndev |cut -d\' -f2`
+                update_db_settings HostGW$ndev "$TEMPVAR"
+                TEMPVAR=`grep DNSSERVERS /tmp/dhcpinfo.$ndev |cut -d\' -f2`
+                update_db_settings HostDNS$ndev "$TEMPVAR"
+            fi
+        fi
+    done
 }
 
 function init_remote {
-- 
cgit v0.12


From e2cb7691fe15d142fc1ae8dcb85a526f9db5edf0 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 13 Jul 2009 12:10:23 -0500
Subject: linhes-config: prefix a "c" to network parms to avoid conflicts to
 the ones built into the kernel.

---
 abs/core-testing/LinHES-config/PKGBUILD             |  2 +-
 abs/core-testing/LinHES-config/install_functions.sh | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 8ebf3f8..9486462 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.0
-pkgrel=56
+pkgrel=57
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
 depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates rsync python-parted ddcxinfo python-pexpect python-netifaces LinHES-timezone python-iplib)
diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh
index 94b4375..ea9e61c 100755
--- a/abs/core-testing/LinHES-config/install_functions.sh
+++ b/abs/core-testing/LinHES-config/install_functions.sh
@@ -161,10 +161,10 @@ fi
 
 function rest_of_network () {
     #netmask
-    echo $CMDLINE | grep -q netmask
+    echo $CMDLINE | grep -q cnetmask
     if [ $? -eq 0 ]
     then
-        TEMPVAR=${CMDLINE#*netmask=}
+        TEMPVAR=${CMDLINE#*cnetmask=}
         NETMASK=${TEMPVAR%% *}
         /sbin/ifconfig eth0 $IP netmask $NETMASK
         nm=`/usr/bin/nmconv.py -obits  $NETMASK`
@@ -175,10 +175,10 @@ function rest_of_network () {
         printhl "   Netmask not found"
     fi
     #gateway
-    echo $CMDLINE | grep -q gateway
+    echo $CMDLINE | grep -q cgateway
     if [ $? -eq 0 ]
     then
-        TEMPVAR=${CMDLINE#*gateway=}
+        TEMPVAR=${CMDLINE#*cgateway=}
         GATEWAY=${TEMPVAR%% *}
         /sbin/route add default  gw $GATEWAY
         update_db_settings HostGW${MYTHDEFAULT} "$GATEWAY"
@@ -187,10 +187,10 @@ function rest_of_network () {
     fi
 
     #dns
-    echo $CMDLINE | grep -q dns
+    echo $CMDLINE | grep -q cdns
     if [ $? -eq 0 ]
     then
-        TEMPVAR=${CMDLINE#*dns=}
+        TEMPVAR=${CMDLINE#*cdns=}
         DNS=${TEMPVAR%% *}
         echo "nameserver $DNS" >> /etc/resolv.conf
         update_db_settings HostDNS${MYTHDEFAULT} "$DNS"
@@ -200,10 +200,10 @@ function rest_of_network () {
 }
 
 function init_network {
-    echo $CMDLINE |grep -q netdev
+    echo $CMDLINE |grep -q cnetdev
     if [ $? -eq 0 ]
     then
-        TEMPVAR=${CMDLINE#*netdev=}
+        TEMPVAR=${CMDLINE#*cnetdev=}
         MYTHDEFAULT=${TEMPVAR%% *}
     else
         MYTHDEFAULT="eth0"
@@ -219,7 +219,7 @@ function init_network {
         update_db_settings HostActiveonboot${MYTHDEFAULT} 1
         update_db_settings HostNetDevice ${MYTHDEFAULT}
 
-        TEMPVAR=${CMDLINE#*ip=}
+        TEMPVAR=${CMDLINE#*cip=}
         IP=${TEMPVAR%% *}
         if [ "$IP" == "dhcp" ]
         then
-- 
cgit v0.12


From 5baa3ef4ea235cf4440e3e3f62abd8a935d0ce0d Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 13 Jul 2009 12:21:19 -0500
Subject: nvidia: make it depend on a version of nvidia-utils. This might
 interfere with some people flipping around drivers trying to get vdpau to
 work, but oh well.

---
 abs/core-testing/nvidia/PKGBUILD | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/abs/core-testing/nvidia/PKGBUILD b/abs/core-testing/nvidia/PKGBUILD
index 2c25610..eccf01f 100644
--- a/abs/core-testing/nvidia/PKGBUILD
+++ b/abs/core-testing/nvidia/PKGBUILD
@@ -4,13 +4,13 @@
 pkgname=nvidia
 pkgver=185.18.14
 _kernver='2.6.28-LinHES'
-pkgrel=1
+pkgrel=2
 pkgdesc="NVIDIA drivers for kernel26."
 arch=('i686' 'x86_64')
 [ "$CARCH" = "i686"   ] && ARCH=x86
 [ "$CARCH" = "x86_64" ] && ARCH=x86_64
 url="http://www.nvidia.com/"
-depends=('kernel26>=2.6.28' 'kernel26<2.6.29' 'nvidia-utils')
+depends=('kernel26>=2.6.28' 'kernel26<2.6.29' 'nvidia-utils=185.18.14')
 conflicts=('nvidia-96xx' 'nvidia-71xx' 'nvidia-legacy' 'nvidia-beta')
 license=('custom')
 install=nvidia.install
-- 
cgit v0.12


From 8318951c942e2619e4c84315f3e49364b444df79 Mon Sep 17 00:00:00 2001
From: Bob Igo <bob@stormlogic.com>
Date: Mon, 13 Jul 2009 14:31:25 -0400
Subject: preliminary version of mplayer wrapper; needs further integration
 work

---
 abs/core-testing/mplayer-wrapper/PKGBUILD          |   9 +-
 .../mplayer-wrapper/bin/mplayer-wrapper.pl         | 110 --------------------
 .../mplayer-wrapper/mplayer-wrapper.install        |  38 +++++++
 .../mplayer-wrapper/mplayer-wrapper.pl             | 113 +++++++++++++++++++++
 4 files changed, 158 insertions(+), 112 deletions(-)
 delete mode 100755 abs/core-testing/mplayer-wrapper/bin/mplayer-wrapper.pl
 create mode 100644 abs/core-testing/mplayer-wrapper/mplayer-wrapper.install
 create mode 100755 abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl

diff --git a/abs/core-testing/mplayer-wrapper/PKGBUILD b/abs/core-testing/mplayer-wrapper/PKGBUILD
index 82f1082..3fb4124 100644
--- a/abs/core-testing/mplayer-wrapper/PKGBUILD
+++ b/abs/core-testing/mplayer-wrapper/PKGBUILD
@@ -1,5 +1,5 @@
 pkgname=mplayer-wrapper
-pkgver=1
+pkgver=1	
 pkgrel=1
 pkgdesc="wrapper for mplayer and mplayer derivatives"
 arch=('i686' 'x86_64')
@@ -10,7 +10,12 @@ source=(mplayer-wrapper.pl)
 
 license=('GPL2')
 
+install=mplayer-wrapper.install
 build() {
+   LH_ROOT=/usr/LH
+   mkdir -p $startdir/pkg/$LH_ROOT/bin/
+
    cd $startdir
-   install -m0777 -D bin/*  $startdir/pkg/usr/LH/bin/
+   # executables
+   install -m0755 -D *.pl  $startdir/pkg/$LH_ROOT/bin/
 }
diff --git a/abs/core-testing/mplayer-wrapper/bin/mplayer-wrapper.pl b/abs/core-testing/mplayer-wrapper/bin/mplayer-wrapper.pl
deleted file mode 100755
index 583786d..0000000
--- a/abs/core-testing/mplayer-wrapper/bin/mplayer-wrapper.pl
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/perl
-
-use Shell;
-use strict;
-use POSIX qw(floor);
-
-# Written by Bob Igo from the MythTV Store at http://MythiC.TV
-# including some original code and contributions from Nick C.
-# and graysky.
-# Email: bob@stormlogic.com
-#
-# If you run into problems with this script, please send me email
-
-# PURPOSE:
-# --------------------------
-# This is a wrapper script that tries to find the best parameters
-# for calling an underlying video player.  The outer layer determines
-# the best playback parameters, while the inner layer picks the best
-# player to call.
-
-# RATIONALE:
-# --------------------------
-# Default video playback options are not optimal on all hardware or
-# for all video types.  In addition, common video players do not
-# offer to bookmark video so that you can resume where you left off.
-# Both of these problems can be addressed by this wrapper.
-
-# PARAMETERS:
-# --------------------------
-# The same parameters you'd use for mplayer, some of which may be
-# translated automatically for use with smplayer.
-
-# FILES:
-# --------------------------
-# $mediafile, the file to play
-
-sub run () {
-    my $mediafile = @ARGV[$#ARGV];
-    my $player = &pick_player();
-
-    my $player_parameters = join(' ',
-				 &translate_parameters($player,@ARGV[0..$#ARGV-1]),
-				 &dynamic_parameters($mediafile));
-    &player($player,$player_parameters,$mediafile);
-}
-
-&run();
-
-# Translates any parameters into ones that will be compatible with the given player.
-sub translate_parameters() {
-    my($player,@parameters)=@_;
-
-    if ($player eq "smplayer") {
-	# Stupidly, smplayer uses a different set of command-line parameters than generic
-	# mplayer, so we need to translate mplayer-centric ones into the few that are
-	# available in smplayer-ese.
-	my %smplayer_parameter_translation_array = (
-	    "-fs" => "-fullscreen",
-	    "-zoom" => " "
-	    );
-	
-	sub translate() {
-	    my($flag)=@_;
-	    return $smplayer_parameter_translation_array{$flag};
-	}
-	
-	return map(&translate($_), @parameters);
-    } else {
-	return @parameters;
-    }
-}
-
-# Returns an array of dynamic parameters based in part on the media.
-sub dynamic_parameters () {
-    my($mediafile)=@_;
-    return(); # ??? empty for now; further development required
-}
-
-# Find the best player for use on this system.  The script prefers smplayer,
-# which has built-in bookmarking, falling back to mplayer-resumer.pl, which
-# implements bookmarking as an mplayer wrapper, if smplayer cannot be found.
-# Finally, if no bookmarking players can be found, a barebones mplayer is used.
-sub pick_player () {
-    my @possible_players = ("smplayer", "mplayer-resumer.pl", "mplayer");
-    my $command;
-    my $candidate_player;
-    foreach (@possible_players) {
-	$candidate_player = $_;
-	$command = "which $candidate_player |";
-	open(SHELL, $command);
-	if (<SHELL>) {
-	    #print "player $candidate_player : $_\n";
-	    return $candidate_player;
-	}
-	close(SHELL);
-    }
-}
-
-# Calls player
-sub player () {
-    my($player,$parameters,$mediafile)=@_;
-    my $command = "$player $parameters \"$mediafile\" 2>&1 2>/dev/null |";
-
-    #print "DEBUG: command is:\n$command\n";
-    open(SHELL, $command);
-    while (<SHELL>) {
-	print $_;
-    }
-    close(SHELL);
-}
diff --git a/abs/core-testing/mplayer-wrapper/mplayer-wrapper.install b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.install
new file mode 100644
index 0000000..18f1b75
--- /dev/null
+++ b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.install
@@ -0,0 +1,38 @@
+# This is a default template for a post-install scriptlet.  You can
+# remove any functions you don't need (and this header).
+
+# arg 1:  the new package version
+pre_install() {
+/bin/true
+}
+
+# arg 1:  the new package version
+post_install() {
+/bin/true
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+pre_upgrade() {
+  /bin/true
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+post_upgrade() {
+  /bin/true
+}
+
+# arg 1:  the old package version
+pre_remove() {
+  /bin/true
+}
+
+# arg 1:  the old package version
+post_remove() {
+  /bin/true
+}
+
+op=$1
+shift
+$op $*
diff --git a/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
new file mode 100755
index 0000000..9977741
--- /dev/null
+++ b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
@@ -0,0 +1,113 @@
+#!/usr/bin/perl
+
+use Shell;
+use strict;
+use POSIX qw(floor);
+
+# Written by Bob Igo from the MythTV Store at http://MythiC.TV
+# including some original code and contributions from Nick C.
+# and graysky.
+# Email: bob@stormlogic.com
+#
+# If you run into problems with this script, please send me email
+
+# PURPOSE:
+# --------------------------
+# This is a wrapper script that tries to find the best parameters
+# for calling an underlying video player.  The outer layer determines
+# the best playback parameters, while the inner layer picks the best
+# player to call.
+
+# RATIONALE:
+# --------------------------
+# Default video playback options are not optimal on all hardware or
+# for all video types.  In addition, common video players do not
+# offer to bookmark video so that you can resume where you left off.
+# Both of these problems can be addressed by this wrapper.
+
+# PARAMETERS:
+# --------------------------
+# The same parameters you'd use for mplayer, some of which may be
+# translated automatically for use with smplayer.
+
+# FILES:
+# --------------------------
+# $mediafile, the file to play
+
+sub run () {
+    my $mediafile = @ARGV[$#ARGV];
+    my $player = &pick_player();
+
+    my $player_parameters = join(' ',
+				 &translate_parameters($player,@ARGV[0..$#ARGV-1]),
+				 &dynamic_parameters($mediafile));
+    &player($player,$player_parameters,$mediafile);
+}
+
+&run();
+
+# Translates any parameters into ones that will be compatible with the given player.
+sub translate_parameters() {
+    my($player,@parameters)=@_;
+
+    if ($player eq "smplayer") {
+	# Stupidly, smplayer uses a different set of command-line parameters than generic
+	# mplayer, so we need to translate mplayer-centric ones into the few that are
+	# available in smplayer-ese.
+	my %smplayer_parameter_translation_array = (
+	    "-fs" => "-fullscreen",
+	    "-zoom" => " "
+	    );
+	
+	sub translate() {
+	    my($flag)=@_;
+	    return $smplayer_parameter_translation_array{$flag};
+	}
+	
+	return map(&translate($_), @parameters);
+    } else {
+	# currently, all other players used by this wrapper work with mplayer parameters
+	return @parameters;
+    }
+}
+
+# Returns an array of dynamic parameters based on the media type,
+# the presence of special playback decoding hardware, and the
+# general capability of the CPU.
+sub dynamic_parameters () {
+    my($mediafile)=@_;
+    return(); # ??? empty for now; further development required
+}
+
+# Find the best player for use on this system.  The script prefers smplayer,
+# which has built-in bookmarking, falling back to mplayer-resumer.pl, which
+# implements bookmarking as an mplayer wrapper, if smplayer cannot be found.
+# Finally, if no bookmarking players can be found, a barebones mplayer is used.
+sub pick_player () {
+    my @possible_players = ("smplayer", "mplayer-resumer.pl", "mplayer");
+    my $command;
+    my $candidate_player;
+    foreach (@possible_players) {
+	$candidate_player = $_;
+	$command = "which $candidate_player |";
+	open(SHELL, $command);
+	if (<SHELL>) {
+	    #print "player $candidate_player : $_\n";
+	    return $candidate_player;
+	}
+	close(SHELL);
+    }
+}
+
+# Calls player
+sub player () {
+    my($player,$parameters,$mediafile)=@_;
+    my $command = "$player $parameters \"$mediafile\" 2>&1 2>/dev/null |";
+
+    #print "DEBUG: command is:\n$command\n";
+    open(SHELL, $command);
+    while (<SHELL>) {
+	print $_;
+    }
+    close(SHELL);
+}
-- 
cgit v0.12


From 8ab2b94c697866402266afc4f04cebf76203463f Mon Sep 17 00:00:00 2001
From: Bob Igo <bob@stormlogic.com>
Date: Mon, 13 Jul 2009 14:33:26 -0400
Subject: initial mplayer-wrapper integration; some more mplayer tweaks;
 preliminary smplayer tweaks

---
 abs/core-testing/tweaker/PKGBUILD                  | 14 +++++-----
 abs/core-testing/tweaker/bin/twk_audio.pl          |  6 ++---
 abs/core-testing/tweaker/bin/twk_cpu.pl            | 31 ++++++++++++++++++++++
 abs/core-testing/tweaker/bin/twk_general.pl        |  8 +++---
 .../fs/home/mythtv/.config/smplayer/smplayer.ini   |  2 +-
 5 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/abs/core-testing/tweaker/PKGBUILD b/abs/core-testing/tweaker/PKGBUILD
index ebd3ed4..377edda 100644
--- a/abs/core-testing/tweaker/PKGBUILD
+++ b/abs/core-testing/tweaker/PKGBUILD
@@ -1,7 +1,7 @@
 pkgname=tweaker
 pkgver=1
-pkgrel=38
-pkgdesc=""
+pkgrel=40
+pkgdesc="applies tweaks to the baseline configuration and attempts to optimize settings for the hardware it finds"
 arch=('i686' 'x86_64')
 
 depends=('bash' 'perl' 'perl-dbi' 'perl-exception-class' 'perl-log-log4perl' 'perl-log-dispatch' 'perl-getopt-lucid' 'perl-list-member' 'perl-class-data-inheritable' 'perl-devel-stacktrace' 'perl-xml-twig') 
@@ -16,19 +16,18 @@ install=tweaker.install
 build() {
    TWEAKER_ROOT=usr/LH/tweaker
    mkdir -p $startdir/pkg/$TWEAKER_ROOT
-   mkdir -p  $startdir/pkg/$TWEAKER_ROOT/{bin,fs,tcf}
+   mkdir -p $startdir/pkg/$TWEAKER_ROOT/{bin,fs,tcf}
    mkdir -p $startdir/pkg/etc/profile.d
    mkdir -p $startdir/pkg/usr/lib/perl5/vendor_perl/Tweaker/ 
    
    cd $startdir
    # executables
    install -m0777 -D bin/*  $startdir/pkg/$TWEAKER_ROOT/bin
-    
    
    # parallel root directory structure used for seeding configuration files
-#   install -m0777  -D fs/ $startdir/pkg/$TWEAKER_ROOT/fs
-    cp -rp fs $startdir/pkg/$TWEAKER_ROOT/
-    chmod -R  0777 $startdir/pkg/$TWEAKER_ROOT/ 
+   # Ensure shell variables are configured at start; ensure $TWEAKER_ROOT/bin is in $PATH
+   cp -rp fs $startdir/pkg/$TWEAKER_ROOT/
+   chmod -R  0777 $startdir/pkg/$TWEAKER_ROOT/ 
    
    # Tweaker configuration files
    install -m0555 -D tcf/*  $startdir/pkg/$TWEAKER_ROOT/tcf
@@ -37,7 +36,6 @@ build() {
    #install -m0755 log4perl.conf $startdir/pkg/etc/log4perl.conf
    install -m0755 log4perl.conf $startdir/pkg/$TWEAKER_ROOT
 
-   # Ensure shell variables are configured at start; ensure $TWEAKER_ROOT/bin is in $PATH
    install -m0755 tweaker.sh $startdir/pkg/etc/profile.d/tweaker.sh
 
    # Copy our tweaker Perl modules for general use
diff --git a/abs/core-testing/tweaker/bin/twk_audio.pl b/abs/core-testing/tweaker/bin/twk_audio.pl
index eec7992..09676ed 100755
--- a/abs/core-testing/tweaker/bin/twk_audio.pl
+++ b/abs/core-testing/tweaker/bin/twk_audio.pl
@@ -110,9 +110,9 @@ sub implement_option {
     sub edit_mplayer_conf {
 	my($option) = @_;
 	# delete any old entries that Tweaker made, relevant to this particular edit
-	my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*a[o,c].*=.*#TWEAKER/d' $mplayer_conf";
+	my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*a[o,c,f].*=.*#TWEAKER/d' $mplayer_conf && sed -i '/^speed.*=.*#TWEAKER/d' $mplayer_conf";
 	# comment out old entries that some other process may have made
-	my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(a[o,c].*=.*\\)/#\\1/g' $mplayer_conf";
+	my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(a[o,c,f].*=.*\\)/#\\1/g' $mplayer_conf && sed -i 's/^\\(speed.*=.*\\)/#\\1/g' $mplayer_conf";
 	my $command1;
 	my $command2="";
 	($card, $device) = poll_for_digital_output_device;
@@ -133,7 +133,7 @@ sub implement_option {
 		# Not supported yet.
 	    }
 	    case "digital" {
-		$command2 = "echo -e 'ac=hwac3,hwdts, #TWEAKER\nao=alsa:device=plughw=$card.$device #TWEAKER' >> $mplayer_conf";
+		$command2 = "echo -e 'ac=hwac3,hwdts, #TWEAKER\nao=alsa:device=plughw=$card.$device #TWEAKER\naf=scaletempo=stride=30:overlap=.50:search=10 #TWEAKER\nspeed=1.0 #TWEAKER' >> $mplayer_conf";
 		if (my $error = execute_shell_command($command2)) {
 		    $logger->error("ERROR: $error");
 		    $logger->error("ERROR: Unable to implement option $option.");
diff --git a/abs/core-testing/tweaker/bin/twk_cpu.pl b/abs/core-testing/tweaker/bin/twk_cpu.pl
index 118bac1..8bddbe3 100755
--- a/abs/core-testing/tweaker/bin/twk_cpu.pl
+++ b/abs/core-testing/tweaker/bin/twk_cpu.pl
@@ -57,6 +57,36 @@ sub get_HDD_size {
 #    
 #}
 
+# Edit mplayer.conf to tell mplayer to drop video frames when necessary.  This should do no harm
+# on systems that don't need the option, and it should make video watchable on those that do.
+sub edit_mplayer_conf {
+    use vars qw($mplayer_conf);
+    $mplayer_conf = "/etc/mplayer/mplayer.conf";
+
+    # delete any old entries that Tweaker made, relevant to this particular edit
+    my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*hardframedrop.*=.*#TWEAKER/d' $mplayer_conf";
+    # comment out old entries that some other process may have made
+    my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(hardframedrop.*=.*\\)/#\\1/g' $mplayer_conf";
+    my $command1;
+    my $command2="";
+    my $logger = get_logger('tweaker.script');
+
+    if (my $error = execute_shell_command("$delete_old_tweaker_edits && $comment_out_external_edits")) {
+	$logger->error("ERROR: $error");
+	$logger->error("ERROR: Unable to implement option $option.");
+	exit(-1);
+    }
+
+    $command2 = "echo -e 'hardframedrop=true #TWEAKER' >> $mplayer_conf";
+    if (my $error = execute_shell_command($command2)) {
+	$logger->error("ERROR: $error");
+	$logger->error("ERROR: Unable to implement option $option.");
+	exit(-1);
+    }
+
+    $logger->info("Edited $mplayer_conf to drop video frames when CPU is overloaded.");
+}
+
 # Try to implement the given option.
 sub implement_option {
     my($option) = @_;
@@ -106,6 +136,7 @@ sub implement_option {
 	change_or_make_setting('OSDTheme', 'blootube-osd') || exit -1;
 	change_or_make_setting('PlayBoxShading', '0') || exit -1;
 	change_or_make_setting('PlaybackExitPrompt', '2') || exit -1;
+	edit_mplayer_conf();	
     } else {
 	exit -1;
     }
diff --git a/abs/core-testing/tweaker/bin/twk_general.pl b/abs/core-testing/tweaker/bin/twk_general.pl
index 387920c..3d16f2c 100755
--- a/abs/core-testing/tweaker/bin/twk_general.pl
+++ b/abs/core-testing/tweaker/bin/twk_general.pl
@@ -87,10 +87,8 @@ sub implement_option {
 	    #
 	    # better awareness of different video extensions
 	    #
-	    change_or_make_entry("videotypes", [["playcommand", "mplayer-resumer.pl -fs -zoom -vc theora,fftheora, -vo xv %s"]], [["extension", "ogg"]]);
-	    change_or_make_entry("videotypes", [["playcommand", "mplayer-resumer.pl -fs -zoom -vc theora,fftheora, -vo xv %s"]], [["extension", "theora"]]);
-	    foreach my $video_ext ("mp2", "tp", "ts", "m2p", "nuv", "mkv") {
-		change_or_make_entry("videotypes", [["playcommand", "Internal"], ["f_ignore", "0"], ["use_default", "1"]], [["extension", $video_ext]]);
+	    foreach my $video_ext ("mp2", "tp", "ts", "m2p", "nuv", "mkv", "ogg", "theora") {
+		change_or_make_entry("videotypes", [["playcommand", "Default"], ["f_ignore", "0"], ["use_default", "1"]], [["extension", $video_ext]]);
 	    }
 	    foreach my $non_video_ext ("jpg", "par2") {
 		change_or_make_entry("videotypes", [["f_ignore", "1"]], [["extension", $non_video_ext]]);
@@ -415,7 +413,7 @@ sub implement_option {
 	    change_or_make_setting('VCDPlayerCommand', 'mplayer vcd:\/\/ -cdrom-device %d -fs -zoom -vo xv -vf pp=lb');
 	    change_or_make_setting('VideoArtworkDir', "$SQL_DirVideo/.covers");
 	    change_or_make_setting('VideoBrowserNoDB', '1');
-	    change_or_make_setting('VideoDefaultPlayer', 'mplayer-resumer.pl -fs -zoom -vo xv %s');
+	    change_or_make_setting('VideoDefaultPlayer', 'mplayer-wrapper.pl -fs -zoom %s');
 	    change_or_make_setting('VideoGalleryNoDB', '1');
 	    change_or_make_setting('VideoStartupDir', $SQL_DirVideo);
 	    change_or_make_setting('VideoTreeNoDB', '1');
diff --git a/abs/core-testing/tweaker/fs/home/mythtv/.config/smplayer/smplayer.ini b/abs/core-testing/tweaker/fs/home/mythtv/.config/smplayer/smplayer.ini
index 33439a7..9660607 100644
--- a/abs/core-testing/tweaker/fs/home/mythtv/.config/smplayer/smplayer.ini
+++ b/abs/core-testing/tweaker/fs/home/mythtv/.config/smplayer/smplayer.ini
@@ -330,7 +330,7 @@ reset_zoom=Shift+E
 auto_zoom=Shift+W
 zoom_169=Shift+A
 zoom_235=Shift+S
-exit_fullscreen=Esc
+exit_fullscreen=
 next_osd=O
 dec_contrast=1
 inc_contrast=2
-- 
cgit v0.12


From 4c71823825d08c1cc2219d22a6d3fe190e158a09 Mon Sep 17 00:00:00 2001
From: Bob Igo <bob@stormlogic.com>
Date: Mon, 13 Jul 2009 17:50:14 -0400
Subject: fixed twk_audio.pl bug

---
 abs/core-testing/tweaker/PKGBUILD         |  2 +-
 abs/core-testing/tweaker/bin/twk_audio.pl | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/abs/core-testing/tweaker/PKGBUILD b/abs/core-testing/tweaker/PKGBUILD
index 377edda..b3b4983 100644
--- a/abs/core-testing/tweaker/PKGBUILD
+++ b/abs/core-testing/tweaker/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=tweaker
 pkgver=1
-pkgrel=40
+pkgrel=41
 pkgdesc="applies tweaks to the baseline configuration and attempts to optimize settings for the hardware it finds"
 arch=('i686' 'x86_64')
 
diff --git a/abs/core-testing/tweaker/bin/twk_audio.pl b/abs/core-testing/tweaker/bin/twk_audio.pl
index 09676ed..47a2415 100755
--- a/abs/core-testing/tweaker/bin/twk_audio.pl
+++ b/abs/core-testing/tweaker/bin/twk_audio.pl
@@ -133,7 +133,7 @@ sub implement_option {
 		# Not supported yet.
 	    }
 	    case "digital" {
-		$command2 = "echo -e 'ac=hwac3,hwdts, #TWEAKER\nao=alsa:device=plughw=$card.$device #TWEAKER\naf=scaletempo=stride=30:overlap=.50:search=10 #TWEAKER\nspeed=1.0 #TWEAKER' >> $mplayer_conf";
+		$command2 = "echo -e 'ac=hwac3,hwdts, #TWEAKER\nao=alsa:device=plughw=$card.$device #TWEAKER' >> $mplayer_conf";
 		if (my $error = execute_shell_command($command2)) {
 		    $logger->error("ERROR: $error");
 		    $logger->error("ERROR: Unable to implement option $option.");
@@ -160,6 +160,14 @@ sub implement_option {
 		}
 	    }
 	}
+	# for all options
+	$command2 = "echo -e 'af=scaletempo=stride=30:overlap=.50:search=10 #TWEAKER\nspeed=1.0 #TWEAKER' >> $mplayer_conf";
+	if (my $error = execute_shell_command($command2)) {
+	    $logger->error("ERROR: $error");
+	    $logger->error("ERROR: Unable to implement option $option.");
+	    exit(-1);
+	}
+	
 	$logger->info("Edited $mplayer_conf for $option audio.");
     }
 
-- 
cgit v0.12

