I'm new here, but I use XBMC since 2003. I love XBMC for it's intuitionally behaviour (high WAF) which includes contextually use of the remote keys. This behaviour is vanished since the EG plugin only uses direct actions. I'm able to programm C/C++/C#, but I never tried Python before.
I run XBMC Atlantis final + EventGhost 0.3.6.1486 under VISTA 32 SP1.
I tried the following code (unimportant lines ripped off), but it seems to be that XBMC has some problems with events that are sended by the function send_remote_button.
Each event by this function is repeated unlimited in XBMC. I can close EG and XBMC continues repeating the last key.
Anyone who can help or has another solution for the contextually use of remote keys defined in the keymap.xml without change it?
Code: Select all
# remote keys handled by XBMC
REMOTEKEYS = (
# necessary keys for contextually use with keymap.xml
("Remote_Up", "Remote - Up", "Simulate a press on the up button.", "up"),
("Remote_Down", "Remote - Down", "Simulate a press on the down button.", "down"),
("Remote_Left", "Remote - Left", "Simulate a press on the left button.", "left"),
("Remote_Right", "Remote - Right", "Simulate a press on the right button.", "right"),
("Remote_Menu", "Remote - Menu", "Simulate a press on the menu button.", "menu"),
("Remote_Select", "Remote - Select", "Simulate a press on the select button.", "select"),
("Remote_Back", "Remote - Back", "Simulate a press on the back button.", "back"),
("Remote_Start", "Remote - Start", "Simulate a press on the start button.", "start"),
("Remote_Info", "Remote - Info", "Simulate a press on the info button.", "info"),
("Remote_Title", "Remote - Title", "Simulate a press on the title button.", "title"),
("Remote_Display", "Remote - Display", "Simulate a press on the display button.", "display"),
("Remote_Number0", "Remote - Number 0", "Simulate a press on the 0 button.", "zero"),
("Remote_Number1", "Remote - Number 1", "Simulate a press on the 1 button.", "one"),
("Remote_Number2", "Remote - Number 2", "Simulate a press on the 2 button.", "two"),
("Remote_Number3", "Remote - Number 3", "Simulate a press on the 3 button.", "three"),
("Remote_Number4", "Remote - Number 4", "Simulate a press on the 4 button.", "four"),
("Remote_Number5", "Remote - Number 5", "Simulate a press on the 5 button.", "five"),
("Remote_Number6", "Remote - Number 6", "Simulate a press on the 6 button.", "six"),
("Remote_Number7", "Remote - Number 7", "Simulate a press on the 7 button.", "seven"),
("Remote_Number8", "Remote - Number 8", "Simulate a press on the 8 button.", "eight"),
("Remote_Number9", "Remote - Number 9", "Simulate a press on the 9 button.", "nine"),
("Remote_Star", "Remote - Star", "Simulate a press on the * button.", "star"),
("Remote_Hash", "Remote - Hash", "Simulate a press on the # button.", "hash"),
("Remote_Clear", "Remote - Clear", "Simulate a press on the clear button.", "clear"),
######################################################################################################################
# commented out for better overview in EG because this functions can be done by actions
# --------------------------------------------------------------------------------------------------------------------
#("Remote_VolumeUp", "Remote - Volume Up", "Simulate a press on the volume up button.", "volumeplus"),
#("Remote_VolumeDown", "Remote - Volume Down", "Simulate a press on the volume down button.", "volumeminus"),
#("Remote_Mute", "Remote - Mute", "Simulate a press on the mute button.", "mute"),
#("Remote_PageUp", "Remote - Page Up", "Simulate a press on the page up button.", "pageplus"),
#("Remote_Page Down", "Remote - Page Down", "Simulate a press on the page down button.", "pageminus"),
#("Remote_Play", "Remote - Play", "Simulate a press on the play button.", "play"),
#("Remote_Pause", "Remote - Pause", "Simulate a press on the pause button.", "pause"),
#("Remote_Stop", "Remote - Stop", "Simulate a press on the stop button.", "stop"),
#("Remote_Record", "Remote - Record", "Simulate a press on the record button.", "record"),
#("Remote_FastForward", "Remote - Fast Forward", "Simulate a press on the fast-forward button.", "forward"),
#("Remote_Rewind", "Remote - Rewind", "Simulate a press on the rewind button.", "reverse"),
#("Remote_SkipNext", "Remote - Skip Next", "Simulate a press on the skip-next button.", "skipplus"),
#("Remote_SkipPrevious", "Remote - Skip Previous", "Simulate a press on the skip-previous button.", "skipminus"),
#("Remote_MyVideo", "Remote - My Video", "Simulate a press on the My Video button.", "myvideo"),
#("Remote_MyMusic", "Remote - My Music", "Simulate a press on the My Music button.", "mymusic"),
#("Remote_MyPictures", "Remote - My Pictures", "Simulate a press on the My Pictures button.", "mypictures"),
#("Remote_MyTV", "Remote - My TV", "Simulate a press on the My TV button.", "mytv"),
#("Remote_Power", "Remote - Power", "Simulate a press on the power button.", "power"),
######################################################################################################################
)
# actions handled by XBMC. For a list of all actions see: http://xbmc.org/wiki/?title=Action_IDs
ACTIONS = (
######################################################################################################################
# commented out for better overview in EG because this functions can be done by remote keys
# --------------------------------------------------------------------------------------------------------------------
#("Action_Up", "Action - Up", "Moves up in the interface.", "Up"),
#("Action_Down", "Action - Down", "Moves down in the interface.", "Down"),
#("Action_Left", "Action - Left", "Moves left in the interface.", "Left"),
#("Action_Right", "Action - Right", "Moves right in the interface.", "Right"),
#("Action_Select", "Action - Select", "Selects the current element.", "Select"),
#("Action_Info", "Action - Info", "Contextual information.", "Info"),
#("Action_Number0", "Action - Number 0", "Remote number 0.", "Number0"),
#("Action_Number1", "Action - Number 1", "Remote number 1.", "Number1"),
#("Action_Number2", "Action - Number 2", "Remote number 2.", "Number2"),
#("Action_Number3", "Action - Number 3", "Remote number 3.", "Number3"),
#("Action_Number4", "Action - Number 4", "Remote number 4.", "Number4"),
#("Action_Number5", "Action - Number 5", "Remote number 5.", "Number5"),
#("Action_Number6", "Action - Number 6", "Remote number 6.", "Number6"),
#("Action_Number7", "Action - Number 7", "Remote number 7.", "Number7"),
#("Action_Number8", "Action - Number 8", "Remote number 8.", "Number8"),
#("Action_Number9", "Action - Number 9", "Remote number 9.", "Number9"),
######################################################################################################################
("Action_PageUp", "Action - Page Up", "Moves up a page in the interface.", "PageUp"),
("Action_PageDown", "Action - Page Down", "Moves down a page in the interface.", "PageDown"),
("Action_PreviousMenu", "Action - Previous Menu", "Previous menu.", "PreviousMenu"),
("Action_ContextMenu", "Action - Context Menu", "Context menu.", "ContextMenu"),
("Action_Play", "Action - Play", "Toggles play/pause of the current media.", "Play"),
("Action_Pause", "Action - Pause", "Pauses the current media.", "Pause"),
("Action_Stop", "Action - Stop", "Stops playback of the current media.", "Stop"),
("Action_FastForward", "Action - Fast Forward", "Fast-forwards the current media.", "FastForward"),
("Action_Rewind", "Action - Rewind", "Rewinds the current media.", "Rewind"),
("Action_SkipNext", "Action - Skip Next", "Skips to the next media item.", "SkipNext"),
("Action_SkipPrevious", "Action - Skip Previous", "Skips back to the previous media item.", "SkipPrevious"),
("Action_Record", "Action - Record", "Starts recording.", "Record"),
("Action_BigSkipBackward", "Action - Big Skip Backward", "Big skip backward.", "PlayerControl(BigSkipBackWard)"),
("Action_BigSkipForward", "Action - Big Skip Forward", "Big skip forward.", "PlayerControl(BigSkipForward)"),
("Action_SmallSkipBackward", "Action - Small Skip Backward", "Small skip backward.", "PlayerControl(SmallSkipBackward)"),
("Action_SmallSkipForward", "Action - Small Skip Forward", "Small skip forward.", "PlayerControl(SmallSkipForward)"),
("Action_AspectRatio", "Action - Aspect Ratio", "Display the aspect ratio of the current media.", "AspectRatio"),
("Action_CodecInfo", "Action - Codec Info", "Display the codec information of the current media.", "CodecInfo"),
("Action_FullScreen", "Action - Full Screen", "Display the current media in full screen mode.", "FullScreen"),
("Action_Repeat", "Action - Repeat", "Repeat.", "PlayerControl(Repeat)"),
("Action_ShowSubtitles", "Action - Show Subtitles", "Toggle subtitles on or off.", "ShowSubtitles"),
("Action_OSD", "Action - Show OSD", "Shows the on-screen display.", "OSD"),
("Action_ShowTime", "Action - Show Time", "Show current play time.", "ShowTime"),
("Action_VolumeUp", "Action - Volume Up", "Raises the volume.", "VolumeUp"),
("Action_VolumeDown", "Action - Volume Down", "Lowers the volume.", "VolumeDown"),
("Action_Mute", "Action - Mute", "Simulate a press on the mute button.", "Mute"),
("Action_ScrollUp", "Action - Scroll Up", "Scroll up in list.", "ScrollUp"),
("Action_ScrollDown", "Action - Scroll Down", "Scroll down in list.", "ScrollDown"),
("Action_Close", "Action - Close", "Close and open dialog box.", "Close"),
("Action_Playlist", "Action - Playlist", "Shows the current playlist.", "Playlist"),
("Action_Queue", "Action - Queue", "Queue the current item.", "Queue"),
("Action_MoveItemUp", "Action - Move Item Up", "Move item up in playlist.", "MoveItemUp"),
("Action_MoveItemDown", "Action - Move Item Down", "Move item down in playlist.", "MoveItemDown"),
("Action_Delete", "Action - Delete", "Delete the current item.", "Delete"),
("Action_Random", "Action - Random", "Random.", "PlayerControl(Random)"),
("Action_Repeat", "Action - Repeat", "Repeat.", "PlayerControl(Repeat)"),
("Action_PartyMode", "Action - Party Mode", "Party mode.", "PlayerControl(PartyMode)"),
("Action_ParentDir", "Action - Parent Dir", "Parent directory.", "ParentDir"),
("Action_TakeScreenShot", "Action - Take Screen Shot", "Takes a screen shot.", "TakeScreenshot"),
("Action_EjectTray", "Action - Eject Tray", "Close or open the DVD tray.", "EjectTray"),
("Action_PlayDVD", "Action - Play DVD", "Plays the inserted CD or DVD media from the DVD-ROM Drive.", "PlayDVD"),
("Action_Home", "Action - Show Home Screen", "Show Home screen.", "ActivateWindow(Home)"),
("Action_MyVideos", "Action - Show Videos Screen", "Show Videos screen.", "ActivateWindow(MyVideos)"),
("Action_MyMusic", "Action - Show Music Screen", "Show Music screen.", "ActivateWindow(MyMusic)"),
("Action_MyPictures", "Action - Show Pictures Screen", "Show Pictures screen.", "ActivateWindow(MyPictures)"),
("Action_MyMovies", "Action - Show Movies Screen", "Show Movies screen.", "ActivateWindow(MyVideoLibrary,movietitles,return)"),
("Action_MyTVShows", "Action - Show TV Shows Screen", "Show TV Shows screen.", "ActivateWindow(MyVideoLibrary,tvshowtitles,return)"),
("Action_Weather", "Action - Show Weather Screen", "Show Weather screen.", "ActivateWindow(Weather)"),
("Action_Settings", "Action - Show Settings Screen", "Show Settings screen.", "ActivateWindow(Settings)"),
("Action_Favorites", "Action - Show Favorites Screen", "Show Favorites screen.", "ActivateWindow(Favourites)"),
("Action_SystemInfo", "Action - Show System Info Screen", "Show System Info screen.", "ActivateWindow(SystemInfo)"),
("Action_LastFMLove", "Action - Last FM Love", "Add the current playing last.fm radio track to the last.fm loved tracks.", "LastFM.Love"),
("Action_LastFMBan", "Action - Last FM Ban", "Ban the current playing last.fm radio track.", "LastFM.Ban"),
("Action_UpdateVideoLibrary", "Action - Update Video Library", "Update the video library.", "UpdateLibrary(Video)"),
("Action_UpdateMusicLibrary", "Action - Update Music Library", "Update the music library.", "UpdateLibrary(Music)"),
("Action_ShutdownMenu", "Action - Show Shutdown Menu", "Show the shutdown Menu.", "ActivateWindow(ShutdownMenu)"),
("Action_Quit", "Action - Quit XBMC", "Quit XBMC.", "Quit"),
("Action_Shutdown", "Action - Shutdown Computer", "Trigger default shutdown behavior from settings.", "Shutdown"),
("Action_Powerdown", "Action - Powerdown Computer", "Powerdown the computer.", "Powerdown"),
("Action_Suspend", "Action - Suspend Computer", "Suspend the computer.", "Suspend"),
("Action_Hibernate", "Action - Hibernate Computer", "Hibernate the computer.", "Hibernate"),
("Action_Reset", "Action - Reset Computer", "Reset the computer.", "Reset"),
)
class RemoteKeyPrototype(eg.ActionClass):
def __call__(self):
try:
self.plugin.xbmc.send_remote_button(self.value)
except:
raise self.Exceptions.ProgramNotRunning
class ActionPrototype(eg.ActionClass):
def __call__(self):
try:
self.plugin.xbmc.send_action(self.value, ACTION_BUTTON)
except:
raise self.Exceptions.ProgramNotRunning
# And now we define the actual plugin:
class XBMC(eg.PluginClass):
def __init__(self):
self.AddActionsFromList(REMOTEKEYS, RemoteKeyPrototype)
self.AddActionsFromList(ACTIONS, ActionPrototype)
self.xbmc = XBMCClient("EventGhost")
def __start__(self):
try:
self.xbmc.connect()
except:
raise self.Exceptions.ProgramNotRunning
def __stop__(self):
try:
self.xbmc.close()
except:
pass
def __close__(self):
pass