Opened 8 years ago

Closed 5 years ago

Last modified 3 years ago

#11916 closed Patch - Feature (fixed)

Frontend Services API inconsistent with direct key input, lirc, and network control socket

Reported by: skd5aner <skd5aner@…> Owned by: Bill Meek
Priority: minor Milestone: 0.28
Component: MythTV - Services API - Frontend Version: 0.27-fixes
Severity: medium Keywords:
Cc: Ticket locked: no


During playback...

  • Keyboard: Hit left, frontend will jump back 5 seconds
  • LIRC: Hit left on remote (mapped to left button), frontend will jump back 5 seconds
  • Network Control Socket: Send "left", frontend will jump back 5 seconds
  • Frontend Services API: send "left" via HTTP, and it will do a stickyrewind

Not exactly sure what other info may be needed to help diagnose, but I'm hoping the developers can replicate easily. Expected behavior would be for all of them to result in the same action, regardless of medium.

Attachments (2)

SendKey-Trac-11916-patch.v0 (6.7 KB) - added by Bill Meek <keemllib@…> 8 years ago.
SendKey? addition to Services API
SendKey-Trac-11916-patch.v1 (7.2 KB) - added by Bill Meek <keemllib@…> 7 years ago.
Updated patch, applies to v0.28-pre-2394-gbe72636 and matches other POST changes

Download all attachments as: .zip

Change History (10)

comment:1 Changed 8 years ago by skd5aner <skd5aner@…>

FYI - here's the API I used to replicate the issue: http://frontendip:6547/Frontend/SendAction?Action=LEFT

comment:2 Changed 8 years ago by sphery

On initial code review, it looks like the code is working properly--though the user interface is, at minimum, confusing to the user or possibly just plain wrong.

When using the keyboard, LIRC, or network control socket, the user is sending keys to MythTV. Those keys are then interpreted by mythfrontend based on how the user has bound those keys to MythTV actions.

However, when using the frontend services API, the user is sending a MythTV action directly--not sending a key that MythTV will interpret based on the user's key bindings. So, the "interpreted" action that Matt is expecting is actually TV Playback/SEEKRWND and can be achieved with: http://frontendip:6547/Frontend/SendAction?Action=SEEKRWND

It seems that the frontend services API just needs a SendKey? method to provide a user-friendly means of direct user interaction.

Whether the frontend services API should expose SendAction? is another question, but 3rd-party applications definitely should not use SendAction? as a means of sending keys to MythTV. Instead, the current design seems to require 3rd-party applications to reconstruct the MythTV keybindings implementation using GetContextList? and GetActionList? to determine the keys the user has bound and attempt to guess how mythfrontend will interpret that key and then send the action to which the key is bound (even though the 3rd-party application doesn't necessarily know which context mythfrontend is currently using to interpret keys and a given key can be bound to different actions in different contexts). Therefore, a SendKey? method, which allows the frontend to interpret whatever key the user sends, makes more sense for creating keyboard/remote functionality in applications.

My initial feeling is that it's fine for us to expose SendAction?, but doing so will be a point of confusion for users (including both 3rd-party application developers and their users)--especially until/unless we have a SendKey? action that is consistent with all the other interface options and all 3rd-party applications are changed to use it for providing user interactivity (remote/keyboard functionality). It seems that already-existing 3rd-party applications have used SendAction? thinking it was a means of providing keyboard/remote control of a frontend, though it is not. The SendAction? method simply allows 3rd party applications to send specific action requests regardless of the user's key bindings; however any direct user interaction in those 3rd party applications should use (the currently non-existent) SendKey? method to provide a means for the user to control the frontend, as if using a keyboard/remote.

However, since we don't allow users to send already-interpreted actions using any other interface, one could argue we should not expose SendAction?.

Changed 8 years ago by Bill Meek <keemllib@…>

Attachment: SendKey-Trac-11916-patch.v0 added

SendKey? addition to Services API

comment:3 Changed 8 years ago by Bill Meek <keemllib@…>

Attaching patch tested against 0.28-pre-448. Thanks to Mike Dean for the idea. Test with:

curl <FE>:6547/Frontend/SendKey?Key=[keyname|key]

To the original ticket case, use Key=LEFT and a recording will jump back 5 seconds (assumes default key bindings and settings.)

Applies OK against 0.27-fixes, but I didn't test it there.

comment:4 Changed 8 years ago by sphery

Type: Bug Report - GeneralPatch - Feature

Changed 7 years ago by Bill Meek <keemllib@…>

Attachment: SendKey-Trac-11916-patch.v1 added

Updated patch, applies to v0.28-pre-2394-gbe72636 and matches other POST changes

comment:5 Changed 5 years ago by Stuart Auchterlonie

Milestone: unknown0.28
Owner: set to dblain
Status: newassigned

comment:6 Changed 5 years ago by Bill Meek

Owner: changed from dblain to Bill Meek

comment:7 Changed 5 years ago by Bill Meek <bmeek@…>

Resolution: fixed
Status: assignedclosed

In 87e72e97a8238aafa375acb0a53ebc6b50193894/mythtv:

Services API: new endpoint; Frontend/SendKey?

See ticket 11916 for a detailed explaination about when this endpoint
would be used in place of Frontend/SendAction? (thanks Mike.)

N.B. If SendKey? is used to enter (for example) a user's Parental ID,
the *'s that hide their ID won't display.

Closes #11916
Refs #10521

comment:8 Changed 3 years ago by Bill Meek

Owner: changed from Bill Meek to Bill Meek
Note: See TracTickets for help on using tickets.