4 def portrait_filename( char_id, img_size ):
6 err_img = "/usr/share/mevemon/imgs/error.jpg"
8 img_dir = os.path.expanduser("~/.mevemon/imgs/")
11 # if asked for the large version, save it under a diff name --danny
13 filename = os.path.join(img_dir, "%s.jpg" % char_id)
15 filename = os.path.join(img_dir, "%s_lg.jpg" % char_id)
17 # 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
20 if not os.path.exists(img_dir):
22 elif os.path.isfile( filename ):
25 # specify size and cid --danny
26 img_url = "http://image.eveonline.com/Character/%s_%s.jpg" % ( str( char_id ), img_size )
28 # fetch it, and hit the road. --danny
30 urllib.urlretrieve( img_url, filename, report_handler )
31 except urllib.ContentTooShortError:
35 def report_handler( *a ):
36 ( blocks_transferred, block_size, total_size ) = a