Skip to content

Commit

Permalink
Merge branch 'development' into feat/stream-rar-and-zip-stream-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
elpiel committed Apr 3, 2024
2 parents e54f623 + 6265784 commit 6f7200c
Show file tree
Hide file tree
Showing 27 changed files with 439 additions and 271 deletions.
48 changes: 48 additions & 0 deletions src/deep_links/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,54 @@ impl From<(&Video, &ResourceRequest, &Option<Url>, &Settings)> for VideoDeepLink
}
}

impl
From<(
&Video,
&ResourceRequest,
&ResourceRequest,
&Option<Url>,
&Settings,
)> for VideoDeepLinks
{
fn from(
(video, stream_request, meta_request, streaming_server_url, settings): (
&Video,
&ResourceRequest,
&ResourceRequest,
&Option<Url>,
&Settings,
),
) -> Self {
let stream = video.stream();
VideoDeepLinks {
meta_details_streams: format!(
"stremio:///detail/{}/{}/{}",
utf8_percent_encode(&meta_request.path.r#type, URI_COMPONENT_ENCODE_SET),
utf8_percent_encode(&meta_request.path.id, URI_COMPONENT_ENCODE_SET),
utf8_percent_encode(&video.id, URI_COMPONENT_ENCODE_SET)
),
player: stream
.as_ref()
.map(|stream| {
Ok::<_, anyhow::Error>(format!(
"stremio:///player/{}/{}/{}/{}/{}/{}",
utf8_percent_encode(&stream.encode()?, URI_COMPONENT_ENCODE_SET),
utf8_percent_encode(stream_request.base.as_str(), URI_COMPONENT_ENCODE_SET),
utf8_percent_encode(meta_request.base.as_str(), URI_COMPONENT_ENCODE_SET),
utf8_percent_encode(&meta_request.path.r#type, URI_COMPONENT_ENCODE_SET),
utf8_percent_encode(&meta_request.path.id, URI_COMPONENT_ENCODE_SET),
utf8_percent_encode(&video.id, URI_COMPONENT_ENCODE_SET)
))
})
.transpose()
.unwrap_or_else(|error| Some(ErrorLink::from(error).into())),
external_player: stream.as_ref().map(|stream| {
ExternalPlayerLink::from((stream.as_ref(), streaming_server_url, settings))
}),
}
}
}

#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StreamDeepLinks {
Expand Down
2 changes: 2 additions & 0 deletions src/models/library_with_filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pub enum Sort {
#[derivative(Default)]
LastWatched,
Name,
NameReverse,
TimesWatched,
Watched,
NotWatched,
Expand Down Expand Up @@ -86,6 +87,7 @@ impl Sort {
// same as `ctime`
.then(a.ctime.cmp(&b.ctime)),
Sort::Name => a.name.to_lowercase().cmp(&b.name.to_lowercase()),
Sort::NameReverse => b.name.to_lowercase().cmp(&a.name.to_lowercase()),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/local_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ mod test {

assert_eq!(2, searchable_results.len());

let redirected_id = searchable_results.get(0).unwrap();
let redirected_id = searchable_results.first().unwrap();

assert!(redirected_id.name.is_empty());
assert!(redirected_id.poster.is_none());
Expand Down
Loading

0 comments on commit 6f7200c

Please sign in to comment.