fixed location of where tracks where saved (sys.path error), image should now be built upon correct, most recent data

This commit is contained in:
Xevion
2019-12-23 15:30:00 -06:00
parent 7f1a6a6e25
commit d788c3c915
2 changed files with 6 additions and 6 deletions

View File

@@ -11,11 +11,11 @@ from .spotify_explicit import main
path = os.path.join('app/spotify_explicit/recent.json')
def check_and_update():
with open(path) as file:
try:
try:
with open(path) as file:
file = json.load(file)
except json.JSONDecodeError:
file = {'last_generated' : -1}
except (FileNotFoundError, json.JSONDecodeError):
file = {'last_generated' : -1}
if file['last_generated'] == -1:
return True
@@ -33,7 +33,7 @@ def check_and_update():
def spotify():
if check_and_update():
print('Graph out of date - running update command')
with open(path, 'w') as file:
with open(path, 'w+') as file:
file = json.dump({'last_generated' : int(time.time())}, file)
main.main()
return send_file('spotify_explicit/export/export.png')