Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e94c43ff19 | |||
| 1f0c658fff |
@@ -1,4 +1,9 @@
|
||||
import os
|
||||
import os, logging
|
||||
DEBUG = os.environ.get('DEBUG')
|
||||
logging.basicConfig(
|
||||
format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s - %(message)s',
|
||||
level=logging.DEBUG if DEBUG else logging.INFO)
|
||||
|
||||
import sys
|
||||
import json
|
||||
import socket
|
||||
@@ -51,7 +56,8 @@ def playback_thread(file_path, state):
|
||||
frame = next(iterator)
|
||||
except StopIteration:
|
||||
break
|
||||
except av.AVError:
|
||||
except av.AVError as e:
|
||||
logging.error(f"AVError during decode: {e}")
|
||||
continue
|
||||
|
||||
with state.lock:
|
||||
@@ -122,11 +128,14 @@ def handle_ipc_client(conn, state):
|
||||
else:
|
||||
resp["error"] = "unknown command"
|
||||
|
||||
logging.info(f"IPC Command: {cmd} -> Response: {resp}")
|
||||
conn.sendall((json.dumps(resp) + '\n').encode('utf-8'))
|
||||
except Exception as e:
|
||||
logging.error(f"IPC Error processing line '{line}': {e}")
|
||||
err_resp = {"error": str(e)}
|
||||
conn.sendall((json.dumps(err_resp) + '\n').encode('utf-8'))
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logging.error(f"IPC Client connection error: {e}")
|
||||
break
|
||||
conn.close()
|
||||
|
||||
@@ -147,7 +156,8 @@ def ipc_server_thread(socket_path, state):
|
||||
t.start()
|
||||
except socket.timeout:
|
||||
continue
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logging.error(f"IPC Server error: {e}")
|
||||
break
|
||||
|
||||
server.close()
|
||||
|
||||
Reference in New Issue
Block a user