]> git.parisson.com Git - teleforma.git/commitdiff
better s3 flaging
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Sat, 8 Aug 2026 23:12:12 +0000 (01:12 +0200)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Sat, 8 Aug 2026 23:12:12 +0000 (01:12 +0200)
teleforma/management/commands/teleforma-export-conferences-s3.py

index 82a4b5f13e49fb2fd48e03ac3f3bf262612bc91d..810414e82cba277e3732a65b0d9c7961d97b4eb8 100644 (file)
@@ -55,10 +55,13 @@ class Command(BaseCommand):
                 s3_exported=False,
                 status=3,
                 )
+
             for conference in conferences:
+                s3_exported = False
+
                 for media in conference.media.all():
 
-                    if media.file:
+                    if media.file and not media.file_s3:
                         media_file = media.file.path
                         filename = os.path.split(media_file)[1]
                         if os.path.exists(media_file):
@@ -67,8 +70,9 @@ class Command(BaseCommand):
                             media.set_mime_type()
                             media.save()
                             logger.logger.info(media_file)
+                            s3_exported = True
 
-                    if media.poster_file:
+                    if media.poster_file and not media.poster_file_s3:
                         poster_file = media.poster_file.path
                         filename = os.path.split(poster_file)[1]
                         if os.path.exists(poster_file):
@@ -76,7 +80,9 @@ class Command(BaseCommand):
                                 media.poster_file_s3.save(filename, File(f))
                             media.save()
                             logger.logger.info(poster_file)
+                            s3_exported = True
 
-                        conference.s3_exported = True
-                        conference.save()
+                if s3_exported:
+                    conference.s3_exported = True
+                    conference.save()