diff options
| author | Franoosh <uinarf@autistici.org> | 2026-06-18 07:54:20 +0200 |
|---|---|---|
| committer | Franoosh <uinarf@autistici.org> | 2026-06-18 07:54:20 +0200 |
| commit | 58065ed78c29e4b980daf21f324239e80f43c53b (patch) | |
| tree | 706290235b07d34a42e06296c8641ca7528fa8e8 /worker.py | |
| parent | 82dfeb112ad01f9e677a252053f0f480134d9cf9 (diff) | |
| download | ZeroMQ_Video_Streaming-development.tar.gz ZeroMQ_Video_Streaming-development.tar.bz2 ZeroMQ_Video_Streaming-development.zip | |
worker.py:development
- wrap timestamp string creation in a try/except
- add creating timestamp string from current time as a fallback
Diffstat (limited to 'worker.py')
| -rw-r--r-- | worker.py | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -230,10 +230,14 @@ class ServerWorker(Thread): """ update_clients(client_id, camera_id) - timestamp_string = datetime.datetime.fromtimestamp( - struct.unpack('d', timestamp)[0] - ).strftime(TIME_FORMAT_STRING) - logger.debug("Timestamp string: %r", timestamp_string) + try: + timestamp_string = datetime.datetime.fromtimestamp( + struct.unpack('d', timestamp)[0] + ).strftime(TIME_FORMAT_STRING) + logger.debug("Timestamp string: %r", timestamp_string) + except Exception as exc: + logger.error("Error unpacking timestamp: %r, creating from current time!", exc) + timestamp_string = datetime.datetime.now().strftime(TIME_FORMAT_STRING) # If it's ok to use current time as fallback, why send timestamp in the first place? camera_id_string = camera_id.decode('utf-8') filename = f"{camera_id_string}-{timestamp_string}.mp4" |
