From e85ca8c7130888e0ec9bd03f5b9679e3f2738fc5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 14 Jun 2020 12:51:33 +0200 Subject: [PATCH] commands: display tracks creation progress in verbose mode --- nonstop/management/commands/create_tracks_from_nonstop.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nonstop/management/commands/create_tracks_from_nonstop.py b/nonstop/management/commands/create_tracks_from_nonstop.py index 72cda40..a520aed 100644 --- a/nonstop/management/commands/create_tracks_from_nonstop.py +++ b/nonstop/management/commands/create_tracks_from_nonstop.py @@ -33,8 +33,11 @@ class Command(BaseCommand): tranche_slug_mapping[tranche_key] = Nonstop.objects.get(slug=tranche_value) except Nonstop.DoesNotExist: continue - for nonstopfile in NonstopFile.objects.filter(**kwargs): + count = NonstopFile.objects.filter(**kwargs).count() + for i, nonstopfile in enumerate(NonstopFile.objects.filter(**kwargs)): filepath = nonstopfile.filepath.replace(REMOTE_BASE_PATH, LOCAL_BASE_PATH) + if self.verbose: + print(i, count, filepath) short_filepath = filepath[len(LOCAL_BASE_PATH):] if short_filepath.startswith('SPOTS'): continue -- 2.39.2