-
Notifications
You must be signed in to change notification settings - Fork 147
Action: togglewatched
Since XBMC's python interface does not offer an event that triggers when an item's playcount changes, this adds a wrapper around XBMC's built in action ToggleWatched action.
There is only one way to use this:
RunScript(script.trakt,action=togglewatched)
This new action, will ever only work on library items, consider it an extension of the sync features of the trakt script.
Best usage for this, would be to add the following to your keyboard.xml
<keymap>
<MyVideoLibrary>
<keyboard>
<w>RunScript(script.trakt,action=togglewatched)</w>
</keyboard>
</MyVideoLibrary>
</keymap>
This will override XBMC's default action for W causing a ToggleWatched in the video library.
This works on all levels of the video library, movie, show, seasons, and episodes.
When an item or items are successfully marked as watched, a notification will popup indicating this, this can be toggled on/off via a setting.
Since this is an extension of the sync features, it also uses the simulate setting, so if this is enabled, it will do everything but actually update trakt.tv. It will still do XBMC's built in ToggleWatched tho.
Note: this addition only works on library items, it won't be updated to support non-library items due to the amount of data that could potentially need to be passed along, and also, since it essentially wraps around XBMC's built in ToggleWatched action.
I've also added a fix for the BadStatusLine exception that started occuring a few days ago, I might split this out and open a PR of its own for it, have not decided yet.
- For movies and episodes, it gets the item's playcount and other relevant data.
- For seasons, it will get the playcounts of all the items in the selected season, and add episodes to a list if there playcount is 0.
- For shows, you guessed it, it will get data for all the episodes, and add those episodes whose playcount is 0 to a list.
- If nothing is going has a playcount of 0, it skips dispatching to the service thread. Otherwise, it dispatches a new action to the scripts service thread with the data gathered above.
- It will now execute ToggleWatched on the item, so XBMC does its normal thing here.
- The service thread will take the data it got, and lookup information on trakt and filter out any items that are already watched, and finally, mark those that aren't as watched.