[mythtv] Re:mythDVD module v0.0 released

Michael Kedl kedlm at knology.net
Wed Jul 16 16:46:28 EDT 2003


I wanted to see what you think about my idea for an "updating status window."

I have an ugly script figure out the current frame, total frames, running time for 
the ripper and display this along with the % done, and guestimated time remaining.

I have 2 ways to display it currently: an old copy of mythdialog and Xdialog.
Both are simple standalone programs that have good points: small, no other interactions,
easy to use and test; and bad points: currently have to kill them and respawn every 5s
so there is a "blink".

The display appears a few seconds after you start a rip.  It is redisplayed every 5s
with a noticeable blink for now (I welcome ideas on what to use as a replacement display
program).  If you exit (press enter) the display it will not respawn.

I have modified the mythfrontend DVD menu slightly so that the rip is always in the 
background, and there are 2 new options to allow redisplaying the dialog if you
have turned it off to do other things.  The dialog should appear within a few seconds
after you turn it back on.

It is still pretty ugly for now but seems to work good for me.  I thought I would
see if you wanted to integrate it directly with your stuff.

I am attaching my files directly since there were only small changes in yours, but
I have added several.

mythdvdripfe = a new mythdvdrip frontend that simply dumps the output of mythdvdrip to
a logfile so I can figure out what frame we are at
mythdvdrip = small change to add the spawning of mythdvdripstat
mythdvdripstat = a program that figures out all the status info and displays it via
mythdialog or Xdialog
mythdvdripstop = a small program to kill the dang ripper off!
dvd_menu.xml = changes to allow restarting the status display; changed to XVID, stop option

Obviously a few of these things will go in the settings screen once it gets setup.

Oh, I had to switch the encoding to XVID because the Divx5 encoder simply crashes
when I run it.  Odd...

I haven't tried to get status of the VOB ripping yet.

I'm attaching mythdialog since it may be deprecated.

Cheers,
Mike

-------------- next part --------------
export MYTHDVDRIPLOG=/tmp/mythdvdrip.log
mythdvdrip $1 $2 $3 $4> $MYTHDVDRIPLOG &
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythdvdrip
Type: text/x-sh
Size: 2588 bytes
Desc: not available
Url : http://lists.snowman.net/pipermail/mythtv-dev/attachments/20030716/3ca119fd/mythdvdrip.bin
-------------- next part --------------
# A simple shell script to display dvd ripping status in a window
# Written by: Michael Kedl
# Version 1 from 7/16/03

# show args
if [ "$1" == "" ]
then
  echo
  echo "mythdvdripstat version 1 (7/16/03) usage:"
  echo "  mythdvdripstat showM                if a dvd rip is in progress this will (re)start the mythdialog display"
  echo "  mythdvdripstat showX                if a dvd rip is in progress this will (re)start the Xdialog display"
  echo "  mythdvdripstat <logfile> <title>    only called from mythdvdrip; args are logfile to parse and dvd title"
  echo
  exit
fi

# allow turning the dialog back on
if [ "$1" == "showM" ]
then
  echo 1 > /tmp/mythdvdrip.displayM
  exit
fi

# allow turning the dialog back on
if [ "$1" == "showX" ]
then
  echo 1 > /tmp/mythdvdrip.displayX
  exit
fi

# grab the total frames from the command line (set in mythdvdrip)
total=`grep frames $1 | cut -d\  -f 3`
if [ "$total" == "" ]
then
	let total=0
fi

# start showing status display in mythdialog until user cancels display
echo 1 > /tmp/mythdvdrip.displayM

# loop forever (or until transcode exits)
while :
do
  # find current frame # from the log file
  current=`tail -5 $MYTHDVDRIPLOG | grep frames | tail -1 | cut -d- -f 2 |cut -d] -f 1`
  if [ "$current" == "" ]
  then
	let current=0
  fi

  # find current elapsed time
  elapsed=`ps ax  -o pid,etime,cmd |grep transcode | head -1 | cut -b10-17`
  hour=`echo $elapsed | cut -b1-2`
  min=`echo $elapsed | cut -b4-5`
  sec=`echo $elapsed | cut -b7-8`

  # handle problems with it think 08 and 09 are illegal octal numbers with the "10#" stuff
  # handle problem with time being under 1 minute
  let hour=10#$hour
  let min=10#$min
  if [ "$sec" == "" ]
  then
	let sec=min
	let min=hour
	let hour=0
  fi
  let sec=10#$sec

  # figure out % done
  let elapsed=$hour*3600+$min*60+sec
  echo "$current/$total*1000" > /tmp/$$.$$.bc
  echo "quit" >> /tmp/$$.$$.bc
  let perc=0
  perc=`bc -l /tmp/$$.$$.bc | tail -1 | cut -d. -f 1`

  # figure out remaining time handling errors fairly well
  echo "$current" > /tmp/$$.$$.bc
  echo "quit" >> /tmp/$$.$$.bc
  let current=0
  current=`bc -l /tmp/$$.$$.bc | tail -1`
  let bad=0
  if [ "$perc" == "0" ]
  then
    let rhour=0
    let rmin=0
    let rsec=0
    let bad=1
  fi
  if [ "$perc" == "" ]
  then
    let perc=0
    let rhour=0
    let rmin=0
    let rsec=0
    let bad=1
  fi
  if [ "$bad" == "0" ]
  then
    let ttime=1000*elapsed/perc
    let perc=perc/10
    let remain=$ttime-$elapsed
    let rhour=remain/3600
    let rmin=(remain-3600*rhour)/60
    let rsec=remain-3600*rhour-60*rmin
  fi

  # format for display
  display=`printf "\n\nDVD Rip in Progress: $2\n\nFrame: %d/%d    (%d%%)\n\nElapsed Time:\t\t\t\t%02d:%02d:%02d (hh:mm:ss)\nEstimated Remaining:\t%02d:%02d:%02d (hh:mm:ss)" $current $total $perc $hour $min $sec $rhour $rmin $rsec`

  # if user still wants to see it, then show it
  if [ -f /tmp/mythdvdrip.displayM ]
  then
    answer=`mythdialog "$display" "Cancel Status Display"` &
    sleep 5
    killall mythdialog 2> /dev/null
  elif [ -f /tmp/mythdvdrip.displayX ]
  then
    answer=`Xdialog --ok-label "Cancel Status Display" --msgbox "$display" 20 80` &
    sleep 5
    killall Xdialog 2> /dev/null
  else
    sleep 5
  fi

  # if user exitted the dialog then stop showing it (allows for user to start again though)
  if [ $? == 1 ]
  then
    rm -f /tmp/mythdvdrip.displayM
    rm -f /tmp/mythdvdrip.displayX
  fi
done

-------------- next part --------------
killall -9 transcode
killall -9 tccat
killall -9 tcdemux
killall -9 tcextract
killall -9 tcdecode
killall -9 mythdvdripstat
killall -9 mythdvdrip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dvd_menu.xml
Type: text/xml
Size: 908 bytes
Desc: not available
Url : http://lists.snowman.net/pipermail/mythtv-dev/attachments/20030716/3ca119fd/dvd_menu.xml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythdialog
Type: application/x-executable-binary
Size: 6312 bytes
Desc: not available
Url : http://lists.snowman.net/pipermail/mythtv-dev/attachments/20030716/3ca119fd/mythdialog.bin


More information about the mythtv-dev mailing list