Skip to content

Commit a4cdb2c

Browse files
authored
Plex showtime: Added show only artwork option (#3024)
1 parent cbf9007 commit a4cdb2c

File tree

1 file changed

+45
-10
lines changed

1 file changed

+45
-10
lines changed

apps/plexshowtime/plex_showtime.star

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def main(config):
2525
plex_server_url = config.str("plex_server_url", "")
2626
plex_token = config.str("plex_token", "")
2727
show_heading = config.bool("show_heading", True)
28+
show_only_artwork = config.bool("show_only_artwork", False)
2829
heading_color = config.str("heading_color", "#FFA500")
2930
font_color = config.str("font_color", "#FFFFFF")
3031
show_summary = config.bool("show_summary", False)
@@ -38,6 +39,10 @@ def main(config):
3839
fit_screen = config.bool("fit_screen", True)
3940
debug_output = config.bool("debug_output", False)
4041

42+
if show_only_artwork:
43+
show_heading = False
44+
show_summary = False
45+
4146
ttl_seconds = 5
4247

4348
plex_endpoints = []
@@ -74,13 +79,14 @@ def main(config):
7479
print("CONFIG - filter_tv: " + str(filter_tv))
7580
print("CONFIG - filter_music: " + str(filter_music))
7681
print("CONFIG - show_heading: " + str(show_heading))
82+
print("CONFIG - show_only_artwork: " + str(show_only_artwork))
7783
print("CONFIG - heading_color: " + heading_color)
7884
print("CONFIG - font_color: " + font_color)
7985
print("CONFIG - fit_screen: " + str(fit_screen))
8086

81-
return get_text(plex_server_url, plex_token, endpoint_map, debug_output, fit_screen, filter_movie, filter_tv, filter_music, show_heading, show_summary, heading_color, font_color, ttl_seconds)
87+
return get_text(plex_server_url, plex_token, endpoint_map, debug_output, fit_screen, filter_movie, filter_tv, filter_music, show_heading, show_only_artwork, show_summary, heading_color, font_color, ttl_seconds)
8288

83-
def get_text(plex_server_url, plex_token, endpoint_map, debug_output, fit_screen, filter_movie, filter_tv, filter_music, show_heading, show_summary, heading_color, font_color, ttl_seconds):
89+
def get_text(plex_server_url, plex_token, endpoint_map, debug_output, fit_screen, filter_movie, filter_tv, filter_music, show_heading, show_only_artwork, show_summary, heading_color, font_color, ttl_seconds):
8490
base_url = plex_server_url
8591
if base_url.endswith("/"):
8692
base_url = base_url[0:len(base_url) - 1]
@@ -422,12 +428,22 @@ def get_text(plex_server_url, plex_token, endpoint_map, debug_output, fit_screen
422428
# img = base64.decode(PLEX_BANNER_PORTRAIT)
423429
# using_portrait_banner = True
424430

425-
if show_summary:
431+
if show_summary and show_only_artwork == False:
426432
rendered_image = render.Image(
427433
width = 22,
428434
src = img,
429435
)
430-
elif fit_screen:
436+
elif fit_screen and show_only_artwork == False:
437+
rendered_image = render.Image(
438+
width = 64,
439+
src = img,
440+
)
441+
elif fit_screen and show_only_artwork == True:
442+
rendered_image = render.Image(
443+
height = 32,
444+
src = img,
445+
)
446+
elif fit_screen == False and show_only_artwork == True:
431447
rendered_image = render.Image(
432448
width = 64,
433449
src = img,
@@ -438,7 +454,7 @@ def get_text(plex_server_url, plex_token, endpoint_map, debug_output, fit_screen
438454
src = img,
439455
)
440456

441-
return render_marquee(marquee_text_array, rendered_image, show_summary, debug_output, using_portrait_banner)
457+
return render_marquee(show_only_artwork, marquee_text_array, rendered_image, show_summary, debug_output, using_portrait_banner)
442458

443459
else:
444460
display_message_string = "No valid results for " + endpoint_map["title"]
@@ -575,9 +591,9 @@ def display_message(debug_output, message_array = [], show_summary = False):
575591
width = 64,
576592
src = img,
577593
)
578-
return render_marquee(message_array, rendered_image, show_summary, debug_output)
594+
return render_marquee(False, message_array, rendered_image, show_summary, debug_output)
579595

580-
def render_marquee(message_array, image, show_summary, debug_output, using_portrait_banner = False):
596+
def render_marquee(show_only_artwork, message_array, image, show_summary, debug_output, using_portrait_banner = False):
581597
icon_img = base64.decode(PLEX_ICON)
582598

583599
text_array = []
@@ -636,7 +652,7 @@ def render_marquee(message_array, image, show_summary, debug_output, using_portr
636652
if show_summary == False and debug_output:
637653
print("Marquee text: " + full_message)
638654

639-
if show_summary:
655+
if show_summary and show_only_artwork == False:
640656
marquee_height = 32 + ((heading_lines + title_lines + body_lines) - ((heading_lines + title_lines + body_lines) * 0.62))
641657

642658
children = [
@@ -687,6 +703,18 @@ def render_marquee(message_array, image, show_summary, debug_output, using_portr
687703
),
688704
),
689705
)
706+
elif show_only_artwork == True:
707+
return render.Root(
708+
show_full_animation = True,
709+
child = render.Row(
710+
expanded = True,
711+
main_align = "space_evenly",
712+
cross_align = "center",
713+
children = [
714+
image,
715+
],
716+
),
717+
)
690718
else:
691719
marquee_width = 57 + ((len(full_message)) - ((len(full_message)) * 0.9))
692720

@@ -844,14 +872,14 @@ def get_schema():
844872
schema.Text(
845873
id = "plex_server_url",
846874
name = "Plex server URL (required)",
847-
desc = "Plex server URL.",
875+
desc = "Your Plex server URL.",
848876
icon = "globe",
849877
default = "",
850878
),
851879
schema.Text(
852880
id = "plex_token",
853881
name = "Plex token (required)",
854-
desc = "Plex token.",
882+
desc = "Your Plex token.",
855883
icon = "key",
856884
default = "",
857885
),
@@ -883,6 +911,13 @@ def get_schema():
883911
icon = "alignLeft",
884912
default = False,
885913
),
914+
schema.Toggle(
915+
id = "show_only_artwork",
916+
name = "Show Only Artwork",
917+
desc = "Display only the artwork. Overrides 'Show summary' and 'Show heading' configurations.",
918+
icon = "eye",
919+
default = False,
920+
),
886921
schema.Toggle(
887922
id = "fit_screen",
888923
name = "Fit screen",

0 commit comments

Comments
 (0)