Implemented support for user images.
This commit is contained in:
30
gitfiti.py
30
gitfiti.py
@ -87,6 +87,31 @@ images={
|
|||||||
'hireme':hireme
|
'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):
|
def get_calendar(username):
|
||||||
"""retrieves the github commit calendar data for a username"""
|
"""retrieves the github commit calendar data for a username"""
|
||||||
BASEURL='https://github.com/'
|
BASEURL='https://github.com/'
|
||||||
@ -165,6 +190,7 @@ def save(output, filename):
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
global images
|
||||||
print '''
|
print '''
|
||||||
_ __ _____ __ _
|
_ __ _____ __ _
|
||||||
____ _(_) /_/ __(_) /_(_)
|
____ _(_) /_/ __(_) /_(_)
|
||||||
@ -186,6 +212,10 @@ def main():
|
|||||||
if offset == None: offset = 0
|
if offset == None: offset = 0
|
||||||
else: offset = int(offset)
|
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 'enter the image name to gitfiti'
|
||||||
print 'images: ' + ", ".join(images.keys())
|
print 'images: ' + ", ".join(images.keys())
|
||||||
image = raw_input(">")
|
image = raw_input(">")
|
||||||
|
Reference in New Issue
Block a user