diff --git a/tasks.py b/tasks.py index 79908ae..f51e234 100644 --- a/tasks.py +++ b/tasks.py @@ -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')