Commit 9da11f50 authored by fred's avatar fred

load-from-drupal-json: add progress in verbose mode

parent 030b676f
......@@ -33,13 +33,16 @@ class Command(BaseCommand):
def handle(self, filename, verbosity, **options):
self.verbose = (verbosity > 1)
for episode_data in json.load(open(filename)).get('episodes').values():
values = json.load(open(filename)).get('episodes').values()
for i, episode_data in enumerate(values):
if not episode_data.get('title'):
if not episode_data.get('emission'):
if not episode_data.get('text') and not episode_data.get('sound'):
if self.verbose:
print('[%5d/%5d] %s' % (i+1, len(values), episode_data['title']))
emission_slug = self.adjust_slug(episode_data['emission'])
emission, created = Emission.objects.get_or_create(
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment