StrixCamDB-Add
You are editing the StrixCamDB camera database. Follow the rules below exactly.
Chat with the user in Russian. All data in JSON files -- in English.
CRITICAL RULE -- READ-ONLY FOR EXISTING DATA
You can ONLY ADD new data: new brands, new streams, new models. You must NEVER delete or modify existing entries -- not URLs, not models, not streams. Even if something looks wrong, broken, or nonsensical (like model name DVR or 1080P or empty-looking URL). These entries may be valid for specific cameras.
If you see something suspicious -- tell the user. But don't touch it without explicit confirmation.
STEP 1: Determine the operation
If the user provided details in the command arguments -- parse them and determine what to do automatically. If not -- ask using AskUserQuestion:
What do you want to do?
- Add new brand -- create a new JSON file for a brand that doesn't exist yet
- Add stream URL -- add a new stream entry to an existing brand
- Add model to stream -- add a model name to an existing stream's
models array
- Add OUI prefix -- add MAC address prefix to brand mapping in
oui.json
- Process contribution issues -- review and apply data from GitHub issues
Adding OUI prefix
When user selects "Add OUI prefix":
- Ask for MAC prefix (e.g.
3C:EF:8C) and brand name (e.g. Dahua)
- Multiple entries can be added at once
- Normalize prefix to uppercase:
3c:ef:8c -> 3C:EF:8C
- Validate format: must be
XX:XX:XX (uppercase hex, colon-separated)
- Read
oui.json, check if prefix already exists -- if yes, warn and show current mapping
- Add new entries, sort keys alphabetically
- Write back with 2-space indent,
ensure_ascii: false, trailing newline
- Verify:
python3 -c "import json; json.load(open('oui.json'))"
OUI file format (oui.json in repository root):
{
"3C:EF:8C": "Dahua",
"44:47:CC": "Hikvision"
}
Key: MAC prefix (first 3 octets). Value: brand name (human-readable).
Processing contribution issues
When user selects "Process contribution issues":
- Run
gh issue list --repo eduard256/StrixCamDB --label contribution --state open to list pending contributions
- Show the list to the user
- For each issue the user wants to process:
a. Run
gh issue view {number} --repo eduard256/StrixCamDB to read the YAML data
b. Parse the YAML block from the issue body:brand: Dahua
model: IPC-HDW1220S
url: /live
protocol: rtsp
port: 554
mac_prefix: 3C:EF:8C
comment: Works on firmware v2.800
c. Validate the data:
- Is the protocol known? If not -- warn the user, suggest
/StrixCamDB-New-Protocol-Or-Placeholders
- Does the brand file exist? If not -- this is "Add new brand" operation
- Is this URL already in the brand file? If yes -- warn about duplicate
- Does the model look suspicious? Warn but don't block
d. Apply the data using the normal add flow (STEP 3-5 below)
e. After successful commit, close the issue:
gh issue close {number} --repo eduard256/StrixCamDB --comment "Added to database"
f. If the data is invalid or rejected by user:
gh issue close {number} --repo eduard256/StrixCamDB --reason "not planned" --comment "Rejected: {reason}"
STEP 2: Collect required information
For "Add new brand"
Ask (or parse from input):
- Brand name (human-readable, e.g.
Hikvision)
- At least one stream URL with protocol and port
Brand ID is auto-generated from brand name: lowercase, spaces to hyphens, special chars removed.
For "Add stream URL"
Ask (or parse from input):
- Brand name or brand_id (search in
brands/ directory if unclear)
- URL path (e.g.
/Streaming/Channels/101)
- Protocol (
rtsp, http, https, rtsps, rtmp, mms, bubble, rtp, dvrip)
- Port number (e.g.
554, 80. Use 0 if unknown)
- Which models this stream works for (list of model names, or
* for all)
For "Add model to stream"
Ask (or parse from input):
- Brand name or brand_id
- Model name to add
- Which stream(s) to add it to (show existing streams, let user pick)
STEP 3: Validate before writing
Brand file structure
Every brand file is brands/{brand_id}.json:
{
"version": 2,
"brand": "Brand Name",
"brand_id": "brand-name",
"streams": [
{
"id": "brand-name-1",
"url": "/path/to/stream",
"protocol": "rtsp",
"port": 554,
"models": ["Model-A", "Model-B"],
"notes": "Optional notes"
}
]
}
Root fields
| Field |
Type |
Required |
Rules |
version |
int |
yes |
Always 2 |
brand |
string |
yes |
Human-readable name, capitalized properly |
brand_id |
string |
yes |
Lowercase, hyphens only, must match filename |
streams |
array |
yes |
At least one stream |
Stream fields
| Field |
Type |
Required |
Rules |
id |
string |
yes |
Format: {brand_id}-{N} where N is sequential. Must be unique within file |
url |
string |
yes |
URL path only (no protocol://host:port prefix). Can contain placeholders |
protocol |
string |
yes |
One of: rtsp, http, https, rtsps, rtmp, mms, bubble, rtp, dvrip |
port |
int |
yes |
0-65535. Use 0 if unknown (means "use default for protocol") |
models |
array |
yes |
Non-empty. Use ["*"] if stream works for all models of this brand |
notes |
string |
no |
Only add if genuinely useful context exists |
Supported URL placeholders
| Placeholder |
Description |
Example |
[CHANNEL] |
Channel number, 0-based |
0, 1, 2 |
[CHANNEL+1] |
Channel number, 1-based |
1, 2, 3 |
[USERNAME] |
Login username |
admin |
[PASSWORD] |
Login password |
12345 |
[WIDTH] |
Video width |
1920 |
[HEIGHT] |
Video height |
1080 |
[IP] |
Camera IP address |
192.168.1.100 |
[PORT] |
Port number |
554 |
[AUTH] |
Base64-encoded username:password |
|
[TOKEN] |
Authorization token |
|
Alternative forms: [USER], [PASS], [PWD], {CHANNEL}, {channel+1} -- all supported.
Validation rules
brand_id must match the filename (without .json)
- Every
id must be unique within the file
- No duplicate streams -- same
protocol:port:url combination must not appear twice
url must not be empty
models must not be empty
port must be integer 0-65535
protocol must be a non-empty string
- If brand file already exists -- read it first, don't overwrite
STEP 4: Write changes
Adding a new brand
- Verify file
brands/{brand_id}.json does NOT exist
- Create the file with
version: 2, brand info, and streams
- Stream IDs start from
{brand_id}-1
Adding a stream to existing brand
- Read existing
brands/{brand_id}.json
- Find the highest existing stream ID number (e.g. if last is
dahua-47, next is dahua-48)
- Append new stream to the
streams array
- Write file back with
indent=2, ensure_ascii=False, trailing newline
Adding a model to existing stream
- Read existing
brands/{brand_id}.json
- Find the target stream by ID or URL
- Add model name to the
models array (if not already present)
- Write file back
JSON formatting rules
- 2-space indent
- No trailing commas
ensure_ascii: false (preserve Unicode)
- Single trailing newline at end of file
- Keys order in root:
version, brand, brand_id, streams
- Keys order in stream:
id, url, protocol, port, models, notes
STEP 5: Verify
After writing:
- Run
python3 scripts/validate.py to check for errors
- If validation fails -- fix the issue immediately
- Show the user what was changed (brief summary)
Consistency check -- IMPORTANT
Before finishing, check for problems and report them to the user immediately:
- Duplicate streams (same
protocol:port:url) within the brand file
- Model names that look like categories, not real models (e.g.
DVR, PTZ, 1080P, Other) -- warn the user but don't block
- Unknown protocol values not listed in
schemas/brand.schema.json -- warn the user, suggest running /StrixCamDB-New-Protocol-Or-Placeholders
- Placeholder in URL that is not documented in README.md -- warn the user
- Any other inconsistencies between schemas, README, and actual data -- report immediately
STEP 6: Commit and version
Ask the user using AskUserQuestion:
Question: "Commit changes?"
- Commit only -- commit to main, CI will update latest release automatically
- Commit + fix version -- commit and create a version tag (ask for version, e.g.
v0.2.0)
- Don't commit -- leave changes uncommitted
If committing:
- Stage changed files:
git add brands/{brand_id}.json
- Commit with message in AlexxIT style:
- New brand:
Add {brand} camera database
- New stream:
Add stream URL for {brand}
- New model:
Add {model} to {brand}
- Push to main:
git push origin main
If fixing version:
- After commit and push, create tag:
git tag v{X.Y.Z}
- Push tag:
git push origin v{X.Y.Z}
- Confirm that CI will create a versioned release
Commit message rules -- ABSOLUTE:
- One line, imperative verb, no period at the end
- No
feat:, fix:, chore: prefixes
- No emoji, no "Co-Authored-By", no mention of AI/Claude
- Examples:
Add Reolink camera database, Add RTSP stream for TP-Link Tapo, Add DS-2CD2047 to Hikvision
1---2name: strixcamdb-add3description: Add new brands, camera models, or stream URLs to StrixCamDB. Use when user wants to add camera data to the database, mentions adding a brand/model/URL, or provides camera stream information.4---56# StrixCamDB-Add78You are editing the StrixCamDB camera database. Follow the rules below exactly.910Chat with the user in Russian. All data in JSON files -- in English.1112### CRITICAL RULE -- READ-ONLY FOR EXISTING DATA1314You can ONLY ADD new data: new brands, new streams, new models. You must NEVER delete or modify existing entries -- not URLs, not models, not streams. Even if something looks wrong, broken, or nonsensical (like model name `DVR` or `1080P` or empty-looking URL). These entries may be valid for specific cameras.1516If you see something suspicious -- tell the user. But don't touch it without explicit confirmation.1718---1920## STEP 1: Determine the operation2122If the user provided details in the command arguments -- parse them and determine what to do automatically. If not -- ask using AskUserQuestion:2324**What do you want to do?**251. **Add new brand** -- create a new JSON file for a brand that doesn't exist yet262. **Add stream URL** -- add a new stream entry to an existing brand273. **Add model to stream** -- add a model name to an existing stream's `models` array284. **Add OUI prefix** -- add MAC address prefix to brand mapping in `oui.json`295. **Process contribution issues** -- review and apply data from GitHub issues3031### Adding OUI prefix3233When user selects "Add OUI prefix":34351. Ask for MAC prefix (e.g. `3C:EF:8C`) and brand name (e.g. `Dahua`)362. Multiple entries can be added at once373. Normalize prefix to uppercase: `3c:ef:8c` -> `3C:EF:8C`384. Validate format: must be `XX:XX:XX` (uppercase hex, colon-separated)395. Read `oui.json`, check if prefix already exists -- if yes, warn and show current mapping406. Add new entries, sort keys alphabetically417. Write back with 2-space indent, `ensure_ascii: false`, trailing newline428. Verify: `python3 -c "import json; json.load(open('oui.json'))"`4344**OUI file format** (`oui.json` in repository root):4546```json47{48 "3C:EF:8C": "Dahua",49 "44:47:CC": "Hikvision"50}51```5253Key: MAC prefix (first 3 octets). Value: brand name (human-readable).5455### Processing contribution issues5657When user selects "Process contribution issues":58591. Run `gh issue list --repo eduard256/StrixCamDB --label contribution --state open` to list pending contributions602. Show the list to the user613. For each issue the user wants to process:62 a. Run `gh issue view {number} --repo eduard256/StrixCamDB` to read the YAML data63 b. Parse the YAML block from the issue body:64 ```yaml65 brand: Dahua66 model: IPC-HDW1220S67 url: /live68 protocol: rtsp69 port: 55470 mac_prefix: 3C:EF:8C71 comment: Works on firmware v2.80072 ```73 c. Validate the data:74 - Is the protocol known? If not -- warn the user, suggest `/StrixCamDB-New-Protocol-Or-Placeholders`75 - Does the brand file exist? If not -- this is "Add new brand" operation76 - Is this URL already in the brand file? If yes -- warn about duplicate77 - Does the model look suspicious? Warn but don't block78 d. Apply the data using the normal add flow (STEP 3-5 below)79 e. After successful commit, close the issue:80 `gh issue close {number} --repo eduard256/StrixCamDB --comment "Added to database"`81 f. If the data is invalid or rejected by user:82 `gh issue close {number} --repo eduard256/StrixCamDB --reason "not planned" --comment "Rejected: {reason}"`8384---8586## STEP 2: Collect required information8788### For "Add new brand"8990Ask (or parse from input):91- Brand name (human-readable, e.g. `Hikvision`)92- At least one stream URL with protocol and port9394Brand ID is auto-generated from brand name: lowercase, spaces to hyphens, special chars removed.9596### For "Add stream URL"9798Ask (or parse from input):99- Brand name or brand_id (search in `brands/` directory if unclear)100- URL path (e.g. `/Streaming/Channels/101`)101- Protocol (`rtsp`, `http`, `https`, `rtsps`, `rtmp`, `mms`, `bubble`, `rtp`, `dvrip`)102- Port number (e.g. `554`, `80`. Use `0` if unknown)103- Which models this stream works for (list of model names, or `*` for all)104105### For "Add model to stream"106107Ask (or parse from input):108- Brand name or brand_id109- Model name to add110- Which stream(s) to add it to (show existing streams, let user pick)111112---113114## STEP 3: Validate before writing115116### Brand file structure117118Every brand file is `brands/{brand_id}.json`:119120```json121{122 "version": 2,123 "brand": "Brand Name",124 "brand_id": "brand-name",125 "streams": [126 {127 "id": "brand-name-1",128 "url": "/path/to/stream",129 "protocol": "rtsp",130 "port": 554,131 "models": ["Model-A", "Model-B"],132 "notes": "Optional notes"133 }134 ]135}136```137138### Root fields139140| Field | Type | Required | Rules |141|-------|------|----------|-------|142| `version` | int | yes | Always `2` |143| `brand` | string | yes | Human-readable name, capitalized properly |144| `brand_id` | string | yes | Lowercase, hyphens only, must match filename |145| `streams` | array | yes | At least one stream |146147### Stream fields148149| Field | Type | Required | Rules |150|-------|------|----------|-------|151| `id` | string | yes | Format: `{brand_id}-{N}` where N is sequential. Must be unique within file |152| `url` | string | yes | URL path only (no protocol://host:port prefix). Can contain placeholders |153| `protocol` | string | yes | One of: `rtsp`, `http`, `https`, `rtsps`, `rtmp`, `mms`, `bubble`, `rtp`, `dvrip` |154| `port` | int | yes | 0-65535. Use `0` if unknown (means "use default for protocol") |155| `models` | array | yes | Non-empty. Use `["*"]` if stream works for all models of this brand |156| `notes` | string | no | Only add if genuinely useful context exists |157158### Supported URL placeholders159160| Placeholder | Description | Example |161|-------------|-------------|---------|162| `[CHANNEL]` | Channel number, 0-based | `0`, `1`, `2` |163| `[CHANNEL+1]` | Channel number, 1-based | `1`, `2`, `3` |164| `[USERNAME]` | Login username | `admin` |165| `[PASSWORD]` | Login password | `12345` |166| `[WIDTH]` | Video width | `1920` |167| `[HEIGHT]` | Video height | `1080` |168| `[IP]` | Camera IP address | `192.168.1.100` |169| `[PORT]` | Port number | `554` |170| `[AUTH]` | Base64-encoded `username:password` | |171| `[TOKEN]` | Authorization token | |172173Alternative forms: `[USER]`, `[PASS]`, `[PWD]`, `{CHANNEL}`, `{channel+1}` -- all supported.174175### Validation rules1761771. `brand_id` must match the filename (without `.json`)1782. Every `id` must be unique within the file1793. No duplicate streams -- same `protocol:port:url` combination must not appear twice1804. `url` must not be empty1815. `models` must not be empty1826. `port` must be integer 0-655351837. `protocol` must be a non-empty string1848. If brand file already exists -- read it first, don't overwrite185186---187188## STEP 4: Write changes189190### Adding a new brand1911921. Verify file `brands/{brand_id}.json` does NOT exist1932. Create the file with `version: 2`, brand info, and streams1943. Stream IDs start from `{brand_id}-1`195196### Adding a stream to existing brand1971981. Read existing `brands/{brand_id}.json`1992. Find the highest existing stream ID number (e.g. if last is `dahua-47`, next is `dahua-48`)2003. Append new stream to the `streams` array2014. Write file back with `indent=2`, `ensure_ascii=False`, trailing newline202203### Adding a model to existing stream2042051. Read existing `brands/{brand_id}.json`2062. Find the target stream by ID or URL2073. Add model name to the `models` array (if not already present)2084. Write file back209210### JSON formatting rules211212- 2-space indent213- No trailing commas214- `ensure_ascii: false` (preserve Unicode)215- Single trailing newline at end of file216- Keys order in root: `version`, `brand`, `brand_id`, `streams`217- Keys order in stream: `id`, `url`, `protocol`, `port`, `models`, `notes`218219---220221## STEP 5: Verify222223After writing:2241. Run `python3 scripts/validate.py` to check for errors2252. If validation fails -- fix the issue immediately2263. Show the user what was changed (brief summary)227228### Consistency check -- IMPORTANT229230Before finishing, check for problems and report them to the user immediately:231- Duplicate streams (same `protocol:port:url`) within the brand file232- Model names that look like categories, not real models (e.g. `DVR`, `PTZ`, `1080P`, `Other`) -- warn the user but don't block233- Unknown protocol values not listed in `schemas/brand.schema.json` -- warn the user, suggest running `/StrixCamDB-New-Protocol-Or-Placeholders`234- Placeholder in URL that is not documented in README.md -- warn the user235- Any other inconsistencies between schemas, README, and actual data -- report immediately236237---238239## STEP 6: Commit and version240241Ask the user using AskUserQuestion:242243**Question:** "Commit changes?"244- **Commit only** -- commit to main, CI will update latest release automatically245- **Commit + fix version** -- commit and create a version tag (ask for version, e.g. `v0.2.0`)246- **Don't commit** -- leave changes uncommitted247248### If committing:2492501. Stage changed files: `git add brands/{brand_id}.json`2512. Commit with message in AlexxIT style:252 - New brand: `Add {brand} camera database`253 - New stream: `Add stream URL for {brand}`254 - New model: `Add {model} to {brand}`2553. Push to main: `git push origin main`256257### If fixing version:2582591. After commit and push, create tag: `git tag v{X.Y.Z}`2602. Push tag: `git push origin v{X.Y.Z}`2613. Confirm that CI will create a versioned release262263### Commit message rules -- ABSOLUTE:264- One line, imperative verb, no period at the end265- No `feat:`, `fix:`, `chore:` prefixes266- No emoji, no "Co-Authored-By", no mention of AI/Claude267- Examples: `Add Reolink camera database`, `Add RTSP stream for TP-Link Tapo`, `Add DS-2CD2047 to Hikvision`