From d7eea638292e4f111b00d583a6907fe21be7ba22 Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Mon, 22 Feb 2021 13:46:51 -0800 Subject: [PATCH] minor api fixes * videoSampleEntryId should be a number, not a string * fix some markdown formatting * fix missing description of sampleFileBytes --- design/api.md | 29 +++++++++++++++-------------- server/src/json.rs | 2 +- server/src/web.rs | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/design/api.md b/design/api.md index e0d94da..52fbf94 100644 --- a/design/api.md +++ b/design/api.md @@ -113,21 +113,21 @@ The `application/json` response will have a dict as follows: * `rtsp_url` * `signals`: a list of all *signals* known to the server. Each is a dictionary with the following properties: - * `id`: an integer identifier. - * `shortName`: a unique, human-readable description of the signal - * `cameras`: a map of associated cameras' UUIDs to the type of association: - `direct` or `indirect`. See `db/schema.sql` for more description. - * `type`: a UUID, expected to match one of `signalTypes`. - * `days`: as in `cameras.streams.days` above. + * `id`: an integer identifier. + * `shortName`: a unique, human-readable description of the signal + * `cameras`: a map of associated cameras' UUIDs to the type of association: + `direct` or `indirect`. See `db/schema.sql` for more description. + * `type`: a UUID, expected to match one of `signalTypes`. + * `days`: as in `cameras.streams.days` above. **status: unimplemented** * `signalTypes`: a list of all known signal types. - * `uuid`: in text format. - * `states`: a map of all possible states of the enumeration to more - information about them: - * `color`: a recommended color to use in UIs to represent this state, - as in the [HTML specification](https://html.spec.whatwg.org/#colours). - * `motion`: if present and true, directly associated cameras will be - considered to have motion when this signal is in this state. + * `uuid`: in text format. + * `states`: a map of all possible states of the enumeration to more + information about them: + * `color`: a recommended color to use in UIs to represent this state, + as in the [HTML specification](https://html.spec.whatwg.org/#colours). + * `motion`: if present and true, directly associated cameras will be + considered to have motion when this signal is in this state. * `session`: if logged in, a dict with the following properties: * `username` * `csrf`: a cross-site request forgery token for use in `POST` requests. @@ -299,6 +299,7 @@ arbitrary order. Each recording object has the following properties: map.mp4` URL. * `videoSamples`: the number of samples (aka frames) of video in this recording. +* `sampleFileBytes`: the number of bytes of video in this recording. Under the property `videoSampleEntries`, an object mapping ids to objects with the following properties: @@ -331,7 +332,7 @@ Example response: "startTime90k": 130985461191810, "endTime90k": 130985466591817, "sampleFileBytes": 8405564, - "videoSampleEntryId": "1", + "videoSampleEntryId": 1, }, { "endTime90k": 130985461191810, diff --git a/server/src/json.rs b/server/src/json.rs index 1b2c406..f3007b4 100644 --- a/server/src/json.rs +++ b/server/src/json.rs @@ -440,7 +440,7 @@ pub struct Recording { pub end_time_90k: i64, pub sample_file_bytes: i64, pub video_samples: i64, - pub video_sample_entry_id: String, + pub video_sample_entry_id: i32, pub start_id: i32, pub open_id: u32, diff --git a/server/src/web.rs b/server/src/web.rs index ec3b4f4..673748d 100644 --- a/server/src/web.rs +++ b/server/src/web.rs @@ -712,7 +712,7 @@ impl Service { open_id: row.open_id, first_uncommitted: row.first_uncommitted, video_samples: row.video_samples, - video_sample_entry_id: row.video_sample_entry_id.to_string(), + video_sample_entry_id: row.video_sample_entry_id, growing: row.growing, }); if !out