Implemented support for user images.

This commit is contained in:
William Povell
2013-05-21 21:34:27 -04:00
parent 3ad59a2a19
commit 12d29ee561

View File

@ -87,6 +87,31 @@ images={
'hireme':hireme
}
def load_images(imgNames):
"""loads user images from given file(s)"""
for imageName in imgNames:
img = open(imageName)
loadedImgs = {}
first = True
imgList = ''
imgLine = ' '
name = img.readline().replace('\n', '')
name = name[1:]
while True:
imgLine = img.readline().replace('\n', '')
if imgLine == '':
break
if(imgLine[0] == ':'):
loadedImgs[name] = json.loads(imgList)
name = imgLine[1:]
imgList = ''
else:
imgList += imgLine
loadedImgs[name] = json.loads(imgList)
print(loadedImgs)
return loadedImgs
def get_calendar(username):
"""retrieves the github commit calendar data for a username"""
BASEURL='https://github.com/'
@ -165,6 +190,7 @@ def save(output, filename):
f.close()
def main():
global images
print '''
_ __ _____ __ _
____ _(_) /_/ __(_) /_(_)
@ -186,6 +212,10 @@ def main():
if offset == None: offset = 0
else: offset = int(offset)
print 'enter file(s) to load images from (blank if not applicable)'
imgNames = raw_input(">").split(' ')
images = dict(images, **load_images(imgNames))
print 'enter the image name to gitfiti'
print 'images: ' + ", ".join(images.keys())
image = raw_input(">")