endoreg-db 0.8.3.9__py3-none-any.whl → 0.8.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of endoreg-db might be problematic. Click here for more details.

@@ -55,7 +55,18 @@ class VideoImportService():
55
55
  self.project_root = Path(__file__).parent.parent.parent.parent
56
56
 
57
57
  # Track processed files to prevent duplicates
58
- self.processed_files = set(str(Path(ANONYM_VIDEO_DIR) / file) for file in os.listdir(ANONYM_VIDEO_DIR))
58
+ try:
59
+ # Ensure anonym_video directory exists before listing files
60
+ anonym_video_dir = Path(ANONYM_VIDEO_DIR)
61
+ if anonym_video_dir.exists():
62
+ self.processed_files = set(str(anonym_video_dir / file) for file in os.listdir(ANONYM_VIDEO_DIR))
63
+ else:
64
+ logger.info(f"Creating anonym_videos directory: {anonym_video_dir}")
65
+ anonym_video_dir.mkdir(parents=True, exist_ok=True)
66
+ self.processed_files = set()
67
+ except Exception as e:
68
+ logger.warning(f"Failed to initialize processed files tracking: {e}")
69
+ self.processed_files = set()
59
70
 
60
71
  # Central video instance and processing context
61
72
  self.current_video: Optional[VideoFile] = None
@@ -146,6 +157,9 @@ class VideoImportService():
146
157
  High-level helper that orchestrates the complete video import and anonymization process.
147
158
  Uses the central video instance pattern for improved state management.
148
159
  """
160
+ # DEFENSIVE: Initialize processing_context immediately to prevent KeyError crashes
161
+ self.processing_context = {'file_path': Path(file_path)}
162
+
149
163
  try:
150
164
  # Initialize processing context
151
165
  self._initialize_processing_context(file_path, center_name, processor_name,
@@ -182,7 +196,12 @@ class VideoImportService():
182
196
  return self.current_video
183
197
 
184
198
  except Exception as e:
185
- self.logger.error(f"Video import and anonymization failed for {file_path}: {e}")
199
+ # Safe file path access - handles cases where processing_context wasn't initialized
200
+ safe_file_path = getattr(self, 'processing_context', {}).get('file_path', file_path)
201
+ # Debug: Log context state for troubleshooting
202
+ context_keys = list(getattr(self, 'processing_context', {}).keys())
203
+ self.logger.debug(f"Context keys during error: {context_keys}")
204
+ self.logger.error(f"Video import and anonymization failed for {safe_file_path}: {e}")
186
205
  self._cleanup_on_error()
187
206
  raise
188
207
  finally:
@@ -969,6 +988,10 @@ class VideoImportService():
969
988
  This method is always called in the finally block of import_and_anonymize()
970
989
  to ensure the file lock is released even if processing fails.
971
990
  """
991
+ # DEFENSIVE: Ensure processing_context exists before accessing it
992
+ if not hasattr(self, 'processing_context'):
993
+ self.processing_context = {}
994
+
972
995
  try:
973
996
  # Release file lock if it was acquired
974
997
  lock_context = self.processing_context.get('_lock_context')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: endoreg-db
3
- Version: 0.8.3.9
3
+ Version: 0.8.4.0
4
4
  Summary: EndoReg Db Django App
5
5
  Project-URL: Homepage, https://info.coloreg.de
6
6
  Project-URL: Repository, https://github.com/wg-lux/endoreg-db
@@ -602,7 +602,7 @@ endoreg_db/services/pseudonym_service.py,sha256=CJhbtRa6K6SPbphgCZgEMi8AFQtB18CU
602
602
  endoreg_db/services/requirements_object.py,sha256=290zf8AEbVtCoHhW4Jr7_ud-RvrqYmb1Nz9UBHtTnc0,6164
603
603
  endoreg_db/services/segment_sync.py,sha256=YgHvIHkbW4mqCu0ACf3zjRSZnNfxWwt4gh5syUVXuE0,6400
604
604
  endoreg_db/services/storage_aware_video_processor.py,sha256=kKFK64vXLeBSVkp1YJonU3gFDTeXZ8C4qb9QZZB99SE,13420
605
- endoreg_db/services/video_import.py,sha256=PNAHHZHzge2TYDaZP63CL-sslj01CxFky6sEi6Twavg,46045
605
+ endoreg_db/services/video_import.py,sha256=5a73s0Au0kgZFbrsD4WUqmDAqhQmuf9_wqs79SI-byE,47356
606
606
  endoreg_db/tasks/upload_tasks.py,sha256=OJq7DhNwcbWdXzHY8jz5c51BCVkPN5gSWOz-6Fx6W5M,7799
607
607
  endoreg_db/tasks/video_ingest.py,sha256=kxFuYkHijINV0VabQKCFVpJRv6eCAw07tviONurDgg8,5265
608
608
  endoreg_db/tasks/video_processing_tasks.py,sha256=rZ7Kr49bAR4Q-vALO2SURebrhcJ5hSFGwjF4aULrOao,14089
@@ -786,7 +786,7 @@ endoreg_db/views/video/video_meta.py,sha256=C1wBMTtQb_yzEUrhFGAy2UHEWMk_CbU75WXX
786
786
  endoreg_db/views/video/video_processing_history.py,sha256=mhFuS8RG5GV8E-lTtuD0qrq-bIpnUFp8vy9aERfC-J8,770
787
787
  endoreg_db/views/video/video_remove_frames.py,sha256=2FmvNrSPM0fUXiBxINN6vBUUDCqDlBkNcGR3WsLDgKo,1696
788
788
  endoreg_db/views/video/video_stream.py,sha256=kLyuf0ORTmsLeYUQkTQ6iRYqlIQozWhMMR3Lhfe_trk,12148
789
- endoreg_db-0.8.3.9.dist-info/METADATA,sha256=ByxNYCIC-wIFfuG-7mfsrJ6KJumFz0K17X3-ABUuhCs,14758
790
- endoreg_db-0.8.3.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
791
- endoreg_db-0.8.3.9.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
792
- endoreg_db-0.8.3.9.dist-info/RECORD,,
789
+ endoreg_db-0.8.4.0.dist-info/METADATA,sha256=VbEZv_ib_RgBN6I8T17X0e49fU7YYrZOBe24nL4u7ig,14758
790
+ endoreg_db-0.8.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
791
+ endoreg_db-0.8.4.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
792
+ endoreg_db-0.8.4.0.dist-info/RECORD,,