info-beamer / package-livestream

Experimental package based on streamlink. Should be able to stream youtube, twitch and others.
https://info-beamer.com/pkg/6915
Other
1 stars 5 forks source link

Configurable CEC event name to select channel #2

Closed samuelb closed 4 years ago

samuelb commented 4 years ago

For whatever reason, my TV doesn't send the channel-up/-down events to the Raspberry Pi, but it does send cursor key presses "up", "right" etc. To be able to select the channels, I made following change to allow me to configure additional event names while still keep channel-up/-down events for use with remote control.

dividuum commented 4 years ago

Interesting. Thanks for the patch. If CEC is that unpredictable with regards to button events, maybe it would make sense to make the selection of alternative "key bindings" easier for users. Having to specify the raw cec code seems a bit low level for that. I would suggest we add a select option with (at the moment) two choices: The default of channel-up/channel-down and the new one with the odd up/right mapping. This might look like this:

{
    "title": "Remote control channel switching",
    "ui_width": 6,
    "name": "cec_mapping",
    "type": "select",
    "options": [
        [["channel-up", "channel-down"], "Using channel buttons (default)"],
        [["up", "right"], "Up/right (for some xyz TVs)"]
    ],
    "default": ["channel-up", "channel-down"]
}

Within Lua you can then use the directly:

if key == config.cec_mapping[1]  then -- [1] being up, [2] being down
   ...

I feel like this might have some conflict potential with #1, so we might wait for that. What do you think?

jreusch commented 4 years ago

hey hey i also saw that this will most likely conflict but have no problem with that. i did not open a PR yet because i wanted to also add this to the packages README.md. from my view: merge whichever PR is ready to be merged first and the other one then should be easily adaptable.

samuelb commented 4 years ago

with the odd up/right mapping.

Ah no, I use up/down actually :)

Lets wait for @jreusch change to be merged. I will afterwards review my change and implement Florians suggestion with the select option which I like more then my approach. Also, I want to look for a better way how to change the event names for CEC only and not for the remote control interface as well.

jreusch commented 4 years ago

Also, I want to look for a better way how to change the event names for CEC only and not for the remote control interface as well.

with my PR this is already solved.

dividuum commented 4 years ago

Now in master. Thanks for the suggestion. If you've imported the package from the repository, clicking on the "Check for updates" button is enough to update.