From 12f04edd50cfda630ba3e4afb9b90fd27d4472ca Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 11 Aug 2010 15:10:29 +0200 Subject: [PATCH] add poster management commands --- oxdata/poster/management/__init__.py | 0 oxdata/poster/management/commands/__init__.py | 0 .../management/commands/cache_poster.py | 20 +++++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 oxdata/poster/management/__init__.py create mode 100644 oxdata/poster/management/commands/__init__.py create mode 100644 oxdata/poster/management/commands/cache_poster.py diff --git a/oxdata/poster/management/__init__.py b/oxdata/poster/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/oxdata/poster/management/commands/__init__.py b/oxdata/poster/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/oxdata/poster/management/commands/cache_poster.py b/oxdata/poster/management/commands/cache_poster.py new file mode 100644 index 0000000..c150a09 --- /dev/null +++ b/oxdata/poster/management/commands/cache_poster.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# vi:si:et:sw=4:sts=4:ts=4 + +from django.core.management.base import BaseCommand, CommandError +from django.conf import settings + +import poster.models + +class Command(BaseCommand): + """ + download all posters in PosterCache + """ + help = 'download all posters in PosterCache table.' + args = '' + + def handle(self, **options): + for p in poster.models.PosterCache.objects.filter(image='', failed=False).order_by('-created'): + print p.created, p.url + p.get() +