mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-07 18:08:47 -06:00
PyCharm grand repo wide reformat
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
|
||||
from flask import send_file
|
||||
|
||||
from app import app
|
||||
from config import Config
|
||||
from flask import send_from_directory, redirect, url_for, render_template, send_file
|
||||
import json
|
||||
import subprocess
|
||||
import time
|
||||
import os
|
||||
from .spotify_explicit import main
|
||||
|
||||
|
||||
path = os.path.join('app/spotify_explicit/recent.json')
|
||||
|
||||
|
||||
def check_and_update():
|
||||
try:
|
||||
with open(path) as file:
|
||||
file = json.load(file)
|
||||
except (FileNotFoundError, json.JSONDecodeError):
|
||||
file = {'last_generated' : -1}
|
||||
|
||||
file = {'last_generated': -1}
|
||||
|
||||
if file['last_generated'] == -1:
|
||||
return True
|
||||
else:
|
||||
@@ -28,12 +29,13 @@ def check_and_update():
|
||||
ideal = file['last_generated'] + Config.SPOTIFY_CACHE_TIME
|
||||
# print(f'Waiting another {int(ideal - time.time())} seconds')
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@app.route('/spotify/')
|
||||
def spotify():
|
||||
if check_and_update():
|
||||
print('Graph out of date - running update command')
|
||||
with open(path, 'w+') as file:
|
||||
file = json.dump({'last_generated' : int(time.time())}, file)
|
||||
file = json.dump({'last_generated': int(time.time())}, file)
|
||||
main.main()
|
||||
return send_file('spotify_explicit/export/export.png')
|
||||
return send_file('spotify_explicit/export/export.png')
|
||||
|
||||
Reference in New Issue
Block a user