pandora/pandora/tv/tasks.py

19 lines
474 B
Python
Raw Normal View History

2012-09-11 12:35:58 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, print_function, absolute_import
from datetime import timedelta
2012-09-11 12:35:58 +00:00
from celery.task import periodic_task
2012-09-11 12:35:58 +00:00
from app.utils import limit_rate
from . import models
2012-09-11 12:35:58 +00:00
2012-09-11 12:35:58 +00:00
@periodic_task(run_every=timedelta(days=1), queue='encoding')
def update_program(**kwargs):
if limit_rate('tv.tasks.update_program', 8 * 60 * 60):
for c in models.Channel.objects.all():
c.update_program()