2019-12-31, 17:54
Hi, I've got a script I'm running from Script.Embuary.Helper to work out "percentage watched" for TV show and Season views based on [watched episodes / total episodes]. Currently this fires using a hidden button embedded in the <focusedlayout> with an <onfocus> condition. It works fine for normal scrolling, but when you scroll really quickly and come to a stop, it gets quite glitchy as I think there's a slight delay and so it takes a few hundred milliseconds working out the calculation for each item you've scrolled through.
Here's a video showing what I mean: https://cl.ly/887ca78f616b
Ideally I want it only to trigger after a short period of no scrolling. Because of the delay to conduct the calculation using the script, I already have a 380ms window between a ListItem displaying and the progress bar showing. But I can't really think of an elegant way to get this script to fire afer, say 150ms of no scrolling. I'm sure it's simple, but I'm a bit end-of-year frazzled and need a pair of fresh eyes!!
Thanks!
Here is the include that I currently have in all my <focusedlayout>s:
Here's a video showing what I mean: https://cl.ly/887ca78f616b
Ideally I want it only to trigger after a short period of no scrolling. Because of the delay to conduct the calculation using the script, I already have a 380ms window between a ListItem displaying and the progress bar showing. But I can't really think of an elegant way to get this script to fire afer, say 150ms of no scrolling. I'm sure it's simple, but I'm a bit end-of-year frazzled and need a pair of fresh eyes!!
Thanks!
Here is the include that I currently have in all my <focusedlayout>s:
xml:
<include name="HiddenFocusButton">
<control type="button">
<visible allowhiddenfocus="true">false</visible>
<onfocus condition="System.HasAddon(script.embuary.helper) + [Container.Content(tvshows) | Container.Content(seasons)]">RunScript(script.embuary.helper,action=calc,do='"($INFO[ListItem.Property(WatchedEpisodes)] / $INFO[ListItem.Property(TotalEpisodes)]) * 100"',prop=MyResult)</onfocus>
</control>
</include>