init-camera-vendors.sh 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #!/bin/bash
  2. # 摄像头厂家初始化脚本
  3. # 使用方法: ./init-camera-vendors.sh <token>
  4. # 示例: ./init-camera-vendors.sh "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
  5. API_BASE="https://tg-live-game.pwtk.cc/api"
  6. TOKEN="$1"
  7. if [ -z "$TOKEN" ]; then
  8. echo "请提供 token 参数"
  9. echo "使用方法: ./init-camera-vendors.sh <token>"
  10. exit 1
  11. fi
  12. echo "开始录入摄像头厂家数据..."
  13. # 1. HIKVISION 海康威视
  14. echo "正在添加: HIKVISION (海康威视)..."
  15. curl -s -X POST "${API_BASE}/admin/camera-vendors/create" \
  16. -H "Content-Type: application/json" \
  17. -H "Authorization: Bearer ${TOKEN}" \
  18. -d '{
  19. "code": "HIKVISION",
  20. "name": "海康威视",
  21. "description": "PTZ球机,支持H.264/H.265编码,浏览器可直接播放。型号示例: DS-2DE2A404IW-DE3",
  22. "supportOnvif": true,
  23. "supportPtz": true,
  24. "supportIsapi": true,
  25. "supportGb28181": true,
  26. "supportAudio": true,
  27. "resolution": "1920x1080",
  28. "defaultPort": 80,
  29. "defaultRtspPort": 554,
  30. "rtspUrlTemplate": "rtsp://{username}:{password}@{ip}:{port}/Streaming/Channels/{channel}01",
  31. "enabled": true,
  32. "sortOrder": 1
  33. }'
  34. echo ""
  35. # 2. ANPVIZ
  36. echo "正在添加: ANPVIZ..."
  37. curl -s -X POST "${API_BASE}/admin/camera-vendors/create" \
  38. -H "Content-Type: application/json" \
  39. -H "Authorization: Bearer ${TOKEN}" \
  40. -d '{
  41. "code": "ANPVIZ",
  42. "name": "ANPVIZ",
  43. "description": "枪机,H.265编码需FFmpeg转码为H.264。型号示例: L12D2_19_IR_AF。ONVIF专业级支持",
  44. "supportOnvif": true,
  45. "supportPtz": false,
  46. "supportIsapi": false,
  47. "supportGb28181": false,
  48. "supportAudio": true,
  49. "resolution": "1920x1080",
  50. "defaultPort": 80,
  51. "defaultRtspPort": 554,
  52. "rtspUrlTemplate": "rtsp://{username}:{password}@{ip}:{port}/Streaming/Channels/{channel}01",
  53. "enabled": true,
  54. "sortOrder": 2
  55. }'
  56. echo ""
  57. # 3. CT-IP500 (大华风格)
  58. echo "正在添加: CT-IP500..."
  59. curl -s -X POST "${API_BASE}/admin/camera-vendors/create" \
  60. -H "Content-Type: application/json" \
  61. -H "Authorization: Bearer ${TOKEN}" \
  62. -d '{
  63. "code": "CT-IP500",
  64. "name": "CT-IP500 (杂牌/大华风格)",
  65. "description": "枪机,H.264编码,浏览器可直接播放。RTSP路径为大华风格。ONVIF端口8999。Web页面无法访问,需用Window查看",
  66. "supportOnvif": true,
  67. "supportPtz": false,
  68. "supportIsapi": false,
  69. "supportGb28181": false,
  70. "supportAudio": false,
  71. "resolution": "1920x1080",
  72. "defaultPort": 80,
  73. "defaultRtspPort": 554,
  74. "rtspUrlTemplate": "rtsp://{username}:{password}@{ip}:{port}/cam/realmonitor?channel={channel}&subtype=0",
  75. "enabled": true,
  76. "sortOrder": 3
  77. }'
  78. echo ""
  79. # 4. SVBC
  80. echo "正在添加: SVBC..."
  81. curl -s -X POST "${API_BASE}/admin/camera-vendors/create" \
  82. -H "Content-Type: application/json" \
  83. -H "Authorization: Bearer ${TOKEN}" \
  84. -d '{
  85. "code": "SVBC",
  86. "name": "SVBC",
  87. "description": "枪机,H.265编码(2560x1920)需FFmpeg转码。ONVIF端口8080。RTSP路径简单: /1为主码流, /2为子码流",
  88. "supportOnvif": true,
  89. "supportPtz": false,
  90. "supportIsapi": false,
  91. "supportGb28181": false,
  92. "supportAudio": true,
  93. "resolution": "2560x1920",
  94. "defaultPort": 80,
  95. "defaultRtspPort": 554,
  96. "rtspUrlTemplate": "rtsp://{username}:{password}@{ip}:{port}/{channel}",
  97. "enabled": true,
  98. "sortOrder": 4
  99. }'
  100. echo ""
  101. # 5. Reolink
  102. echo "正在添加: Reolink..."
  103. curl -s -X POST "${API_BASE}/admin/camera-vendors/create" \
  104. -H "Content-Type: application/json" \
  105. -H "Authorization: Bearer ${TOKEN}" \
  106. -d '{
  107. "code": "REOLINK",
  108. "name": "Reolink",
  109. "description": "固定摄像头,需要通过Reolink App进行安装配置。需要安装他们的软件,在同一个网络里面扫描二维码进行设备注册",
  110. "supportOnvif": false,
  111. "supportPtz": false,
  112. "supportIsapi": false,
  113. "supportGb28181": false,
  114. "supportAudio": true,
  115. "resolution": "1920x1080",
  116. "defaultPort": 80,
  117. "defaultRtspPort": 554,
  118. "rtspUrlTemplate": "",
  119. "enabled": true,
  120. "sortOrder": 5
  121. }'
  122. echo ""
  123. # 6. DAHUA 大华 (额外添加,因为CT-IP500使用大华风格)
  124. echo "正在添加: DAHUA (大华)..."
  125. curl -s -X POST "${API_BASE}/admin/camera-vendors/create" \
  126. -H "Content-Type: application/json" \
  127. -H "Authorization: Bearer ${TOKEN}" \
  128. -d '{
  129. "code": "DAHUA",
  130. "name": "大华",
  131. "description": "大华摄像头,RTSP路径格式: /cam/realmonitor?channel=1&subtype=0 (主码流) 或 subtype=1 (子码流)",
  132. "supportOnvif": true,
  133. "supportPtz": true,
  134. "supportIsapi": false,
  135. "supportGb28181": true,
  136. "supportAudio": true,
  137. "resolution": "1920x1080",
  138. "defaultPort": 80,
  139. "defaultRtspPort": 554,
  140. "rtspUrlTemplate": "rtsp://{username}:{password}@{ip}:{port}/cam/realmonitor?channel={channel}&subtype=0",
  141. "enabled": true,
  142. "sortOrder": 6
  143. }'
  144. echo ""
  145. echo "✅ 摄像头厂家数据录入完成!"
  146. echo ""
  147. echo "录入的厂家列表:"
  148. echo " 1. HIKVISION (海康威视) - PTZ球机"
  149. echo " 2. ANPVIZ - 枪机"
  150. echo " 3. CT-IP500 (杂牌/大华风格) - 枪机"
  151. echo " 4. SVBC - 枪机"
  152. echo " 5. Reolink - 固定摄像头"
  153. echo " 6. DAHUA (大华) - 通用大华风格"