Skip to content

Commit 74092c5

Browse files
committed
feat: Allow disabling episode count
1 parent 20e2fa0 commit 74092c5

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ docker-run:
2929

3030

3131
run:
32-
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
32+
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
3333

3434
# run:
3535
# REPLEX_ENABLE_CONSOLE=0 REPLEX_CACHE_TTL=0 REPLEX_HOST=https://46-4-30-217.01b0839de64b49138531cab1bf32f7c2.plex.direct:42405 RUST_LOG="info" cargo run

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Remix your plex recommendations.
1010
- Remove watched items from recommendations.
1111
- Choose between styles, shelf (default) or hero.
1212
- Auto load tmdb artwork for hero styles.
13-
- Disable user state: unwatched and episode count banners are removed from the artwork.
13+
- Disable user state: remove unwatched labels from artwork.
14+
- Disable leaf count: remove episode count from artwork.
1415
- Works on every client/app not only plex web!
1516
- Plays nice with PMM (and without).
1617

@@ -72,7 +73,8 @@ Settings are set via [environment variables](https://kinsta.com/knowledgebase/wh
7273
| REPLEX_HOST | | Plex target host to proxy |
7374
| REPLEX_INCLUDE_WATCHED | false | If set to false, hide watched items. |
7475
| REPLEX_CACHE_TTL | 300 | Time to live for caches in seconds. Set to 0 to disable |
75-
| REPLEX_DISABLE_USER_STATE| false | Disable user state, unwatched and episode count banners are removed from the artwork |
76+
| REPLEX_DISABLE_USER_STATE| false | Unwatched and episode count banners will be removec from artwork. *does currently not work on IOS/AppleTV |
77+
| REPLEX_DISABLE_LEAF_COUNT| false | remove episode count label from show artwork |
7678
| REPLEX_TMDB_API_KEY | | Enables tmdb artwork for hero hubs instead of plex background artwork |
7779
| REPLEX_SSL_ENABLE | false | Enable automatic SSL generation. http will be disabled |
7880
| | | (stored in /data/acme/letsencrypt so make sure to mount a volume) |

src/config.rs

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ pub struct Config {
3535
deserialize_with = "figment::util::bool_from_str_or_int"
3636
)]
3737
pub disable_user_state: bool,
38+
#[serde(
39+
default = "default_as_false",
40+
deserialize_with = "figment::util::bool_from_str_or_int"
41+
)]
42+
pub disable_leaf_count: bool,
3843
}
3944

4045
fn default_cache_ttl() -> u64 {

src/main.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ async fn main() {
7272
// dbg!("we are being runned");
7373
// }
7474
// });
75-
let version =
76-
env::var("CARGO_PKG_VERSION").unwrap_or("unknown".to_string());
75+
let version = env!("CARGO_PKG_VERSION");
7776
tracing::info!("Replex version {}", version);
7877

7978
let router = route();

src/transform.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -691,15 +691,25 @@ impl Transform for UserStateTransform {
691691
options: PlexParams,
692692
) {
693693
let config: Config = Config::figment().extract().unwrap();
694-
if !config.disable_user_state {
694+
if !config.disable_user_state && !config.disable_leaf_count {
695695
return
696696
}
697697
if item.is_hub() {
698698
for child in item.children_mut() {
699-
child.user_state = Some(false);
699+
if config.disable_user_state {
700+
child.user_state = Some(false);
701+
}
702+
if config.disable_leaf_count {
703+
child.leaf_count = None;
704+
}
700705
}
701706
} else {
702-
item.user_state = Some(false);
707+
if config.disable_user_state {
708+
item.user_state = Some(false);
709+
}
710+
if config.disable_leaf_count {
711+
item.leaf_count = None;
712+
}
703713
}
704714
}
705715
}

0 commit comments

Comments
 (0)