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)



- ronie - 2011-11-27

Hitcher Wrote:Neither way is foolproof though.

i'll check if there's any way to handle this script side.


- pecinko - 2011-11-27

ronie Wrote:not especially specials, but i did find a bug that caused some episodes not to be added to the watchlist.

also fixed the crash when user doesn't have a music db.

script.watchlist-0.1.5.zip

Any ETA for repo availability?


- Hitcher - 2011-11-27

Machine-Sanctum Wrote:Could it be when unloading VideoFullScreen.xml ?
That's what I originally intended doing -

Hitcher Wrote:I want to run the watchedlist script whenever a video is stopped so I added <onunload>RunScript(script.watchlist)</onunload> to the VideoFullScreen.xml thinking that would do the trick but the script fails to run.

This can easily be tested by adding <onunload>ReplaceWindow(Home)</onunload> instead and you'll see when stopping a video you wont be returned to the home screen. Changing it to <onload> however does work.

Bug or am I missing something?

Thanks.

pieh Wrote:You are right, just confirmed that's a bug and onunload actions in VideoFullScreen aren't executed

---
edit: just random thought - running this when unloading VideoFullScreen won't be sufficent, it will execute when we toggle fullscreen (not stoppingvideo) and also when not in fullscreen, stopping video won't run script. Better approach would be to create service addon that will listen to xbmc.Player events (i.e. onPlaybackStopped) and will run proper script(s) then.

---
yet another edit: fixed in fb2e7d1e

Hitcher Wrote:You're right I didn't think of those conditions. Rolleyes

I just wanted to avoid having to run the script every time you enter home.

I guess "Better approach would be to create service addon that will listen to xbmc.Player events (i.e. onPlaybackStopped) and will run proper script(s) then." is what we're after?

ronie Wrote:i'll check if there's any way to handle this script side.

Thanks.


- Martijn - 2011-11-27

Hitcher Wrote:That's what I originally intended doing -

I guess "Better approach would be to create service addon that will listen to xbmc.Player events (i.e. onPlaybackStopped) and will run proper script(s) then." is what we're after?

Thanks.

Ah yes now i remember you said that.

I was talking to ronie such an option however i just thought of something.
PlayBackStopped and PlayBackEnded will work fine on a local database however when you are using a central SQL database the other clients won't update the script because they didn't have a PlayBack trigger.
Maybe have the PlayBack trigger in combination with a run every xx minutes combination.


- Hitcher - 2011-11-27

Neither would my other idea running it on unload of VideoFullScreen, VideoOverlay, MusicVisualisation and MusicOverlay I guess.

I have no idea what service addons are but can they be used to check the databases?


- ronie - 2011-11-27

Hitcher Wrote:I have no idea what service addons are but can they be used to check the databases?

service addons are automatically started at xbmc startup, without the need for skins to execute them.

apart from that, there's no difference afaik.


- Martijn - 2011-11-27

Hitcher Wrote:Neither would my other idea running it on unload of VideoFullScreen, VideoOverlay, MusicVisualisation and MusicOverlay I guess.

I have no idea what service addons are but can they be used to check the databases?

it can easiliy be done with a service add-on. You can integrate it into the watchlist itself by addon this line to addon.xml:
Code:
<extension point="xbmc.service" library="service.py" start="startup|login"/>

and create service.py (or something):
Code:
# starts update/sync
def autostart():
        xbmc.executebuiltin('XBMC.AlarmClock(Watchlist,XBMC.RunScript(script.watchlist),00:00:10,silent)')
        xbmc.executebuiltin('XBMC.AlarmClock(WatchlistService,XBMC.RunScript(script.watchlist),%s:00:00,silent,loop)'%settings.service_time)
autostart()
I use the same for Artwork downloader. So it is run at startup/login and every xx:xx:xx

By doing this the skins are still able to execute the script when they need to.


- pecinko - 2011-11-30

pecinko Wrote:Any ETA for repo availability?

Last version is working fine here and has a nice log, too. It would be good to have it in the repo as it takes care of some bugs.


- pecinko - 2011-11-30

I stand corrected - there seams to be the problem with profiles. Not sure if it is script or XBMC problem.

I have made 2 profiles with separate DBs. Watchlist, however, is showing master user's movie items in kid's profile.


- ronie - 2011-11-30

pecinko Wrote:I stand corrected - there seams to be the problem with profiles. Not sure if it is script or XBMC problem.

I have made 2 profiles with separate DBs. Watchlist, however, is showing master user's movie items in kid's profile.

can't reproduce i'm afraid.

either way, i seriously doubt the script could be at fault here.


- ronie - 2011-12-04

Hitcher Wrote:I guess "Better approach would be to create service addon that will listen to xbmc.Player events (i.e. onPlaybackStopped) and will run proper script(s) then." is what we're after?

if there is still interested in it:
script.watchlist-0.1.6.zip

the script will keep running in the background and listen for PlaybackEnded/Stopped notifications from xbmc.

this means you only have to run the scripts once (and no more than once!)


let me know if you prefer to have it this way or keep things as they were.


- Hitcher - 2011-12-04

Wow this is prefect ronie, huge thanks.

EDIT: And for the record this has made my TV show viewing so much easier and quicker it's unbelievable.


- BigNoid - 2011-12-04

ronie Wrote:if there is still interested in it:
script.watchlist-0.1.6.zip

the script will keep running in the background and listen for PlaybackEnded/Stopped notifications from xbmc.

this means you only have to run the scripts once (and no more than once!)


let me know if you prefer to have it this way or keep things as they were.
I prefer it this way. Can you add a property to the home window we can check if the script is running?


- Hitcher - 2011-12-04

Good idea, then if someone switches skin (as opposed to starting XBMC) we can make sure it's up and running.


- ronie - 2011-12-04

Big_Noid Wrote:I prefer it this way. Can you add a property to the home window we can check if the script is running?

Hitcher Wrote:Good idea, then if someone switches skin (as opposed to starting XBMC) we can make sure it's up and running.

i'll add the property and make sure the script checks for it,
so skinners don't have to worry about it.


hmm... on the other hand, one skin may run it with a limit=5 option,
but the next skin needs limit=10

but.... maybe i can make the skin re-run on skin change,
by checking the Skin.CurrentTheme infolabel