2010-06-26 14:32:08 +00:00
|
|
|
# -*- 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"
|
|
|
|
|
2010-09-10 15:12:22 +00:00
|
|
|
@task(ignore_resulsts=True, queue='default')
|
2010-09-23 16:01:48 +00:00
|
|
|
def updatePoster(itemId):
|
|
|
|
item = models.Item.objects.get(itemId=itemId)
|
|
|
|
item.download_poster(True)
|
2010-09-10 15:12:22 +00:00
|
|
|
|
2010-07-12 14:56:14 +00:00
|
|
|
@task(ignore_resulsts=True, queue='default')
|
|
|
|
def updateImdb(imdbId):
|
2010-09-23 16:01:48 +00:00
|
|
|
item = models.Item.objects.get(itemId=imdbId)
|
|
|
|
item.updateImdb()
|
2010-06-26 14:32:08 +00:00
|
|
|
|
|
|
|
@task(ignore_resulsts=True)
|
2010-09-23 16:01:48 +00:00
|
|
|
def findItem(fileId):
|
2010-06-26 14:32:08 +00:00
|
|
|
f = models.File.objects.get(pk=fileId)
|
2010-09-23 16:01:48 +00:00
|
|
|
f.findItem()
|
2010-06-26 14:32:08 +00:00
|
|
|
|
2010-07-12 14:56:14 +00:00
|
|
|
@task(ignore_resulsts=True, queue="encoding")
|
2010-06-26 14:32:08 +00:00
|
|
|
def extractData(fileId):
|
|
|
|
'''
|
|
|
|
update file stuff
|
|
|
|
create derivates and other related stuff for a file
|
|
|
|
'''
|
|
|
|
f = models.File.objects.get(pk=fileId)
|
|
|
|
f.extract()
|
|
|
|
|
2010-07-12 14:56:14 +00:00
|
|
|
@task(ignore_resulsts=True, queue="encoding")
|
2010-09-23 16:01:48 +00:00
|
|
|
def updateItem(movidId):
|
2010-06-26 14:32:08 +00:00
|
|
|
'''
|
2010-09-23 16:01:48 +00:00
|
|
|
update item
|
|
|
|
create proxy stream and other related files extracted from itemFiles
|
2010-06-26 14:32:08 +00:00
|
|
|
'''
|
2010-09-23 16:01:48 +00:00
|
|
|
m = models.Item.objects.get(pk=itemId)
|
2010-06-26 14:32:08 +00:00
|
|
|
m.extract()
|
|
|
|
|