~canonical-server/+junk/naroll

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python

import sys
import subprocess
import os

for line in sys.stdin:
    print "DEBUG: line=" + line
    name = line.split(',')[0]
    ofile = name + ".png"
    print "DEBUG: ofile="+ofile

    result = subprocess.call(["wget","--quiet","-O",ofile,"https://api.launchpad.net/api/1.0/~" + name + "/mugshot"])
    if result:
        print "result = " + str(result)
        print "No picture for " + name
        os.unlink(ofile)
        os.symlink("../narwhal.png",ofile)