Permalink
Browse files

Better generate.sh from LCA2014.

  • Loading branch information...
mithro committed Jul 26, 2014
1 parent a5105c5 commit 68a8e1ff74e88b5144418162598a85dd46c2b0dd
Showing with 38 additions and 18 deletions.
  1. +8 −2 config.py
  2. +30 −16 tools/preview/generate.sh
@@ -114,7 +114,13 @@ def valid(self, group):
return group in self.groups()


def main():
def main(args):
if args[-1] == 'groups':
CONFIG = config_load()
for group in CONFIG.groups():
print group
return 0

# Check the json files
print "config.json"
print "="*80
@@ -153,4 +159,4 @@ def main():

if __name__ == "__main__":
import sys
sys.exit(main())
sys.exit(main(sys.argv))
@@ -1,21 +1,35 @@
#! /bin/sh
#! /bin/bash

GROUPS="mission ab cd ef gh america"
trap "kill 0" SIGINT SIGTERM EXIT

for GROUP in $GROUPS; do
mkdir /srv/\#pycon-$GROUP
CHANNELS="$(python ../../config.py groups)"

for CHANNEL in $CHANNELS; do
mkdir /srv/$CHANNEL
done

for GROUP in $GROUPS; do
cd /srv
while true; do
(
cd \#pycon-$GROUP
mplayer -nocache -nosound -vo png -cache 512 -nosound -vo png http://$GROUP.encoder.timvideos.us:8081/loop.raw -frames 1 2>/dev/null
convert -resize 300x217 00000001.png 00000001-small.png
pngcrush 00000001-small.png
mv 00000001-small.png latest.png
)
sleep 1
done
for CHANNEL in $CHANNELS; do
cd /srv
if ping $CHANNEL.encoder.timvideos.us -c 1 -W 1; then
echo "$CHANNEL up"
else
echo "$CHANNEL down, skipping"
continue
fi
while true; do
(
cd $CHANNEL
echo "$CHANNEL Getting image..."
mplayer -nocache -nosound -vo png -cache 512 -nosound -vo png http://$CHANNEL.encoder.timvideos.us:8081/loop.raw -frames 1 >/dev/null 2>&1
echo "$CHANNEL resizing..."
convert -resize 300x217 00000001.png 00000001-small.png >/dev/null 2>&1
echo "$CHANNEL crushing..."
pngcrush 00000001-small.png 00000001-crush.png >/dev/null 2>&1
echo "$CHANNEL moving..."
mv 00000001-crush.png latest.png >/dev/null 2>&1
echo
)
sleep 1
done &
done
wait

0 comments on commit 68a8e1f

Please sign in to comment.