Any way to have a remote button to play a particular video?
#1
I have an lirc remote for kodi that works well.

Is there any way to set up a remote button to instantly play a particular video (or playlist) when pressed?
Reply
#2
I don't know lirc at all but I'm guessing you can run a script from a lirc button press?  As such kodi does have command line things that can play something.

https://kodi.wiki/view/List_of_built-in_functions

This requires a package providing kodi-send. On Ubuntu / Debian it's kodi-eventclients-kodi-send. Make the script, tell lirc what button to fire it, and enjoy the results I'm thinking...
Reply
#3
If you are actually running lirc (presumably the older version that actually still works) then you can run a script when a button is pressed using a .lircrc file.  There is some information about that here:

Extending the remote control capabilities of LIRC
Reply
#4
Easiest would be to use the built-in function PlayMedia,I guess. It also can play playlists. See section 1.12 Player built-in's

You need to alter or crate a keymap under ~/.kodi/userdata/keymaps/. Maybe also keymap editor add-on can do the trick.
 
Code:
<keymap>
    <global>
        <keyboard>
            <key id="61520">PlayMedia("path to media")</key>
        </keyboard>
    </global>
<keymap>
Reply
#5
I added these lines to .kodi/userdata/Lircmap.xml under <remote device="devinput-32"> :
Quote:<obc6>KEY_PRESENTATION</obc6>
, and these lines to .kodi/userdata/keymaps/remote.xml :
Quote:<obc6>XBMC.PlayMedia("/pathto/video.mkv")</obc6>
And it does kinda work, but will only play the video when I'm already playing a different video!!

When I press the button from the main menu, it goes to the weather screen, and when I'm in "Videos", it doesn't do anything.

Is it possible that my skin (confluence) is intercepting the command for some reason? How can I prevent that??

Any ideas?
Reply
#6
This depends on the section within your .kodi/userdata/keymaps/remote.xml.

there is a "global" section, but also a "fullscreenvideo" section, a "fullscreenradio" section etc.

In the global section it should work for all screens, unless overwritten by a subsection like fullscreenvideo.

so check that your remote key is in the global section and not overwritten by any other subsection.
 
Code:
<keymap>
   <global>
  <keyboard>
     <key id="61520">PlayMedia("path to media")</key>
  </keyboard>
</global>

<fullscreenvideo>
      <keyboard>
         <key id="61520">PlayMedia("path to media")</key>
      </keyboard>
</fullscreenvideo>
...

<keymap>
Reply
#7
I tried, here's my complete remote.xml now:
 
Code:
<keymap>
    <global>
        <remote>
            <volumeplus></volumeplus>
            <volumeminus></volumeminus>
            <mute></mute>
        </remote>
        <universalremote>
            <obc3>Container.NextSortMethod</obc3>
            <obc4>Quit</obc4>
            <obc5></obc5>
            <obc6>XBMC.PlayMedia("/pathto/video.mkv")</obc6>
        </universalremote>
    </global>
</keymap>

That works but only when some other video is already playing.

I tried putting it in <remote> and also tried adding it in a new <keyboard> in there, but nothing happened at all when I did that, not even when a video is already playing.

The other <obcX> commands are working.

Any more ideas?
Reply
#8
So  maybe it is a good time to look at the debug log of Kodi. You can post it here https://paste.kodi.tv/
Reply
#9
I have been watching the kodi.log using "tail -f", and it actually doesn't show any messages at all when I press the button from the main screen.

It does show stuff at the times it actually works though.

Interestingly, I just discovered that it works when I press it from the "Music" screen, even with no video already playing! Very odd.

It doesn't work from the Videos screen - I have kodi set to start in the "Videos-Files" screen.

Aah, just discovered this
Quote:Remote keys can be observed in the kodi.log file (~/.kodi/temp/kodi.log on Linux) when debugging is enabled in the GUI (Settings -> debugging ). The list of pre-defined OBC codes can be found at XBIRRemote.h.
I'll have a go at enabling debug log when I get back home tonight to see what buttons it's registering.

According to this, obc code = 255 - value. So now I think what's happening is that my obc6 button is conflicting with button 255-6=249, which is XINPUT_IR_REMOTE_CLEAR according to IRRemote.h.
Reply
#10
I did try using this in .kodi/userdata/Lircmap.xml under <remote device="devinput-32">
 
Code:
<key id="61520">KEY_PRESENTATION</key>
, and this in .kodi/userdata/keymaps/remote.xml:
 
Code:
<keymap>
   <global>
     <keyboard>
       <key id="61520">XBMC.PlayMedia("/pathto/video.mkv")</key>
     </keyboard>
   </global>
</keymap>
, but it didn't work.

I ended up getting it to work using obc10, because I can see that there's no entry for 245 (255-10) in IRRemote.h.

But I would still like to know how I can add custom keys attached to buttons without having to use obc and manually check for empty entries in IRRemote.h??

How do I assign my lirc IR remote (devinput-32) button, KEY_PRESENTATION, to key id 61520, so I can assign custom commands to it like quoted above??
Reply
#11
key-id 61520 Hex:0xf050 is the keyboard "p" which I randomly picked in my example. One can see it in the debug log HandleKey: p (0xf050) .... when pressing p.
(2022-10-06, 09:49)devilledham Wrote: How do I assign my lirc IR remote (devinput-32) button, KEY_PRESENTATION, to key id 61520, so I can assign custom commands to it like quoted above??
I am not 100% sure what you want to do, but I think this is not the way to go.

I would follow the way of your non working key from lircd.conf -> symbol definition -> Lircmap.xml to map the symbol for kodi.
Reply
#12
(2022-10-06, 13:07)wastis Wrote: key-id 61520 Hex:0xf050 is the keyboard "p" which I randomly picked in my example. One can see it in the debug log HandleKey: p (0xf050) .... when pressing p.

Oh, I didn't realize that. I thought that number was a made-up one just so it would be high enough to be unused already.
Quote:I would follow the way of your non working key from lircd.conf -> symbol definition -> Lircmap.xml to map the symbol for kodi.

I'm fine with using irw to tell what key I'm pressing on the remote, eg KEY_PRESENTATION from what I did just then. I think that's what you mean by symbol definition.

The part I'm not sure of is... is there really not a better way to map an IR remote button to functions in kodi than having to manually look in IRRemote.h for numbers that are unused, then doing (255 minus that number) to work out a free obsX number, then adding that to Lircmap.xml and remote.xml?

Because that seems like a pretty convoluted way of doing it to me.
Reply
#13
I am not familiar with lirc, but theoretically that shouldn't matter using the keymap editor addon. That's what I use to avoid having to fiddle with files too much.
In your case, maybe try the addon to assign a key to an(y) action in the proper context/section (as I understand this is where it fails setting it up manually). Set it in the global-, video- and live tv section if you use pvr.
After that, open up the resulting key map file and edit the action,since last time I used it, the Keymap Editor addon didn't seem to be capable of the more 'advanced' stuff.
Hope it helps.
Reply

Logout Mark Read Team Forum Stats Members Help
Any way to have a remote button to play a particular video?0