xbmc/xbmc — pull request #4482 by alexmaloteaux (2014-03-28 19:19:22+00:00)
Title: Add an element onitemchanged to the 4 types of container

This pr add an element onitemchanged to the 4 containers that can trigger an action each time a new item is selected, similar to onload for window.

Actually several add-ons do it in a hackish way; for instance next-aired and others launch a background process that start a thread that continuously check for the active window with a sleep between checks .... Some other add-ons launch a prescan then use ListItem.DBID with a value store in an extra add-on cache in addon_data....

WIth this, it is possible to launch a script each time the item changes.

For instance i use it like this to display an extras flag in my custom script in movie mode :

XBMC.RunScript(script.videoextras,check,"$INFO[ListItem.FilenameAndPath]")

!!!TODO!!! :

The itemchanged is triggered each time cursor or offset is changed; so in some situation, cursor and offset are changed one after the other. this will trigger 2 times the actions for one change.

While this do not disturb me personaly so far, this can be fixed pretty easily i just want to have some review from the big devs guru before spending more time on this.