[mythtv-users] Full screen time display, with screen on

Brian Kirkman bkirkman at qwest.net
Sat Mar 5 04:46:52 UTC 2011


On 3/3/2011 8:02 PM, Dave M G wrote:
> Dan, Brian,
>
> Thanks for responding.
You're welcome.  I always enjoy hacking a solution together, emphasis on 
the hack.  Isn't Linux great!?
>
> The ImageMagick option seems to be one possibility, though I've
> experimented and found some troubles.
>
> 1. I don't know if it can be made to time out. When I include a "diplay"
> command in my script, it will stay up until manually closed.
get the pid, sleep 5, and kill it (or killall if you prefer).  I know 
you mentioned using a button press to kill the clock before if times 
out.  This could be done with ps and if, then, else.
> 2. I can't get it to be on top of the MythTV interface. It appears
> underneath - in other words, not visible.
try qiv instead of display.  It worked on my machine (Fedora 14, 
Fluxbox, MythTV .24, nVidia).
> 3. I have looked and have not found a full screen option. I can get it
> to expand it's window to the maximum area of the screen, but not to be
> actually full screen mode.
qiv will fullscreen
> Here is the command I ended up with after some experimentation
> (black.png is, predictably, just a black image)
>
> display -background '#000000' -bordercolor "#000000" -backdrop
> /home/mythbuntu/black.png
>
> I haven't got as far as trying to set up text over the image. I saw on
> the 'net there were some ways to script in text, but I didn't understand
> where that script was stored or executed.
>
> I'm still not totally dicounting osd_cat, as it seems to have nice time
> out options and is quick. If another, non-ImageMagick option comes up to
> dim, darken, or paint black over top the screen becomes available, it
> still might be the best way to go.
>
I, too, like osd_cat and its simplicity, but the font setting is tough 
to get configured, if at all even possible.  Also, it is an overlay, so 
a solid background is not an option.
> Oh, and by the way... the "sleep" command in the script I had before is
> completely superfluous. I won't go into why I thought it was necessary
> because it just isn't.
Here's a script to display a solid background clock image on the screen 
for five seconds.  You'll have to shoehorn it into your script where 
necessary.  I didn't center the text either.

- - -
#!/bin/sh

#Define background image file location
BGFILE='/home/mythtv/screen_clock/black_bg.jpg'

#Define clock image file location
CLOCKFILE='/home/mythtv/screen_clock/black_clock.jpg'

#Create the date string.
#Use 'tr' to insert a line feed to place date and time on separate lines
DATESTRING=`date +"%H:%M %m.%d.%Y" | tr " " "\n"`

#Get display width
WIDTH=`xdpyinfo | grep 'dimensions:' | awk '{print $2}' | cut -dx -f1`

#Get display height
HEIGHT=`xdpyinfo | grep 'dimensions:' | awk '{print $2}' | cut -dx -f2`

#Define text height as a function of display height
POINTSZ=$(echo $HEIGHT/6 | bc)

#Remove the background image file because 'convert' will auto increment 
and not overwrite
rm -f $BGFILE

#Create a blank canvas
convert -size ${WIDTH}x${HEIGHT} xc:black $BGFILE

#Write date/time over blank canvas
convert -font helvetica -fill white -pointsize $POINTSZ -draw 'text 
100,200 "'"$DATESTRING"'"' $BGFILE $CLOCKFILE

#Display date/time image
qiv --fullscreen --scale_down -i $CLOCKFILE &

#Get procid
PID=$!

#Keep image on display for 5 seconds
sleep 5

#Kill qiv to remove date/time image from display ('killall qiv' could 
also be used)
kill -9 $PID

- - -

Let us know how it goes.


More information about the mythtv-users mailing list