Skip to content

Commit

Permalink
fix: remove tmdb checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lostb1t committed Aug 10, 2023
1 parent e8e5893 commit 40af9b1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ docker-run:


run:
REPLEX_REDIRECT_STREAMS=1 REPLEX_DISABLE_LEAF_COUNT=0 REPLEX_DISABLE_USER_STATE=1 REPLEX_TMDB_API_KEY=0d73e0cb91f39e670b0efa6913afbd58 REPLEX_ENABLE_CONSOLE=0 REPLEX_CACHE_TTL=0 REPLEX_HOST=https://46-4-30-217.01b0839de64b49138531cab1bf32f7c2.plex.direct:42405 RUST_LOG="info,replex=info" cargo watch -x run
REPLEX_DISABLE_LEAF_COUNT=0 REPLEX_DISABLE_USER_STATE=1 REPLEX_ENABLE_CONSOLE=0 REPLEX_CACHE_TTL=0 REPLEX_HOST=https://46-4-30-217.01b0839de64b49138531cab1bf32f7c2.plex.direct:42405 RUST_LOG="info,replex=info" cargo watch -x run

# run:
# REPLEX_ENABLE_CONSOLE=0 REPLEX_CACHE_TTL=0 REPLEX_HOST=https://46-4-30-217.01b0839de64b49138531cab1bf32f7c2.plex.direct:42405 RUST_LOG="info" cargo run
Expand Down
63 changes: 30 additions & 33 deletions src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,40 +629,37 @@ impl Transform for TMDBArtTransform {
options: PlexParams,
) {
let config: Config = Config::figment().extract().unwrap();

if config.tmdb_api_key.is_some() {
let style = item.style.clone().unwrap_or("".to_string()).to_owned();
if item.is_hub() && ["clip", "hero"].contains(&style.as_str()) {
// let mut children: Vec<MetaData> = vec![];

let mut futures = FuturesOrdered::new();
// let now = Instant::now();

for child in item.children() {
// let style = item.style.clone().unwrap();
let client = plex_client.clone();
futures.push_back(async move {
let mut c = child.clone();

let art = child.get_hero_art(client).await;
if art.is_some() {
c.art = art.clone();
}
// big screen uses thumbs for artwork.... while mobile uses the artwork. yeah...
c.thumb = c.art.clone();
c
});
}
// let elapsed = now.elapsed();
// println!("Elapsed: {:.2?}", elapsed);
// let now = Instant::now();

let children: Vec<MetaData> = futures.collect().await;
item.set_children(children);
} else {
// keep this blocking for now. AS its loaded in the background
self.transform(item, plex_client.clone()).await;
let style = item.style.clone().unwrap_or("".to_string()).to_owned();
if item.is_hub() && ["clip", "hero"].contains(&style.as_str()) {
// let mut children: Vec<MetaData> = vec![];

let mut futures = FuturesOrdered::new();
// let now = Instant::now();

for child in item.children() {
// let style = item.style.clone().unwrap();
let client = plex_client.clone();
futures.push_back(async move {
let mut c = child.clone();

let art = child.get_hero_art(client).await;
if art.is_some() {
c.art = art.clone();
}
// big screen uses thumbs for artwork.... while mobile uses the artwork. yeah...
c.thumb = c.art.clone();
c
});
}
// let elapsed = now.elapsed();
// println!("Elapsed: {:.2?}", elapsed);
// let now = Instant::now();

let children: Vec<MetaData> = futures.collect().await;
item.set_children(children);
} else {
// keep this blocking for now. AS its loaded in the background
self.transform(item, plex_client.clone()).await;
}
}
}
Expand Down

0 comments on commit 40af9b1

Please sign in to comment.