Beispiel #1
0
def init():
	status,data,update_date=cron.check()
	if status:
		#download index changed
		dic=parseIndex(data)#fetch json of data
		if dic is None:
			sys.exit(0)
		updateFiles(dic)
		stats={}
		stats['lastUpdated']=update_date.strip()
		stats["files"]={}
		for key in dic:
			if key in config.getConfig("tracking_files"):
				stats["files"][key]=dic[key].strip()
		try:
			del stats["files"]["../"] #remove parent index
		except KeyError:
			pass
		try:
			open("stats.json","w").write(json.dumps(stats, indent=4, sort_keys=True))
			log.put("Stats updated","SUCCESS")
		except:
			log.put("Cannot update stats","FAIL")
		
		log.headPut("Finished cron-dbpedia","SUCCESS")
	else:
		#No change exit silently
		sys.exit(0)
Beispiel #2
0
def handle_users(message):
    _logger.info("/croncheck")
    HSHBOT_ADMIN_ID = int(os.environ['HSHBOT_ADMIN_ID'])
    if message.from_user.id == HSHBOT_ADMIN_ID:
        cron.check(bot=bot)