Skip to content

Commit

Permalink
fix: #137
Browse files Browse the repository at this point in the history
  • Loading branch information
lostb1t committed Jul 15, 2024
1 parent 87f6bb7 commit 48f95b3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ run:
REPLEX_ENABLE_CONSOLE=0 \
REPLEX_CACHE_TTL=0 \
REPLEX_HUB_RESTRICTIONS=1 \
RUST_LOG="info,replex=debug,replex::transform=debug" \
RUST_LOG="info,replex=info,replex::transform=debug" \
REPLEX_NTF_WATCHLIST_FORCE=0 \
RUSTFLAGS=-Awarnings \
cargo watch -w src -x run
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Settings are set via [environment variables](https://kinsta.com/knowledgebase/wh
| REPLEX_DISABLE_CONTINUE_WATCHING | false | Disable/remove the continue watching row |
| REPLEX_DISABLE_USER_STATE | true | Remove watched badges from hub items. * does not work on all clients |
| REPLEX_DISABLE_LEAF_COUNT| false | Remove episode count label from show artwork. |
| REPLEX_HERO_ROWS | | Comma seperated list of hubidentifiers to make builtin hubs hero style. For custom collections see [Hhb style](#-hub-style). Options are: <br />home.movies.recent<br />movies.recent <br />movie.recentlyadded<br />movie.topunwatched<br />movie.recentlyviewed<br />hub.movie.recentlyreleased<br />movie.recentlyreleased<br />home.television.recent<br />tv.recentlyadded<br />tv.toprated<br />tv.inprogress<br />tv.recentlyaired |
| REPLEX_HERO_ROWS | | Comma seperated list of hubidentifiers to make builtin hubs hero style. For custom collections see [Hhb style](#-hub-style). Options are: <br />home.movies.recent<br />movies.recent <br />movie.recentlyadded<br />movie.topunwatched<br />movie.recentlyviewed<br />hub.movie.recentlyreleased<br />movie.recentlyreleased<br />home.television.recent<br />tv.recentlyadded<br />tv.toprated<br />tv.inprogress<br />tv.recentlyaired |
| REPLEX_FORCE_MAXIMUM_QUALITY | false | This will force clients to use the maximum quality. Meaning that if a client requests anything other then the maximum quality this will be ignored and the maximum quality (direct play/stream when server allows for original) is used instead. This doesn't prevent transcoding. It only sets the bitrate to original quality. So if a client needs a different codec, container or audio it should still transcode.
| REPLEX_FORCE_DIRECT_PLAY_FOR | false | Force direct play for the given resolutions. Options are "4k", "1080" and "720". This wil result in an error message if the client does not support directplay. Not recommended
| REPLEX_VIDEO_TRANSCODE_FALLBACK_FOR | | If the selected media triggers a video transcode. Fallback to another version of the media. Only triggers on video transcoding. Remuxing is still allowed. <br />Options are "4k" and "1080". <br /> <br /> Example if REPLEX_VIDEO_TRANSCODE_FALLBACK_FOR is set to "4k" then 4k transcodes will fallback to another version if avaiable |
Expand Down
12 changes: 10 additions & 2 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@ pub async fn get_hubs_sections(
count = 50;
}

add_query_param_salvo(req, "count".to_string(), count.to_string());

// we want guids for banners
add_query_param_salvo(req, "includeGuids".to_string(), "1".to_string());
Expand Down Expand Up @@ -799,7 +798,14 @@ pub async fn default_transform(
let mut url = Url::parse(req.uri_mut().to_string().as_str()).unwrap();
url.set_path(&rest_path);
req.set_uri(hyper::Uri::try_from(url.as_str()).unwrap());



// patch, plex seems to pass wrong contentdirid, probaply cause we all load it inti the first
let mut queries = req.queries().clone();
queries.remove("contentDirectoryID");
replace_query(queries, req);

//dbg!(&req);
let upstream_res = plex_client.request(req).await?;
match upstream_res.status() {
reqwest::StatusCode::OK => (),
Expand All @@ -817,9 +823,11 @@ pub async fn default_transform(
// container.media_container.meta

TransformBuilder::new(plex_client, params.clone())
.with_filter(HubRestrictionsFilter)
.with_transform(MediaStyleTransform { style: style })
.with_transform(UserStateTransform)
.with_transform(HubWatchedTransform)
.with_transform(HubKeyTransform)
.apply_to(&mut container)
.await;

Expand Down
4 changes: 2 additions & 2 deletions src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ impl Transform for HubInterleaveTransform {
) -> MediaContainer {
let config: Config = Config::figment().extract().unwrap();
let mut new_hubs: Vec<MetaData> = vec![];

if !config.interleave {
return item;
}
Expand Down Expand Up @@ -965,7 +965,7 @@ impl Transform for HubKeyTransform {
plex_client: PlexClient,
options: PlexContext,
) {

if item.is_hub()
&& item.key.is_some()
&& !item.key.clone().unwrap().starts_with("/replex")
Expand Down

0 comments on commit 48f95b3

Please sign in to comment.