Refactor environment variables and remove unused launch configuration

This commit is contained in:
Dom 2026-02-07 19:43:14 +00:00
parent 400f8a53f8
commit 1e4a7b86b6
3 changed files with 37 additions and 51 deletions

View File

@ -5,9 +5,9 @@ services:
restart: unless-stopped restart: unless-stopped
environment: environment:
CONFIG_YAML: /app/config.yaml CONFIG_YAML: /app/config.yaml
DEBUGPY: "1" DEBUG: "1"
ports: ports:
- "5678:5678" - "5678:5678"
volumes: volumes:
- ./:/app - ./:/app
- ./config.yaml:/app/config.yaml:ro - ./config.yaml:/app/config.yaml:ro

View File

@ -1,14 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Docker (melesICUmover)",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
}
}
]
}

70
main.py
View File

@ -284,7 +284,7 @@ def job_set_status(cur, uuid: str, status: str, *, err: Optional[str] = None, pr
processed_jpg_key = COALESCE(%s, processed_jpg_key), processed_jpg_key = COALESCE(%s, processed_jpg_key),
thumbnail_key = COALESCE(%s, thumbnail_key) thumbnail_key = COALESCE(%s, thumbnail_key)
WHERE image_uuid = %s; WHERE image_uuid = %s;
""", (status, status, err, err, err, processed_key, thumb_key, uuid)) """, (status, status, err, err, processed_key, thumb_key, uuid))
def insert_resource(cur, uuid: str, typ: str): def insert_resource(cur, uuid: str, typ: str):
@ -317,12 +317,12 @@ def insert_metadata(cur, uuid: str, meta: dict):
# NOTE: DateTimeLastSettings looks like "05:45:35 30.06.2025" in sample; parse if needed later. # NOTE: DateTimeLastSettings looks like "05:45:35 30.06.2025" in sample; parse if needed later.
cur.execute(""" cur.execute("""
INSERT INTO remote_cam.metadata( INSERT INTO remote_cam.metadata(
metadata_uuid, import_ts, ImageCreationDate, SizeInByte, ImageFormat, ImageNight, metadata_uuid, import_ts, "ImageCreationDate", "SizeInByte", "ImageFormat", "ImageNight",
DateTimeLastSettings, BatteryStatus, FirmwareVersion, SignalStrength, Temperature, "DateTimeLastSettings", "BatteryStatus", "FirmwareVersion", "SignalStrength", "Temperature",
CoordinateSwitch, Latitude, Longitude, WorkPeriod, WorkStart, WorkEnd, ThumbnailSize, "CoordinateSwitch", "Latitude", "Longitude", "WorkPeriod", "WorkStart", "WorkEnd", "ThumbnailSize",
PIRInterval, TimeScan, imei, iccid, INITKey, CameraName, CameraModel, CameraLanguage, "PIRInterval", "TimeScan", imei, iccid, "INITKey", "CameraName", "CameraModel", "CameraLanguage",
CameraNetwork, MobileNetworkCode, MobileCountryCode, LocationAreaCode, CustomerTimezone, "CameraNetwork", "MobileNetworkCode", "MobileCountryCode", "LocationAreaCode", "CustomerTimezone",
CustomerLanguage, servertime, ocr_ts "CustomerLanguage", servertime, ocr_ts
) VALUES ( ) VALUES (
%s, now(), %s, %s, %s, %s, %s, now(), %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
@ -333,36 +333,36 @@ def insert_metadata(cur, uuid: str, meta: dict):
) )
ON CONFLICT (metadata_uuid) DO UPDATE SET ON CONFLICT (metadata_uuid) DO UPDATE SET
import_ts = EXCLUDED.import_ts, import_ts = EXCLUDED.import_ts,
ImageCreationDate = EXCLUDED.ImageCreationDate, "ImageCreationDate" = EXCLUDED."ImageCreationDate",
SizeInByte = EXCLUDED.SizeInByte, "SizeInByte" = EXCLUDED."SizeInByte",
ImageFormat = EXCLUDED.ImageFormat, "ImageFormat" = EXCLUDED."ImageFormat",
ImageNight = EXCLUDED.ImageNight, "ImageNight" = EXCLUDED."ImageNight",
DateTimeLastSettings = EXCLUDED.DateTimeLastSettings, "DateTimeLastSettings" = EXCLUDED."DateTimeLastSettings",
BatteryStatus = EXCLUDED.BatteryStatus, "BatteryStatus" = EXCLUDED."BatteryStatus",
FirmwareVersion = EXCLUDED.FirmwareVersion, "FirmwareVersion" = EXCLUDED."FirmwareVersion",
SignalStrength = EXCLUDED.SignalStrength, "SignalStrength" = EXCLUDED."SignalStrength",
Temperature = EXCLUDED.Temperature, "Temperature" = EXCLUDED."Temperature",
CoordinateSwitch = EXCLUDED.CoordinateSwitch, "CoordinateSwitch" = EXCLUDED."CoordinateSwitch",
Latitude = EXCLUDED.Latitude, "Latitude" = EXCLUDED."Latitude",
Longitude = EXCLUDED.Longitude, "Longitude" = EXCLUDED."Longitude",
WorkPeriod = EXCLUDED.WorkPeriod, "WorkPeriod" = EXCLUDED."WorkPeriod",
WorkStart = EXCLUDED.WorkStart, "WorkStart" = EXCLUDED."WorkStart",
WorkEnd = EXCLUDED.WorkEnd, "WorkEnd" = EXCLUDED."WorkEnd",
ThumbnailSize = EXCLUDED.ThumbnailSize, "ThumbnailSize" = EXCLUDED."ThumbnailSize",
PIRInterval = EXCLUDED.PIRInterval, "PIRInterval" = EXCLUDED."PIRInterval",
TimeScan = EXCLUDED.TimeScan, "TimeScan" = EXCLUDED."TimeScan",
imei = EXCLUDED.imei, imei = EXCLUDED.imei,
iccid = EXCLUDED.iccid, iccid = EXCLUDED.iccid,
INITKey = EXCLUDED.INITKey, "INITKey" = EXCLUDED."INITKey",
CameraName = EXCLUDED.CameraName, "CameraName" = EXCLUDED."CameraName",
CameraModel = EXCLUDED.CameraModel, "CameraModel" = EXCLUDED."CameraModel",
CameraLanguage = EXCLUDED.CameraLanguage, "CameraLanguage" = EXCLUDED."CameraLanguage",
CameraNetwork = EXCLUDED.CameraNetwork, "CameraNetwork" = EXCLUDED."CameraNetwork",
MobileNetworkCode = EXCLUDED.MobileNetworkCode, "MobileNetworkCode" = EXCLUDED."MobileNetworkCode",
MobileCountryCode = EXCLUDED.MobileCountryCode, "MobileCountryCode" = EXCLUDED."MobileCountryCode",
LocationAreaCode = EXCLUDED.LocationAreaCode, "LocationAreaCode" = EXCLUDED."LocationAreaCode",
CustomerTimezone = EXCLUDED.CustomerTimezone, "CustomerTimezone" = EXCLUDED."CustomerTimezone",
CustomerLanguage = EXCLUDED.CustomerLanguage, "CustomerLanguage" = EXCLUDED."CustomerLanguage",
servertime = EXCLUDED.servertime; servertime = EXCLUDED.servertime;
""", ( """, (
uuid, icd, get("SizeInByte"), get("ImageFormat"), get("ImageNight"), uuid, icd, get("SizeInByte"), get("ImageFormat"), get("ImageNight"),