run every 15m
This commit is contained in:
parent
6f35527ca3
commit
0cac482f56
3 changed files with 8 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
json/*
|
||||
__pycache__/
|
||||
*.swp
|
||||
|
|
|
@ -9,6 +9,8 @@ import random
|
|||
|
||||
import ox
|
||||
|
||||
from utils import run_async
|
||||
|
||||
class Engine:
|
||||
|
||||
def __init__(self, path):
|
||||
|
@ -115,6 +117,10 @@ class Engine:
|
|||
with open(os.path.join(self.path, 'playlists.json'), 'w') as f:
|
||||
f.write(json.dumps(self.playlists, indent=4, sort_keys=True))
|
||||
|
||||
@run_async
|
||||
def update_async(self):
|
||||
self.update()
|
||||
|
||||
|
||||
class Pandora:
|
||||
|
||||
|
|
7
server.py
Executable file → Normal file
7
server.py
Executable file → Normal file
|
@ -94,12 +94,7 @@ def main(prefix='json/'):
|
|||
app.listen(settings['port'], settings['address'])
|
||||
main = IOLoop.instance()
|
||||
|
||||
@run_async
|
||||
def update():
|
||||
engine.update()
|
||||
|
||||
update_cb = PeriodicCallback(update, 60000)
|
||||
|
||||
update_cb = PeriodicCallback(engine.update_async, 15*60*1000)
|
||||
#main.spawn_callback(update, engine)
|
||||
|
||||
#fixme run periodically
|
||||
|
|
Loading…
Reference in a new issue