Skip to content

Commit

Permalink
Merge pull request #667 from Stremio/feat/stream-behavior-hints-fields
Browse files Browse the repository at this point in the history
feat(stream): add filename, video_hash and video_size fields to Strea…
  • Loading branch information
tymmesyde authored Mar 26, 2024
2 parents 768821a + 68c1c4f commit 6265784
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/types/resource/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ pub struct StreamProxyHeaders {
pub response: HashMap<String, String>,
}

/// See https://github.com/Stremio/stremio-addon-sdk/blob/master/docs/api/responses/stream.md#additional-properties-to-provide-information--behaviour-flags for documentation
#[derive(Default, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct StreamBehaviorHints {
Expand All @@ -494,6 +495,12 @@ pub struct StreamBehaviorHints {
pub country_whitelist: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub proxy_headers: Option<StreamProxyHeaders>,
#[serde(skip_serializing_if = "Option::is_none")]
pub filename: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub video_hash: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<u64>,
#[serde(flatten)]
pub other: HashMap<String, serde_json::Value>,
}
Expand Down
6 changes: 6 additions & 0 deletions src/unit_tests/deep_links/stream_deep_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ fn stream_deep_links_http_with_request_headers() {
not_web_ready: false,
binge_group: None,
country_whitelist: None,
filename: None,
video_hash: None,
video_size: None,
proxy_headers: Some(StreamProxyHeaders {
request: HashMap::from([("Authorization".to_string(), "my+token".to_string())]),
response: Default::default(),
Expand Down Expand Up @@ -120,6 +123,9 @@ fn stream_deep_links_http_with_request_response_headers_and_query_params() {
not_web_ready: false,
binge_group: None,
country_whitelist: None,
filename: None,
video_hash: None,
video_size: None,
proxy_headers: Some(StreamProxyHeaders {
request: HashMap::from([("Authorization".to_string(), "my+token".to_string())]),
response: HashMap::from([(
Expand Down

0 comments on commit 6265784

Please sign in to comment.