cablegates/pandora/backend/tasks.py
2010-09-10 17:12:22 +02:00

47 lines
1.1 KiB
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 load
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 updatePoster(movieId):
movie = models.Movie.objects.get(movieId=movieId)
movie.download_poster(True)
@task(ignore_resulsts=True, queue='default')
def updateImdb(imdbId):
movie = models.Movie.objects.get(movieId=imdbId)
movie.updateImdb()
@task(ignore_resulsts=True)
def findMovie(fileId):
f = models.File.objects.get(pk=fileId)
f.findMovie()
@task(ignore_resulsts=True, queue="encoding")
def extractData(fileId):
'''
update file stuff
create derivates and other related stuff for a file
'''
f = models.File.objects.get(pk=fileId)
f.extract()
@task(ignore_resulsts=True, queue="encoding")
def updateMovie(movidId):
'''
update movie
create proxy stream and other related files extracted from movieFiles
'''
m = models.Movie.objects.get(pk=movieId)
m.extract()