Linux -  Access Remote control actions
Hi everyone,

I started developing an xbmc add-on some days ago. The basic idea I have in mind for my add-on is:
1. After I start the Add-on a random movie from a specific folder of my hdd should start
1.1. This folder on my hdd should get the "playlist" for xbmc (so, after a movie ends another movie from the same folder should start)
2. By pressing a specific button on my remote control (not yet sure which button I want to use for this. Maybe the buttons), I want to change the folder/playlist

I have already written some code to implement the behavior of 1.) and 1.1.). Now I need to access the events coming from my remote control. Therefore I found this tutorial but I can't get it running. This is the code of my

import xbmc, xbmcgui

#get actioncodes from keymap.xml

class MyClass(xbmcgui.Window):
  def onAction(self, action):
    if action == ACTION_PREVIOUS_MENU:
mydisplay = MyClass()
print "MY Class is created"
mydisplay .doModal()
del mydisplay

I can start the add-on from the video-add-on screen of my xbmc but all I get is a black screen with the "loading directory"-dialog saying "Retrieved 0 items". It seems the dialog will be displayed forever (I tried waiting 30 min). And if I press the cancel-button of this dialog I just get the black screen, two error messages in the log-file (see below), and the 'ESC'-key (ACTION_PREVIOUS_MENU-key) doesn't close this screen (neither does any other key).

NOTICE: MY Class is created
ERROR: GetDirectory - Error getting plugin://
ERROR: CGUIMediaWindow::GetDirectory(plugin:// failed

So here are my questions:
1. How can I fix this?
2. Is there an other way to get access events? Maybe a better solution as the one I am trying

My setup:
I am using xbmc 10.1 on my gentoo server
For the development I also use a virtual maschine with ubuntu 10.10 and xbmc 11.0

Thanks for helping

there is a big difference between scripts and plugins:
- plugins deliver a virtual file system to xbmc
- scripts provide an own gui

This is why xbmc waits for a "xbmcplugin.endOfDirectory()"-call.

You registered your addon as plugin but you are writing a script.
Change your addon.xml to:
<extension point="xbmc.python.script" library="">
Of course you would have to change "library".

You can also have a look a demo script I wrote:
(It is not very beautiful written but it could help)

And regarding your button-question, you could have a look to my helper-script "get_action_id":
It will show you the action-id's of key-presses to be used in onAction().

Good luck with your script!

My GitHub. My Add-ons:
Thank you very much! Your demo was very helpful.

BTW: I am checking the PseudoTV-Add-on right now. It seems it does all the things I need...
Thread Rating:
  • 0 Vote(s) - 0 Average

Logout Mark Read Team Forum Stats Members Help
Access Remote control actions00