pandora/pandora/item/tasks.py
2011-10-28 20:27:54 +02:00

36 lines
861 B
Python

# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from datetime import timedelta
from celery.decorators import task, periodic_task
import models
@periodic_task(run_every=timedelta(days=1))
def cronjob(**kwargs):
print "do some cleanup stuff once a day"
@task(ignore_resulsts=True, queue='default')
def update_poster(itemId):
item = models.Item.objects.get(itemId=itemId)
item.make_poster(True)
item.make_icon()
item.save()
@task(ignore_resulsts=True, queue='default')
def update_external(itemId):
item = models.Item.objects.get(itemId=itemId)
item.update_external()
@task(queue="default")
def update_timeline(itemId):
item = models.Item.objects.get(itemId=itemId)
item.update_timeline()
@task(queue="default")
def load_subtitles(itemId):
item = models.Item.objects.get(itemId=itemId)
item.load_subtitles()