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

24 lines
596 B
Python
Raw Normal View History

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