I wanted to make the experience seamless with the skin as a whole, so the code to launch the script is coded directly into the skin (rather than launching through the addons menu).
I therefore thought I'd share the code with other skin developers so that they could include with their skins if they wanted to.
Script id: script.randommovie
Compatibility: Dharma (see below)
Download (Dharma): https://github.com/elParaguayo/xbmc-rand...all/master
Download (pre-Eden): https://github.com/elParaguayo/xbmc-rand...ll/preEden
Up to the skinner as to where to include the code. The key lines are:
For filter by genre:
For no genre filter:
The user is first asked (via a yes/no dialog) whether they want to restrict the choice to unwatched movies. If the genre filter has been delected then the list of genres populates a DialogSelect list.
As I understand it, this isn't compatible in post-Dharma versions - I assume this is down to the deprecation of the http api requests and their replacement with JSON RPC calls.
Once I get pre-Eden working on my laptop I'll convert the script. EDIT: DONE.
I hope someone else finds this useful.
EDIT: Please note, there is a more comprehensive Random Items script (available here) which you may want to consider looking at. Depends what your needs are!