promote out of copyright movies automatically

This commit is contained in:
j 2013-03-11 09:39:07 +00:00
parent 079d2b5ad7
commit cf9999e24a

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from datetime import datetime
from celery.task import periodic_task
from celery.schedules import crontab
@ -11,7 +12,12 @@ import item.models
@periodic_task(run_every=crontab(hour=6, minute=0), queue='encoding')
def cron(**kwargs):
update_double_imdb()
outofcopyright()
def outofcopyright():
for i in item.models.Item.objects.filter(sort__year__lt=datetime.now().year - 60, level=2):
i.level = 1
i.save()
def update_double_imdb():
l = itemlist.models.List.get(name='Double IMDb', user__username='j')