/[scripts]/trunk/webthumb
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/webthumb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 62 by dpavlin, Wed Feb 6 23:34:04 2008 UTC revision 65 by dpavlin, Wed Feb 6 23:59:09 2008 UTC
# Line 29  Line 29 
29  # It will create snapshot of following size  # It will create snapshot of following size
30  W=1024  W=1024
31  H=768  H=768
32    D=24
33    
34  # and then resize it to (comment out to disable)  # and then resize it to (comment out to disable)
35  #RESIZE=200x  #RESIZE=200x
36    
37  # turn locally visible Xnest server to watch progress  # turn locally visible server to watch progress
38  DEBUG=0  DEBUG=0
39  test ! -z "$3" && DEBUG=1  if [ ! -z "$3" ] ; then
40            echo "DEBUG turned on"
41            DEBUG=1
42            D=8
43    fi
44    
45  # wait for $WAIT seconds for page to load  # wait for $WAIT seconds for page to load
46  WAIT=30  WAIT=30
# Line 81  else Line 86  else
86          exit 1          exit 1
87  fi  fi
88    
89  echo "starting X server $XSERVER"  DISPLAY_PORT=6042
90    
91    while netstat -ln | grep ":$DISPLAY_PORT " >/dev/null ; do
92            DISPLAY_PORT=`expr $DISPLAY_PORT + 1`
93    done
94    
95  export DISPLAY=:42  DISPLAY=:`expr $DISPLAY_PORT - 6000`
96    
97    echo "using DISPLAY=$DISPLAY"
98    
99  if [ "$DEBUG" == 1 ] ; then  if [ "$DEBUG" == 1 ] ; then
100          echo "using locally visible debug server on $LOCAL_DISPLAY"          echo "using locally visible debug server on $LOCAL_DISPLAY"
101          Xnest -display $LOCAL_DISPLAY -ac -geometry ${W}x${H} -depth 24 $DISPLAY 2>/dev/null &          DISPLAY=$LOCAL_DISPLAY Xephyr -ac -screen ${W}x${H}x${D} $DISPLAY 2>/dev/null &
102  else  else
103          echo "starting $XSERVER"          echo "starting $XSERVER"
104          $XSERVER -ac -screen 0 ${W}x${H}x24 $DISPLAY 2>/dev/null &          $XSERVER -ac -screen 0 ${W}x${H}x${D} $DISPLAY 2>/dev/null &
105  fi  fi
106    
107    if [ -z "$!" ] ; then
108            echo "ABORT: can't start X server!"
109            exit
110    fi
111  XSERVER_PID=$!  XSERVER_PID=$!
112    
113  echo "X server pid $XSERVER_PID"  echo "X server pid $XSERVER_PID"
114    
115  function kill_x_server() {  function kill_x_server() {
# Line 160  function ping_browser() { Line 175  function ping_browser() {
175    
176  ping_browser  ping_browser
177    
 xdotool search 'Restore' && xdotool key Escape && echo "simulated Esc to firefox restore sesison"  
   
 $BROWSER -remote "openURL($FRAMESET)"  
   
 echo "waiting for on_load event from browser $BROWSER_PID for ${WAIT}s"  
   
 # there is hard-coded limit here:  
 # we will wait $WAIT sec for page to load and render  
   
 echo -e "HTTP/1.0 304 Not modified\r\n\r\n" | nc -l -w $WAIT -p $PORT >/dev/null || echo "Timeout after $WAIT sec!"  
   
178  # get Mozilla Firefox window id (for resize)  # get Mozilla Firefox window id (for resize)
179  WINDOW_ID=`xwininfo -display $DISPLAY -root -tree | grep gecko | cut -d\" -f1 | sort -n | head -1`  WINDOW_ID=`xwininfo -display $DISPLAY -root -tree | grep gecko | cut -d\" -f1 | sort -n | head -1`
180    
# Line 188  xdotool key F11 Line 192  xdotool key F11
192    
193  ping_browser  ping_browser
194    
195    $BROWSER -remote "openURL($FRAMESET)" 2>/dev/null
196    
197    echo "waiting for on_load event from browser $BROWSER_PID for ${WAIT}s"
198    
199    # there is hard-coded limit here:
200    # we will wait $WAIT sec for page to load and render
201    
202    echo -e "HTTP/1.0 304 Not modified\r\n\r\n" | nc -l -w $WAIT -p $PORT >/dev/null || echo "Timeout after $WAIT sec!"
203    
204  # try to deduce inside area of window  # try to deduce inside area of window
205    
206  DUMP_ID=`xwininfo -display $DISPLAY -id $WINDOW_ID -tree | grep 0x | grep -v ${W}x${H} | grep ${W}x | head -1 | sed 's/^ *//' | cut -d' ' -f1`  DUMP_ID=`xwininfo -display $DISPLAY -id $WINDOW_ID -tree | grep 0x | grep -v ${W}x${H} | grep ${W}x | head -1 | sed 's/^ *//' | cut -d' ' -f1`

Legend:
Removed from v.62  
changed lines
  Added in v.65

  ViewVC Help
Powered by ViewVC 1.1.26