2012-09-11 12:35:58 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
2016-08-23 10:27:06 +00:00
|
|
|
from __future__ import division, print_function, absolute_import
|
|
|
|
|
2013-02-21 13:28:36 +00:00
|
|
|
from datetime import timedelta
|
2012-09-11 12:35:58 +00:00
|
|
|
|
2013-02-21 13:28:36 +00:00
|
|
|
from celery.task import periodic_task
|
2012-09-11 12:35:58 +00:00
|
|
|
|
2016-08-18 11:41:24 +00:00
|
|
|
from app.utils import limit_rate
|
|
|
|
|
2016-08-23 10:27:06 +00:00
|
|
|
from . import models
|
2012-09-11 12:35:58 +00:00
|
|
|
|
2013-02-21 13:28:36 +00:00
|
|
|
|
2012-09-11 12:35:58 +00:00
|
|
|
@periodic_task(run_every=timedelta(days=1), queue='encoding')
|
|
|
|
def update_program(**kwargs):
|
2016-08-18 11:41:24 +00:00
|
|
|
if limit_rate('tv.tasks.update_program', 8 * 60 * 60):
|
|
|
|
for c in models.Channel.objects.all():
|
|
|
|
c.update_program()
|