Kodi Community Forum
[RELEASE] Watchlist script (was 'Adding Plex's 'On Deck' feature to XBMC') - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+---- Forum: Skin helper addons (https://forum.kodi.tv/forumdisplay.php?fid=300)
+---- Thread: [RELEASE] Watchlist script (was 'Adding Plex's 'On Deck' feature to XBMC') (/showthread.php?tid=113702)



- GJones - 2012-01-26

I have been using the script as implemented in xperience1080. I love the script but am having some performance issues. I have approximately 11k episodes and 2k movies. Running the script takes about 2.5 minutes each time.

I am wondering if it would be better to have a time parameter to better manage how frequently the script is run. Then the skin could use that as a configurable parameter for the script. If the timestamp was written at the end of the script run, the length of run would become irrelevant to the process because the setting to not run it if it had completed within the last X minutes would still apply.

For those of us with larger libraries, the performance impact is somewhat severe. The script pulls a JSON query for each of the roughly 200 TV shows on my system. If I watch a 3 minute video, watchlist runs upon its completion. This means that I have to wait roughly 2.5 minutes between each video. If you let the user configure the parameter, they take the responsibility of determining how often is too often and how fresh they need the data to be.


- ronie - 2012-01-26

GJones Wrote:I love the script but am having some performance issues.

GJones Wrote:For those of us with larger libraries, the performance impact is somewhat severe.

out of interest, what happens when the script runs on your end?
does the gui freeze? do videos start to stutter?

imo, scripts running in the background shouldn't interfere with the user experience...but i'm not sure if that would be feasible.


- GJones - 2012-01-26

ronie Wrote:out of interest, what happens when the script runs on your end?
does the gui freeze? do videos start to stutter?

imo, scripts running in the background shouldn't interfere with the user experience...but i'm not sure if that would be feasible.

The impact is on any new script starting, playlist populating or video starting. Watchlist performs a separate JSON call for each TV show in your library. In my case that is several hundred calls back to back. A lot of the other things I do with XBMC also require JSON or direct database calls.

No significant delay is present if I just play a video directly from the library. If, however, I use a script, the delay is considerable. I use PseudoTV heavily and see the impact very much there. Here is an example:

I watch a video from the library. It finishing triggers the watchlist script. The script takes about 2.5 minutes to run. If I try to use pseudotv before the watchlist script completes its JSON calls, the contention is considerable and adds as much as 30 seconds to the start of pseudotv.

The biggest impact of a background script is any foreground script. I also notice a delay in any database update (playcount and lastplayed).

And yes, I removed the influence of delay by drives spinning up, etc.


- Hitcher - 2012-01-26

Sounds like we need three options for the user to select -

1. Run after playback
2. Run at timed intervals
3. Run at startup

Should they be handled through skin settings or addon settings though?


- GJones - 2012-01-26

Hitcher Wrote:Sounds like we need three options for the user to select -

1. Run after playback
2. Run at timed intervals
3. Run at startup

Should they be handled through skin settings or addon settings though?

I am actually not arguing against the current "run after playback" model. But for some libraries, running more than once within a short period can be somewhat expensive in resources.

Playback tends to change the values, so it's a good trigger. But if you have short videos or resume near the end of videos you can run the script very frequently.


- smush420 - 2012-01-26

I really think the script should run after updating the library.

For shows that are currently on air, this feature would be great. For instance I'm currently watching Californication but have seen all the episodes. Once sunday rolls around and a new episode airs, the only way to get it to show up in the watchlist is to quit XBMC or play something else.


- Hitcher - 2012-01-26

We could add it back to video and music update dialogs <onunload> controls but if they're hidden by the user this wont help.


- BigNoid - 2012-01-26

This script has all the characteristics of a service addon. Why not make the suggested features, run after library update and time interval, available in the addon settings and make the addon appear under service addons?
I don't think the skinner should decide these things for the user.


- `Black - 2012-01-26

I'm working on an optimization for updating the list after you've watched something. If it works, updating should take a couple of seconds tops.


- GJones - 2012-01-26

`Black Wrote:I'm working on an optimization for updating the list after you've watched something. If it works, updating should take a couple of seconds tops.

I am working to try to find a way to limit the returns for large libraries, up to my ears in python code.


- `Black - 2012-01-29

So after some time of thinking and testing here's a test version of the new update:

script.watchlist-0.1.9.zip

Please test it for episodes as that's the part I've worked on (I will update it for movies & albums as well). The initial loading time isn't improved but when you've watched something, the update process should be way faster than before because there's no database query at all now.

Edit: Updating for movies now the same as for episodes (no db query anymore). For albums I left it as it is because it seems to be fast enough for me but If anyone has complains I could look into that, too.


- Hitcher - 2012-01-29

Looks good to me - loads almost instantaneously on the home screen.


- `Black - 2012-01-29

Sounds good, thanks. I'll remove the 1s delay in the final version so it will load even faster.

What I'd like you to test is if you manually stop an episode after 90% are played... the episode should be marked as watched by XBMC and the episode should be removed from the watch list and replaced with a newer (unwatched) episode if any. I had to make a little workaround for that case and there could be a problem with it in some (unknown) edge cases but it worked quite well in my tests.


- Hitcher - 2012-01-29

Yep, good there too.


- `Black - 2012-01-29

Thanks... I updated the link, updating movies is now also without a db query.