remove old tv program

This commit is contained in:
j 2017-01-21 21:12:19 +01:00
parent f71240ac2c
commit 3b3c22d7ed

View file

@ -2,7 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4 # vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, print_function, absolute_import from __future__ import division, print_function, absolute_import
from datetime import timedelta from datetime import datetime, timedelta
from celery.task import periodic_task from celery.task import periodic_task
@ -16,3 +16,5 @@ def update_program(**kwargs):
if limit_rate('tv.tasks.update_program', 8 * 60 * 60): if limit_rate('tv.tasks.update_program', 8 * 60 * 60):
for c in models.Channel.objects.all(): for c in models.Channel.objects.all():
c.update_program() c.update_program()
old = datetime.now() - timedelta(days=180)
models.Program.filter(created__lt=old).delete()