Skip to content

Commit

Permalink
fix: Dont process builtin rows
Browse files Browse the repository at this point in the history
  • Loading branch information
lostb1t committed Aug 8, 2023
1 parent 7e0a9e2 commit c101337
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build:
cargo build --release

docker-build:
docker build -t ghcr.io/sarendsen/replex:test --target nginx . -f docker/Dockerfile
docker build -t ghcr.io/sarendsen/replex-nginx:test --target nginx . -f docker/Dockerfile

# docker-build:
# docker buildx build -t ghcr.io/sarendsen/replexnonginx:latest --platform linux/amd64 --target replex . -f docker/Dockerfile
Expand All @@ -14,7 +14,7 @@ docker-build:
# docker run --rm -it -p 3001:80 -e REPLEX_HOST="http://46.4.30.217:42405" ghcr.io/sarendsen/replex:test

docker-run:
docker run --rm -it -p 3001:80 -e RUST_LOG="info,replex=debug" -e REPLEX_HOST="http://46.4.30.217:42405" ghcr.io/sarendsen/replex:test
docker run --rm -it -p 3001:80 -e RUST_LOG="info,replex=info" -e REPLEX_TMDB_API_KEY=0d73e0cb91f39e670b0efa6913afbd58 -e REPLEX_HOST="http://46.4.30.217:42405" ghcr.io/sarendsen/replex-nginx:test

# push-docker:
# docker push ghcr.io/sarendsen/replex:latest
Expand Down
3 changes: 1 addition & 2 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub async fn get_hubs_promoted(req: &mut Request, res: &mut Response) {
let params: PlexParams = req.extract().await.unwrap();
let plex_client = PlexClient::from_request(req, params.clone());
let content_type = get_content_type_from_headers(req.headers_mut());

// not sure anymore why i have this lol
// let content_directory_id_size =
// params.clone().content_directory_id.unwrap().len();
Expand Down Expand Up @@ -160,7 +159,6 @@ pub async fn get_hubs_sections(req: &mut Request, res: &mut Response) {
let params: PlexParams = req.extract().await.unwrap();
let plex_client = PlexClient::from_request(req, params.clone());
let content_type = get_content_type_from_headers(req.headers_mut());

// Hack, as the list could be smaller when removing watched items. So we request more.
if let Some(original_count) = params.clone().count {
// let count_number: i32 = original_count.parse().unwrap();
Expand Down Expand Up @@ -214,6 +212,7 @@ pub async fn get_collections_children(
let collection_ids = req.param::<String>("ids").unwrap();
let collection_ids: Vec<u32> = collection_ids
.split(',')
.filter(|&v| !v.parse::<u32>().is_err())
.map(|v| v.parse().unwrap())
.collect();
let plex_client = PlexClient::from_request(req, params.clone());
Expand Down
14 changes: 10 additions & 4 deletions src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ impl TransformBuilder {

for t in self.transforms.clone() {
// dbg!(&t);

t.transform_mediacontainer(
&mut container.media_container,
self.plex_client.clone(),
Expand All @@ -242,6 +243,11 @@ impl TransformBuilder {
}

for item in container.media_container.children_mut() {
if item.is_hub() && !item.is_collection_hub() {
// We dont handle builtin hubs
continue
}

for t in self.transforms.clone() {
t.transform_metadata(
item,
Expand Down Expand Up @@ -439,16 +445,16 @@ impl Transform for HubMixTransform {
let mut new_hubs: Vec<MetaData> = vec![];
// let mut library_section_id: Vec<Option<u32>> = vec![]; //librarySectionID
for mut hub in item.children_mut() {
if !config.include_watched {
hub.children_mut().retain(|x| !x.is_watched());
}

// we only process collection hubs
if !hub.is_collection_hub() {
new_hubs.push(hub.to_owned());
continue;
}

if !config.include_watched {
hub.children_mut().retain(|x| !x.is_watched());
}

let p = new_hubs.iter().position(|v| v.title == hub.title);
if hub.r#type != "clip" {
hub.r#type = "mixed".to_string();
Expand Down

0 comments on commit c101337

Please sign in to comment.