Add JSON schemas and conversion/validation/preset scripts

This commit is contained in:
eduard256
2026-03-23 12:23:15 +00:00
parent 230f11e34f
commit dadf7a8320
5 changed files with 641 additions and 0 deletions
+84
View File
@@ -0,0 +1,84 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/eduard256/StrixCamDB/schemas/brand.schema.json",
"title": "StrixCamDB Brand File",
"description": "Schema for IP camera brand files in StrixCamDB v2 format",
"type": "object",
"required": ["version", "brand", "brand_id", "streams"],
"additionalProperties": false,
"properties": {
"version": {
"type": "integer",
"const": 2,
"description": "Format version, always 2"
},
"brand": {
"type": "string",
"minLength": 1,
"description": "Human-readable brand name"
},
"brand_id": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9\\-]*[a-z0-9]$|^[a-z0-9]$",
"description": "URL-safe brand identifier, must match filename"
},
"streams": {
"type": "array",
"items": {
"$ref": "#/$defs/stream"
},
"description": "List of stream URL patterns for this brand"
}
},
"$defs": {
"stream": {
"type": "object",
"required": ["id", "url", "type", "protocol", "port", "models"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"minLength": 1,
"description": "Unique stream identifier within this brand file"
},
"url": {
"type": "string",
"description": "URL path with optional placeholders: [CHANNEL], [CHANNEL+1], [USERNAME], [PASSWORD], [WIDTH], [HEIGHT], [IP], [PORT], [AUTH], [TOKEN], [USER], [PASS], [PWD], [PASWORD]"
},
"type": {
"type": "string",
"description": "Stream type: FFMPEG, MJPEG, JPEG, VLC, BUBBLE, or future types"
},
"protocol": {
"type": "string",
"description": "Network protocol: rtsp, http, https, mms, rtmp, rtsps, bubble, rtp, or future protocols"
},
"port": {
"type": "integer",
"minimum": 0,
"maximum": 65535,
"description": "Port number. 0 means unknown/use default for protocol"
},
"models": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
},
"description": "Camera models this stream works for. [\"*\"] means all models of this brand"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"description": "Classification tags: main, sub, snapshot, mjpeg, audio, ptz, onvif, etc."
},
"notes": {
"type": "string",
"description": "Human-readable notes about this stream"
}
}
}
}
}
+72
View File
@@ -0,0 +1,72 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/eduard256/StrixCamDB/schemas/preset.schema.json",
"title": "StrixCamDB Preset File",
"description": "Schema for curated stream URL pattern lists",
"type": "object",
"required": ["version", "name", "preset_id", "streams"],
"additionalProperties": false,
"properties": {
"version": {
"type": "integer",
"const": 1,
"description": "Preset format version"
},
"name": {
"type": "string",
"minLength": 1,
"description": "Human-readable preset name"
},
"preset_id": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9\\-]*[a-z0-9]$",
"description": "URL-safe preset identifier, must match filename"
},
"description": {
"type": "string",
"description": "What this preset contains and when to use it"
},
"streams": {
"type": "array",
"items": {
"$ref": "#/$defs/preset_stream"
}
}
},
"$defs": {
"preset_stream": {
"type": "object",
"required": ["url", "type", "protocol", "port"],
"additionalProperties": false,
"properties": {
"url": {
"type": "string",
"description": "URL path with optional placeholders"
},
"type": {
"type": "string",
"description": "Stream type"
},
"protocol": {
"type": "string",
"description": "Network protocol"
},
"port": {
"type": "integer",
"minimum": 0,
"maximum": 65535,
"description": "Port number"
},
"notes": {
"type": "string",
"description": "Optional notes"
},
"brand_count": {
"type": "integer",
"minimum": 0,
"description": "Number of brands that use this pattern"
}
}
}
}
}