From 1e5af36ec72e28286598b38c27bdaf5735a0343d Mon Sep 17 00:00:00 2001 From: MaM Web user Date: Thu, 2 Sep 2021 20:21:22 +0200 Subject: [PATCH] =?UTF-8?q?P=C5=99=C3=ADkaz=20na=20generov=C3=A1n=C3=AD=20?= =?UTF-8?q?n=C3=A1hled=C5=AF=20=C4=8D=C3=ADsel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../management/commands/generate_thumbnails.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 seminar/management/commands/generate_thumbnails.py diff --git a/seminar/management/commands/generate_thumbnails.py b/seminar/management/commands/generate_thumbnails.py new file mode 100644 index 00000000..e52ea9bc --- /dev/null +++ b/seminar/management/commands/generate_thumbnails.py @@ -0,0 +1,18 @@ +from django.core.management.base import BaseCommand + +from seminar.models import Cislo + +from subprocess import CalledProcessError +import logging + +logger = logging.getLogger(__name__) + +class Command(BaseCommand): + def handle(self, *args, **options): + for c in Cislo.objects.all(): + try: + c.vygeneruj_nahled() + except CalledProcessError: + logger.warning(f"Číslo {c} nezvládlo vygenerovat náhled titulky!") + pass +