AW: [mythtv] Screenshot Shell Script...

Jochen Kühner jochen.kuehner at gmx.de
Fri Aug 12 08:26:00 UTC 2005


So here is the newest Script, tested it with SNES but it didn't run in
background, so the script stops after running the emu...! Any Ideas???

#!/bin/sh

DBUSER=root;
DBPWD=
DBNAME=mythconverg

TMPFILE=/tmp/tmp.png



WERTE=`echo "SELECT playername FROM gameplayers" | mysql -B
--database=$DBNAME --password=$DBPWD --user=$DBUSER -N`;

for player in $WERTE
 do 
 
  ROMPATH=`echo "SELECT rompath FROM gameplayers WHERE playername =
'$player'" | mysql -B --database=$DBNAME --password=$DBPWD --user=$DBUSER
-N`
  COMMANDLINE=`echo "SELECT commandline FROM gameplayers WHERE playername =
'$player'" | mysql -B --database=$DBNAME --password=$DBPWD --user=$DBUSER
-N`
  EXTENSIONS=`echo "SELECT extensions FROM gameplayers WHERE playername =
'$player'" | mysql -B --database=$DBNAME --password=$DBPWD --user=$DBUSER
-N`
  SCREENSHOTS=`echo "SELECT screenshots FROM gameplayers WHERE playername =
'$player'" | mysql -B --database=$DBNAME --password=$DBPWD --user=$DBUSER
-N`
  if [ "$ROMPATH" ]; then
    if [ "$player" = "SNES" ]; then
    for i in $ROMPATH/*.*
     do
      COMMAND="$COMMANDLINE \"$i\" & > /dev/null 2>&1"
      $COMMAND
      
      path="`expr "$i" : '\(.*\)/'`"                  # get file path (if
any)
      name="`expr "//$i" : '.*/\([^/]*\)'`"           # remove path to file
      suffix="`expr "$name" : '.*\.\([^./]*\)$'`"     # extract last suffix
      name="`expr "$name" : '\(.*\)\.[^.]*$'`"        # remove last suffix
      picname=$name.png 
      #echo $picname
      sleep 5
      
      scrot $TMPFILE
      mv $TMPFILE "$SCREENSHOTS/$picname"
      killall -9 $COMMANDLINE
      sleep 10
     done
    fi
  fi
done

-----Ursprüngliche Nachricht-----
Von: mythtv-dev-bounces at mythtv.org [mailto:mythtv-dev-bounces at mythtv.org] Im
Auftrag von Pascal Favre
Gesendet: Donnerstag, 11. August 2005 22:04
An: Development of mythtv
Betreff: Re: [mythtv] Screenshot Shell Script...

Hello
  If you do not know the suffix then you cannot use basename.
  ksh and bash have string extension which can do the job.

  Below are expressions which will work in every shell:

  path="`expr "$i" : '\(.*\)/'`"                  # get file path (if any)
  name="`expr "//$i" : '.*/\([^/]*\)'`"           # remove path to file
  suffix="`expr "$name" : '.*\.\([^./]*\)$'`"     # extract last suffix
  name="`expr "$name" : '\(.*\)\.[^.]*$'`"        # remove last suffix

Pascal

----- Original Message ----- 
From: "Daniel Staaf" <dst at bostream.nu>
To: "Development of mythtv" <mythtv-dev at mythtv.org>
Sent: Thursday, August 11, 2005 9:31 PM
Subject: Re: [mythtv] Screenshot Shell Script...


> Jochen Kühner skrev:
>> I've restarted my shellscript to use sh instead of php.
>>
>> but now i need help,
>>
>> first, the option to extrat the filename of a path and a extsion. (like
/aa/bb/cc/dd.eee then i need dd)
>
> basename /aa/bb/cc/dd.eee .eee
>
> / Daniel
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
> 

_______________________________________________
mythtv-dev mailing list
mythtv-dev at mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev



More information about the mythtv-dev mailing list