#!/usr/bin/env python

import sys, string

# ----------------------------------------------------------------
# Get information from videoServer (command, argument and context)

words = string.split(sys.stdin.readline())
COMMAND, ARG = words[0], string.join(words[1:])

context = {}
while 1:
    line = sys.stdin.readline()
    try:
        key, val = map(string.strip, string.split(line,":"))
        context[key] = val
    except:
        break

# ----------------------------------------------------------------
# Do whatever you want with this information

# Add your preferred notification here (message window, sound, etc.)

#   ...

# Add your preferred control policy there...

#   COMMAND, ARG = "ERROR", "404 Not found"
#   COMMAND, ARG = "GRAB", "/Users/roussel/casa/WWW/photos/rio.jpg"
#   COMMAND, ARG = "PUSH", "/Users/roussel/casa/videos/misc/television.vss"
#   COMMAND, ARG = "NUDP", "/Users/roussel/casa/videos/misc/television.vss"
#   COMMAND, ARG = "SENDFILE", "/Users/roussel/casa/WWW/photos/vigne.jpg"
#   COMMAND, ARG = "REDIRECT", "http://insitu.lri.fr/~roussel/projects/nucleo/"

#   if context["http-host"]=="localhost": context["image-blur"] = 15

#   context["image-size"] = "CIF"
#   context["image-rate"] = 5
#   context["image-blur"] = 10
#   context["image-quality"] = 60

# ----------------------------------------------------------------
# Write back the description of the service to execute

sys.stdout.write("%s %s\n"%(COMMAND,ARG))
for key, value in context.items():
    if string.find(key, "image-")!=-1:
        sys.stdout.write("%s: %s\n"%(key,value))
sys.stdout.write("\n")
