4 def portrait_filename( char_id, img_size ):
6 err_img = 'imgs/error.jpg'
8 # we can only accept 64 or 256... I know an exclamation point is not an error message, but I'll come back to this. FIXME --danny
9 if not ( img_size == 64 or img_size == 256 ):
12 # if asked for the large version, save it under a diff name --danny
14 filename = "imgs/%s.jpg" % char_id
16 filename = "imgs/%s_lg.jpg" % char_id
18 if os.path.isfile( filename ):
21 # specify size and cid --danny
22 img_url = "http://img.eve.is/serv.asp?s=%s&c=%s" % ( str( img_size ), char_id )
24 # fetch it, and hit the road. --danny
26 urllib.urlretrieve( img_url, filename, report_handler )
27 except ContentTooShortError:
31 def report_handler( *a ):
32 ( blocks_transferred, block_size, total_size ) = a