Ejemplo n.º 1
0
caption=""

def isNewDate(date1):
	file = open(datafile,"r+")
	data = file.read()
	print "Old date:",data
	if (date1 == data):
		result = False
	else:
		file.seek(0,0)
		file.write(str(date1))
		result = True
	file.close()
	return result


d=feedparser.parse('http://feeds.feedburner.com/Setorth-Xd')
updated =  d['feed']['updated']
link =  d['feed']['links'][0]['href']
#print d['feed']
txt = ""
if (isNewDate(updated)):
	print "New update:", updated
	for i in d.entries:
		txt = txt + i['title'] +"\n"
	txt = txt.rstrip()
	textToImage.txt2imageNLXD(filename,txt,caption)
	FB.post_photo(filename,link,'10153759221199127')
else:
	print "No update since:",updated