IR Blaster Script
#1
Following on from my feature request here.

Image

I am thinking this could perhaps be achieved by an addon.

Basically, I want to have a custom menu option e.g Pay TV which will:
  1. Change the video input
  2. Convert all xbmc input to ir output (to control stb) based on an alternative keymap
  3. When a certain button (exit) is pressed the script will change the video input back to xbmc and close

Before I start diving into learning python, I just wanted to know if this is possible and/or some tips or ideas on whether this is the best way to achieve such a task.

Specifically:
  • In a script can I listen for all input events?
  • What should I use to parse a custom keymap.xml?
  • Can I ensure key presses such as PreviousMenu or exit do not interrupt/close the script?

EDIT: I should note, I am aware of xbmc's built in function to send ir using lirc and this is what I intend to use.
Reply
#2
If you can't
  • In a script can I listen for all input events?
  • Can I ensure key presses such as PreviousMenu or exit do not interrupt/close the script?

You could probably redirect around xbmc by calling binaries in the system. I'm not too familiar with lirc, but it's just a thought.
Reply
#3
Okay, tonight I completed a proof of concept. It works quite well. On launch it changes the tv's video input then converts xbmc input -> tv ir codes until the exit button is pressed. This allows seamless viewing across multiple devices with one remote.

Code:
# import the XBMC libraries so we can use the controls and functions of XBMC
import xbmc, xbmcgui

# name and create our window
class ActionRedirector(xbmcgui.Window):

    xbmc.executebuiltin("LIRC.Send(SEND_ONCE tv INPUT-TV)")

    def onAction( self, action ):
        #PREVMENU -> EXIT
        if action == 10:
            xbmc.executebuiltin("LIRC.Send(SEND_ONCE tv INPUT-XBMC)")
            self.close()

        #LEFT (1) -> TV LEFT
        elif action == 1:
            xbmc.executebuiltin("LIRC.Send(SEND_ONCE tv LEFT)")

        #RIGHT (2) -> TV RIGHT
        elif action == 2:
            xbmc.executebuiltin("LIRC.Send(SEND_ONCE tv RIGHT)")

        #UP (3) -> TV UP
        elif action == 3:
            xbmc.executebuiltin("LIRC.Send(SEND_ONCE tv UP)")

        #DOWN (4) -> TV DOWN
        elif action == 4:
            xbmc.executebuiltin("LIRC.Send(SEND_ONCE tv DOWN)")

        #SELECT (7) -> TV SELECT
        elif action == 7:
            xbmc.executebuiltin("LIRC.Send(SEND_ONCE tv SELECT)")

# store our window as a short variable for easy of use
W = ActionRedirector()
# run our window
W.doModal()
# after the window is closed, Destroy it.
del W

There doesn't seem to be a whole lot of interest in ir blasting here so I'm not sure if i'll waste the time simplifying it for the masses.

Basically it just involves:
1. XBMC's keymaps link buttons with ACTIONS
2. This script listens for those ACTIONS and executes one of xbmc's built in commands
Reply
#4
I think its awesome ...

I'm using a PS3 bluetooth remote I was hoping to map one of the buttons (red one maybe) to a sleep function ... when the movie stops it should send the power command to turn off the TV

any ideas ?
Reply
#5
Hi Nick,

This is something I am very interested in. I am trying to achieve the following:
http://forums.pulse-eight.com/default.as...osts&t=241

Basically, turn a non-CEC compliant device into a CEC controlled device.
Reply

Logout Mark Read Team Forum Stats Members Help
IR Blaster Script0