Additional Kodi Commands?

Here’s a thought. @tmm1, you mentioned, in the “Request: Channel Numbers?” thread, that you

I wonder if it would be reasonable (and possible) to utilize more of the Kodi keys. I’m thinking, perhaps…

  • For commercial skip: “>|” (“next”)
  • For “last/previous channel”: Either “|<” (“previous”), “previous track”, or “next track” (boxes with arrows in the upper-right of the Flirc GUI)
  • Maybe even the “CC” button? :slight_smile:

I would imagine the D-pad keys, “home,” “go back” (anti-clockwise circle-arrow), “context menu” (“C”), “play” and/or “pause”, “fast-forward” and “rewind” keys produce the same codes as under the “Minimalist” and “Amazon FireTV” templates.

(I programmed everything I could under “Minimalist,” then “FireTV,” then, for the numbers, “Kodi”.)

For those of use with highly-programmable IR remotes, those additional keys, particularly “>|” for commercial skip, I think would be handy.

There are a bunch already present…see this thread.

I have commercial skip working no prob, last channel, channuel up/down and page up/down in the guide.

Also, they’ve recently added channel number support in the guide such that you can direct key a channel to the corresponding place in the guide.

Thanks for the link, but it's unclear to me as to what mappings, if any, are relevant to the Kodi keys.

Here's the Flirc key map for Kodi:

Left-to-Right, Top-to-Bottom:

D-Pad

  • Up
  • Left, Enter, Right
  • Home, Down, (Go) Back

Right-Hand Keys

  • Mute, Volume Down, Volume Up, Full-Screen, Subtitles, Prev. Track, Next Track
  • Play, Pause, Stop, Rewind, Fast-Forward, Previous, Next
  • Shutdown, Info, Context Menu, EPG

(I knew about the channel number support. I referred to it in my OP.)

I’m not sure what keypress events flirc maps to each of those kodi buttons. If you can make a list of keyevents you would like added, it’s easy for me to do so. I just added support for ‘<’ and ‘>’ for commercial skipping.

I wish you’d instead used ‘>|’ for commercial skip. I’ve got “>” and “<” re-programmed to D-Pad “right” and “left”, respectively, so they mimic FF and Rew on other platforms and in other apps.

Other than that, what I noted in my OP.

What is ‘>|’? There is no such key on the keyboard. When I say ‘>’ I mean that particular keyboard event. I don’t know what that maps to in terms of the kodi flirc template.

‘>|’ is “next track” or “next chapter” on a DVD/BD.

They’re shown in the “Kodi” Flirc config image I posted above.

I don’t know what “particular keyboard event” means. I presume that if I associate the ‘>>|’ key on my remote with ‘>|’ in the Flirc, the Flirc will emit whatever is “Next” or “Next Chapter” or whatever.

I’ll go ahead an do that, then run “flirc_util keys” and see what it says.

Here’s the context diffs between the old Flirc programming and the new.

*** key-only-20180917       2018-09-27 15:17:34.656659581 -0400
--- key-only-20180927       2018-09-27 15:18:34.268624658 -0400
***************
*** 2,8 ****
--- 2,10 ----
  Recorded Keys:
  key
  ---
+ ,
  !
+ .
  0
  1
  2
***************
*** 16,27 ****
  browser_back
  down
  enter
- fast_forward
- left
  left
  play/pause
- rewind
  right
  right_shift !
- right_shift !
  up
--- 18,25 ----

What I find interesting is the old programming had dups for “left” and “right_shift !”, which is normally not possible.

N.B.: Because of a bug in the Flirc GUI, I had to clear the Flirc entirely and re-program it from scratch. That is why the fast_forward and rewind keys are missing in the newer programming. As I noted: I over-wrote them in the remotes with “right” and “left” so they’d behave as rewind and fast-forward on the FTV/Android TV boxes.

It looks like the ‘>|’ and ‘|<’ keys are emitting ‘.’ and ‘,’ (dot, comma) respectively.

I think you can use this to record the codes used by the app already. Can you try these for previous/next:

flirc_util record_api 0 234
flirc_util record_api 0 235

Also you should be able to use this to map channel up/down:

flirc_util record_api 2 0 156
flirc_util record_api 2 0 157

If these work then we can submit a new keymap to flirc for Channels instead of trying to re-use the random keychars in the Kodi template

I’m not certain what those two commands are supposed to accomplish, but, when I try them I get

flirc_util record_api 2 0 156
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_set_interrupt(380): Error: key not found
hit a key on the remote to be paired with 2 0
   Succesfully recorded button

[E] lib/libcmds/cmds.c run_cmds(248): could not find command '156'

The other two commands worked, but I haven’t been able to test them, yet. (At the rate these hearings are going, it’ll be a while, yet.)

There’s supposed to be a third undocumented prefix parameter but it’s not working. I’ve reached out to the flirc dev about it.

Get an answer, yet?

Nothing yet.

Don’t hold your breath. I don’t know what’s going on, over there, but few questions seem to get answered, lately.

Btw: What are “previous” and “next” supposed to do?

Should skip to commercial markers.

        KEYCODE_LEFT_BRACKET,
        KEYCODE_MEDIA_PREVIOUS,
        KEYCODE_MEDIA_SKIP_BACKWARD -> {
            seekToClosestMarker(-1)
            true
        }
        KEYCODE_RIGHT_BRACKET,
        KEYCODE_MEDIA_NEXT,
        KEYCODE_MEDIA_SKIP_FORWARD -> {
            seekToClosestMarker(1)
            true
        }
        KEYCODE_COMMA -> {
            if (event.isShiftPressed()) // <
                seekToClosestMarker(-1)
            true
        }
        KEYCODE_PERIOD -> {
            if (event.isShiftPressed()) // >
                seekToClosestMarker(1)
            true
        }

It does not, for me, on Android TV Beta 145.

Try 47 and 48, which map to [ and ]

That works great! At least on Android TV with Beta 145. I’ll try it on the FTV.

ETA: Absolutely beautiful :slight_smile: Works as well on the FTV as it did on the AdTV, and seems much more reliable than the double-FF-press.

1 Like

Annnnd now I have Channel Up/Down (also Page Up/Down in Guide) and Last/Previous Channel :slight_smile:

Kept going back over this thread and the one to which @skoal74 referred when suddenly the penny dropped. Switched the Flirc GUI to the full keyboard

programmed the Page Up, Page Down and Delete (Backspace) keys, plugged the Flirc into my Android TV, et voilà :slight_smile:

Maybe you'd consider that keymapping to CC on/off? (Or CC Track 1, Track 2, Track N, Off?) Though current CC settings are so easy to get to, it's not even on my wish list, really.

ETA: Here's something that might be kinda sorta cool: Switching channels from w/in Live TV, just like a TV set would do. Maybe even briefly display the new channel number--just like a TV would do? Just a thought.

Follow-up

Finally watched some stuff recorded for the first time since I programmed-in the commercial skip button. What a difference! Trying to double-tap the “FF” button was a real hit-or-miss thing. Often as not we’d find ourselves hitting that button repeatedly, rather than commskip actually working. Last night: No such thing. Would hit a commercial break, I’d hit the commskip button, and it’d hit the end of the commercial break, perfectly, every time.

1 Like