oxdata/oxdata/movie/management/commands/cache_imdb_ids.py

24 lines
596 B
Python

# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
import movie.models
import movie.imdbids
class Command(BaseCommand):
"""
load new ids into cache
"""
help = 'load ids from sites that dont support search.'
args = ''
def add_arguments(self, parser):
parser.add_argument('--debug', action='store_true', dest='debug', default=False, help='print debug info')
def handle(self, **options):
timeout = 30*24*60*60
if options.get('debug'):
movie.imdbids.DEBUG = True
movie.models.get_new_ids(timeout)