added basic jokes
This commit is contained in:
parent
6ad88d488f
commit
ea5400c1e2
@ -1496,7 +1496,7 @@ if __name__ == '__main__':
|
||||
|
||||
t = time.time()
|
||||
|
||||
update_frequencies = {'stocks':2, 'crypto':7, 'forex':60, 'news':120, 'weather': 120, 'sports': 1440, 'commodities': 15, 'indices': 15, 'movies': 1440, 'ipo': 1440, 'prepost': 15, 'economic': 15} #minutes
|
||||
update_frequencies = {'stocks':2, 'crypto':7, 'forex':60, 'news':120, 'weather': 120, 'sports': 1440, 'commodities': 15, 'indices': 15, 'movies': 1440, 'ipo': 1440, 'prepost': 15, 'economic': 15, 'jokes': 15} #minutes
|
||||
|
||||
NY_zone = pytz.timezone('America/New_York')
|
||||
CET_zone = pytz.timezone('EST')
|
||||
@ -1573,7 +1573,8 @@ if __name__ == '__main__':
|
||||
"news": {"time": "06/03/2022 04:07:09", "force": True}, "weather": {"time": "06/03/2022 04:08:20", "force": True},
|
||||
"forex": {"time": "06/03/2022 03:54:02", "force": True}, "sports_l": {"time": "06/03/2022 04:10:09", "force": True},
|
||||
"sports_p": {"time": "06/03/2022 04:10:09", "force": True},
|
||||
"sports_u": {"time": "06/03/2022 04:10:09", "force": True},"sports_t": {"time": "06/03/2022 04:10:09", "force": True}, "commodities": {"time": "06/03/2022 04:10:09", "force": True}, "indices": {"time": "06/03/2022 04:10:09", "force": True}, "movies": {"time": "06/03/2022 04:10:09", "force": True}, "ipo": {"time": "06/03/2022 04:10:09", "force": True}, "prepost": {"time": "06/03/2022 04:10:09", "force": True}, "economic": {"time": "06/03/2022 04:10:09", "force": True}}
|
||||
"sports_u": {"time": "06/03/2022 04:10:09", "force": True},"sports_t": {"time": "06/03/2022 04:10:09", "force": True}, "commodities": {"time": "06/03/2022 04:10:09", "force": True}, "indices": {"time": "06/03/2022 04:10:09", "force": True}, "movies": {"time": "06/03/2022 04:10:09", "force": True}, "ipo": {"time": "06/03/2022 04:10:09", "force": True},
|
||||
"prepost": {"time": "06/03/2022 04:10:09", "force": True}, "economic": {"time": "06/03/2022 04:10:09", "force": True}, "jokes": {"time": "06/03/2022 04:10:09", "force": True}}
|
||||
|
||||
try:
|
||||
if last_updates['scheduler']['force']:
|
||||
@ -1715,7 +1716,22 @@ if __name__ == '__main__':
|
||||
update_process = Process(target = updateEconomic, args = (api_key,logf))
|
||||
update_process.start()
|
||||
update_processes.append(update_process)
|
||||
|
||||
|
||||
|
||||
# jokes
|
||||
jokes_time = datetime.strptime(last_updates['jokes']['time'], "%d/%m/%Y %H:%M:%S")
|
||||
|
||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||
diff = (NY_time - jokes_time).total_seconds()/60 #minutes
|
||||
|
||||
if last_updates['jokes']['force'] or diff >= update_frequencies['jokes']:# or msg == 'c':
|
||||
jokes_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||
last_updates['jokes']['time'] = jokes_time
|
||||
last_updates['jokes']['force'] = False
|
||||
update_process = Process(target = updateJokes, args = (api_key,logf))
|
||||
update_process.start()
|
||||
update_processes.append(update_process)
|
||||
|
||||
|
||||
# indices
|
||||
indices_time = datetime.strptime(last_updates['indices']['time'], "%d/%m/%Y %H:%M:%S")
|
||||
|
Loading…
Reference in New Issue
Block a user