Map Numeric Keyboard Action to a Skin Button
#1
Basically, when the numeric key 0 (zero) is pressed on a keyboard when a live TV channel is playing, Kodi will switch the channel to the last channel played. I really find this feature very useful, particularly when I've switched channels because adverts have interrupted the channel I'm actually watching (Yeah, I really don't like adverts when watching TV.) Years ago, I used to have a dedicated button on my cable Tv remote for exactly this purpose of switching between the current and last played channel, just like what pressing numeric 0 key does in Kodi.

So, I wanted to map this keyboard action to a button on my OSD, but wasnt sure it was possible? I've noticed there is a Kodi Action ID available for numeric keys (Number<0-9>) which is described as 'Used to input the number 0 through 9'. So, would setting the <Onclick> on a button with Action(<0>) replicate the same numeric keyboard press, or am I totally misunderstanding what this action actually does?
Grateful if somebody in the know could confirm.
Many thanks
Cheers
Reply
#2
Its been a while since I've used this feature but I found that it only works with main channels and not sub channels - i.e. *.1. For example if you were previously on 10.2, changed to 4.3 and then click the zero button on you remote, Kodi would change to 10.1 and not 10.2 as expected. I don't know why it happens this way, all I know is that it's not a true previous channel switch.
Reply
#3
Tbh, when I've used the feature in the past it's always been for main channel numbers and normally with my keyboard. However, after what you wrote I just opened Channel 1 on my set-up using the remote, then switching to channel 14 and then selecting 0 on the remote. No problems for me switching back and forth between the two channels.....But I guess you would consider these as main channels, so maybe that's why I'm not seeing any problems (Unless of course the problem you described has now been fixed).

Was thinking it would be a handy feature to have as a button on the OSD, particularly for users who don't have numeric keys on their remote.
Hopefully one of the more knowledgeable skinners will come back and let me if this is actually possible.
Cheers
Reply
#4
Code:
<onclick>Action(Number0)</onclick>
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#5
@jurialmunkey 
Thanks very much.
For testing purposes, I'm using the PVR Channels button on the OSD, but no luck I'm afraid. This is what I'm using:-

xml:
<control type="radiobutton" id="70040">
     <include content="OSDButton">
      <param name="texture" value="osd/fullscreen/buttons/channels.png"/>
     </include>
     <onclick>Dialog.Close(VideoOSD)</onclick>
     <onclick>Action(Number0)</onclick>
     <visible>VideoPlayer.Content(livetv)</visible>
    </control>
Think I must have tried every possible permutation for the onclick I could think of at some point or another. I even started to wonder if this action was what I needed for this button to work as I wanted it too. So I was quite excited when I saw your reply, but alas there must something I'm doing incorrectly still or maybe the action just does not work as a button press on the OSD?
Rather annoyingly, when I press 0 on my keyboard, I have no issues switching between the 2 channels.....So it remains a bit of mystery at the moment still.
Is there anything else I might want to try?
Reply
#6
(2019-10-20, 03:00)jurialmunkey Wrote:
Code:
<onclick>Action(Number0)</onclick>

Isn't it just <onclick>Number0</onclick>?
Reply
#7
Use

Code:

<onclick>action(number0)</onclick>
<onclick>close</onclick>

The closing cmd has to be afterwards, otherwise it's interrupted in that special case.

Edit:
If you really have to close the OSD before for whatever reason:

Code:

<onclick>AlarmClock(togglechannel,action(number0),00:01,silent)</onclick>
<onclick>close</onclick>
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#8
(2019-10-20, 10:07)Hitcher Wrote:
(2019-10-20, 03:00)jurialmunkey Wrote:  
Isn't it just <onclick>Number0</onclick>?  
Think I'd probably tried that as well, but just gave it another try. No luck I'm afraid....
Reply
#9
@Dumyat
Overread my reply? It's working with switched onclick commands.
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#10
(2019-10-20, 10:28)sualfred Wrote: @Dumyat
Overread my reply? It's working with switched onclick commands.
Haha, Indeed I did.  Blush
But you are a star. 1st option works like a charm. I can now enjoy channel hopping on my shield during the ad's with an OSD button to switch back to the previous channel, as no numeric keys available on the remote.....Harmony can now be restored to our household!  Smile
Thanks to all for the feedback. Much appreciated.
Reply

Logout Mark Read Team Forum Stats Members Help
Map Numeric Keyboard Action to a Skin Button0