Permalink
Browse files

git-svn-id: https://semicomplete.googlecode.com/svn/traffic@1853 6606…

…7f73-fe4c-0410-82e9-b9c6d0c95a22
  • Loading branch information...
1 parent b740010 commit b9ba946a11b5ae22ec2c64f319faff8fce1c9e66 @jordansissel committed May 16, 2008
Showing with 14 additions and 47 deletions.
  1. +1 −1 chrome/content/main.xul
  2. +13 −46 traffic.sh
View
@@ -3,7 +3,7 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="main-window" title="traffic check"
- width="650" height="500">
+ width="1000" height="850">
<script type="application/x-javascript" src="main.js"/>
<vbox flex="1">
<browser flex="1" id="main-browser" type="content-primary" />
View
@@ -1,71 +1,38 @@
#!/bin/sh
-xulapp="/u9/psionic/projects/traffic/application.ini"
-
-tries="1 2 3 4 5 6 7 8 9 10"
found=0
-for t in $tries; do
+for tries in 1 2 3 4 5 6 7; do
DISPLAY=`perl -e 'srand(time()); print int(rand() * 1000)'`
export DISPLAY
if [ ! -e "/tmp/.X11-unix/X$DISPLAY" ]; then
DISPLAY=":$DISPLAY"
- echo $DISPLAY >&2
- startx -- /usr/local/bin/Xvfb $DISPLAY -screen 0 800x600x24 > /dev/null 2>&1 &
+ echo $DISPLAY
+ startx -- /usr/local/bin/Xvfb $DISPLAY -screen 0 1024x768> /dev/null 2>&1 &
found=1
break
fi
done
+sleep 3600
if [ "$found" -eq "0" ]; then
- echo "Tried to find an unused X server, but none were found" >&2
+ echo "Tried to find an unused X server, but none were found"
exit 1
fi
-for t in $tries; do
- xdpyinfo > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- break;
- fi
- echo "Waiting for Xvfb to start" >&2
- sleep 1
-done
-
-echo "X is running" >&2
-
-tmp="$(mktemp /tmp/traffic.jpg.XXXXXXX)"
title="traffic $$"
-echo "Title: $title" >&2
-echo "URL: $1" >&2
-xulrunner $xulapp --url "$1" --title "$title" >&2 &
-echo "xulrunner exit: $?" >&2
-
-for t in $tries; do
- wid="$(xdotool search --title "$title")"
- if [ ! -z "$wid" ]; then
- break
- fi
- echo "Waiting for xulrunner" >&2
- sleep 1
-done
-
-if [ -z "$wid" ]; then
- echo "Failed to find the xulrunner window" >&2
-fi
+echo "Title: $title"
+xulrunner application.ini --url "$1" --title "$title" &
+sleep 8
+wid="$(xdotool search --title "$title")"
+tmp="$(mktemp /tmp/traffic.jpg.XXXXXXX)"
rm $tmp
tmp="$tmp.jpg"
-echo "wid: $wid" >&2
-
-# Wait a few seconds for the page to load
-sleep 15
-xdotool search --title "$title" >&2
-#import -window root $tmp
-import -window $wid -rotate 90 $tmp
+echo "wid: $wid"
+import -window root $tmp
+#import -window $wid -rotate 90 $tmp
echo $tmp
-exec 1>-
-exec 2>-
-
pkill -f "xulrunner.*$title"
pkill -f "X.*$DISPLAY"

0 comments on commit b9ba946

Please sign in to comment.