Skip to content

Commit ecbe022

Browse files
committed
fix: web hero art
1 parent 4ed60cb commit ecbe022

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
#![allow(warnings)]
13
#[macro_use]
24
extern crate yaserde;
35
extern crate yaserde_derive;

src/models.rs

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub enum Platform {
7474
Safari,
7575
Chrome,
7676
Roku,
77+
Web,
7778
#[serde(other)]
7879
#[strum(serialize = "Generic")]
7980
Generic,

src/transform/hub_style.rs

+21-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub struct HubStyleTransform {
1919

2020
pub struct ClientHeroStyle {
2121
pub enabled: bool,
22+
pub include_meta: bool,
2223
pub r#type: String,
2324
pub style: Option<String>,
2425
pub child_type: Option<String>,
@@ -30,6 +31,7 @@ impl Default for ClientHeroStyle {
3031
fn default() -> Self {
3132
Self {
3233
enabled: true,
34+
include_meta: true,
3335
style: Some("hero".to_string()),
3436
r#type: "mixed".to_string(),
3537
child_type: None,
@@ -58,7 +60,7 @@ impl ClientHeroStyle {
5860
pub fn from_context(context: PlexContext) -> Self {
5961
// pub fn android(product: String, platform_version: String) -> Self {
6062
let product = context.product.clone().unwrap_or_default();
61-
let device_type = DeviceType::from_product(product);
63+
let device_type = DeviceType::from_product(product.clone());
6264
let platform = context.platform.clone().unwrap_or_default();
6365
let platform_version =
6466
context.platform_version.clone().unwrap_or_default();
@@ -92,7 +94,11 @@ impl ClientHeroStyle {
9294
Platform::Ios => ClientHeroStyle::ios_style(),
9395
Platform::TvOS => ClientHeroStyle::tvos_style(),
9496
_ => {
95-
ClientHeroStyle::default()
97+
if product.clone().to_lowercase() == "plex web" {
98+
ClientHeroStyle::web()
99+
} else {
100+
ClientHeroStyle::default()
101+
}
96102
}
97103
// _ => {
98104
// if product.starts_with("Plex HTPC") {
@@ -118,6 +124,15 @@ impl ClientHeroStyle {
118124
}
119125
}
120126

127+
pub fn web() -> Self {
128+
Self {
129+
include_meta: false,
130+
cover_art_as_art: true,
131+
cover_art_as_thumb: true,
132+
..ClientHeroStyle::default()
133+
}
134+
}
135+
121136
pub fn htpc_style() -> Self {
122137
Self {
123138
..ClientHeroStyle::default()
@@ -184,7 +199,10 @@ impl Transform for HubStyleTransform {
184199
item.style = style.style;
185200

186201
item.r#type = style.r#type;
187-
item.meta = Some(hero_meta());
202+
203+
if style.include_meta {
204+
item.meta = Some(hero_meta());
205+
}
188206

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

0 commit comments

Comments
 (0)