# Copyright (c) 2002 by Gary Davis # # Filename displaytext.itcl # # Date V1.2a- 2003/11/13 (modified to support xybyre's version of # newtext2osd v1.1 for series 2 # V1.2 - 2002/12/09 (use newtext2osd v1.4 with --gardavis flag) # V1.1 - 2002/12/09 (use newtxt2osd instead of newtext2osd) # V1.0 - 2002/08/31 # v 1.3 2004 4/7 modified by l kahn for pulldown for font # # # Synopsis Display text on Tivo's screen via a web service transaction from # another server or interactively via a web form. # Interactive Call (Browser web page): # http://tivo/displaytext (no parameters) # Server (Web Service) Call (Display text message on Tivo): # http://tivo/displaytext?text=text&delay=1&x=&y=&bt=127&fs=15 # http://tivo/displaytext?text=text (same as above using defaults) # Note, x, y, delay, bt and fs default values shown if those parms are omitted. # # Parameters When called as a web service, the following parameters may be passed: # text (required) up to 40-x characters # x (default centered) - x coordinate # y (default centered) - y coordinate # delay (default 5) - number of seconds to display text # bt (default 90) - background transparency 0 opaque 127 tranparent # fs (default 15) - font size # silent (default N) - Y=supress output, N=output HTML # # Description When called without a text parameter, display a webform to allow user # to enter parameters interactively. When called with a text parameter, # display the text on the Tivo screen briefly. Parameters may be # specified to set the location, colors and delay. This module is basically # a web interface to the newtext2osd utility which displays a message on the # Tivo. This module may be used as a "web service" where some external # server (for example, a CallerID server) sends an HTTP web request to # get a message displayed on the Tivo. # # Installation Copy displaytext.itcl to your tivoweb-tcl/modules directory. This module # requires the S1 version of newtext2osd V1.4, or the S2 version of newtext2osd # V1.1 program to be located in the /var/hack/bin directory (edit the path # below if your location is different). # Make sure you chmod 755 /var/hack/bin/newtext2osd to make it is executable. # Restart (Full Reload) TivoWeb from the menu. # # Credits lightn (TivoWeb) # embeem (Original osdtxt from tivobi program) # cwingert (New newtext2osd program) global newtext2osd set newtext2osd "/var/hack/bin/newtext2osd"; if ![file executable $newtext2osd] {continue} if {$::series1} { proc action_displaytext {chan path env} { # Set defaults then override (via eval call) from incoming parameters set command "/var/hack/bin/newtext2osd"; set text ""; set x "0"; set y "0"; set delay "5"; set fg "153"; set bg "1"; set silent "N"; eval $env; # Display text on Tivo if {$text != ""} { catch { exec $::newtext2osd --gardavis -t$text -x$x -y$y -s$delay -f$fg -b$bg & }; } # Display form on browser if {$silent == "N"} { puts $chan [html_start "Display Text"] puts $chan [html_form_start "GET" "/displaytext"] puts $chan [html_table_start "style=\"border-width: 1px\"" "Enter Text Message and Parameters" "COLSPAN=4"] puts $chan [tr "" [td "ALIGN=right" "Text Message:"] [td "COLSPAN=3" [html_form_text 1 "45 MAXLENGTH=40" "text" $text]]] puts $chan [tr "" [td "ALIGN=right" "Delay:"] [td "COLSPAN=3" [html_form_text 1 "4 MAXLENGTH=3" "delay" $delay]]] puts $chan [tr "" [td "ALIGN=right" "X Position:"] [td [html_form_text 1 "4 MAXLENGTH=2" "x" $x]] [td "ALIGN=right" "Y Position:"] [td [html_form_text 1 "4 MAXLENGTH=2" "y" $y]]] puts $chan [tr "" [td "ALIGN=right" "FG Color:"] [td [html_form_text 1 "4 MAXLENGTH=3" "fg" $fg]] [td "ALIGN=right" "BG Color:"] [td [html_form_text 1 "4 MAXLENGTH=3" "bg" $bg]]] puts $chan [html_table_end] puts $chan [html_form_input "submit" "submit" "Display Text"] puts $chan [html_form_end] puts $chan [html_end] } } } else { proc action_displaytext {chan path env} { # Set defaults then override (via eval call) from incoming parameters set font "" set text ""; set x ""; set y ""; set delay "5"; # set fg "153"; # set bg "1"; set bt "90"; set fs "15"; set silent "N"; set atext ""; set adelay ""; set afs ""; set abt ""; set ax ""; set ay ""; set fnt "" eval $env; # Setup argument variables if {$font != ""} { set fnt "-u$font"; } if {$text != ""} { set atext "-t$text"; } if {$delay != ""} { set adelay "-s$delay"; } if {$fs != ""} { set afs "-p$fs"; } if {$bt != ""} { set abt "-o$bt"; } if {$x != ""} { set ax "-x$x"; } if {$y != ""} { set ay "-y$y"; } # Display text on Tivo if {$text != ""} { catch { exec $::newtext2osd $atext $adelay $ax $ay $afs $abt $fnt} output; puts $chan $output } # Display form on browser if {$silent == "N"} { puts $chan [html_start "Display Text"] puts $chan [html_form_start "GET" "/displaytext"] puts $chan [html_table_start "style=\"border-width: 1px\"" "Enter Text Message and Parameters" "COLSPAN=4"] puts $chan [tr "" [td "ALIGN=right" "Text Message:"] [td "COLSPAN=3" [html_form_text 1 "45 MAXLENGTH=40" "text" $text]]] puts $chan [tr "" [td "ALIGN=right" "Delay:"] [td "COLSPAN=3" [html_form_text 1 "4 MAXLENGTH=3" "delay" $delay]]] puts $chan [tr "" [td "ALIGN=right" "X Position:"] [td [html_form_text 1 "4 MAXLENGTH=3" "x" $x]] [td "ALIGN=right" "Y Position:"] [td [html_form_text 1 "4 MAXLENGTH=3" "y" $y]]] # puts $chan [tr "" [td "ALIGN=right" "FG Color:"] [td [html_form_text 1 "4 MAXLENGTH=3" "fg" $fg]] [td "ALIGN=right" "BG Color:"] [td [html_form_text 1 "4 MAXLENGTH=3" "bg" $bg]]] puts $chan [tr "" [td "ALIGN=right" "BG Transparency:"] [td "COLSPAN=3" [html_form_text 1 "4 MAXLENGTH=3" "bt" $bt]]] puts $chan [tr "" [td "ALIGN=right" "Font Size:"] [td "COLSPAN=3" [html_form_text 1 "4 MAXLENGTH=3" "fs" $fs]]] puts $chan "Font Name:" puts $chan "" puts $chan [html_table_end] puts $chan [html_form_input "submit" "submit" "Display Text"] puts $chan [html_form_end] puts $chan [html_end] } } } register_module "displaytext" "DisplayText" "Display Text Message on Tivo"