add in secret -1 option to never overwrite

This commit is contained in:
Xevion
2019-11-03 03:55:06 -06:00
parent 5562e5ff2d
commit 004e492ae8

View File

@@ -14,8 +14,9 @@ def check_and_update():
except json.JSONDecodeError:
file = {'last_generated' : -1}
regen = time.time() - 3600 >= file['last_generated']
with open(path, 'w') as file:
file = json.dump({'last_generated' : int(time.time())}, file)
if file['last_generated'] != -1:
with open(path, 'w') as file:
file = json.dump({'last_generated' : int(time.time())}, file)
return regen
@app.route('/spotify/')