Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend Services API GetStatus incorrect if playing live tv or recording #545

Closed
lilleym opened this issue Apr 16, 2022 · 4 comments
Closed
Assignees
Labels
bug:general General Bugs component:mythtv:api Services API issues version:v32-fixes fixes/32

Comments

@lilleym
Copy link

lilleym commented Apr 16, 2022

  • Platform: Debian Bullseye
    Linux pi1 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux

  • MythTV version: mythtv-light 32~Pre-3360-ga1e72a209b-0

  • Package version: Built from source

  • Component: Frontend Services API

What steps will reproduce the bug?

  1. Start myth frontend
  2. Navigate to either live TV, or play a recording.
  3. Issue call to Frontend GetStatus api (current code overrides port to 8081, so localhost:8081/Frontend/GetStatus

XML response should indicate that the current location is the playback box, but instead it shows (for live tv) mainmenu.

How often does it reproduce? Is there a required condition?

Always.

What is the expected behaviour?

Current location should indicate playbackbox, with program details available.

What do you see instead?

<FrontendStatus serializerVersion="1.1" version="1.1"> <Name>pi1</Name> <Version>v32-Pre-3360-ga1e72a209b</Version> <State> <String> <Key>currentlocation</Key> <Value>mainmenu</Value> </String> <String> <Key>menutheme</Key> <Value>defaultmenu</Value> </String> <String> <Key>state</Key> <Value>idle</Value> </String> </State> <ChapterTimes/> <SubtitleTracks/> <AudioTracks/> </FrontendStatus>

Additional information

Apparently the network control port shows the correct information (I haven't tested this yet).

@lilleym
Copy link
Author

lilleym commented Apr 18, 2022

Further testing indicates the network control port does indeed return correct information. The reason the two interfaces react differently appears to be as follows:

When the network control port receives a location query, it calls GetMythUI::GetCurrentLocation which constructs a response based on the current actual status.

When the Services API receives a GetStatus request, it calls MythUIStateTracker::GetFreshState for the status. MythUIStateTracker caches responses for 500ms, but additionally never appears to be notified that the player is active.

I doubt that it's appropriate to be updating the MythUIStateTracker with current position in playback information (for example), especially given the data may never be examined. It seems reasonable to me, to expect it to be notified the player is running, and data about the active playback (once, at startup). I thought I'd open up the question to see if there are other reasonable alternatives.

@stuarta stuarta added bug:general General Bugs component:mythtv:api Services API issues version:v32-fixes fixes/32 labels Apr 21, 2022
@thomasboehm
Copy link

thomasboehm commented May 9, 2022

At some point I got an output where <State> was completely empty

curl 192.168.99.4:6547/Frontend/GetStatus
<?xml version="1.0" encoding="UTF-8"?><FrontendStatus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" serializerVersion="1.1"><Name>desktop</Name><Version>v32.0+fixes.202204301748.d80a8da3f0~ubuntu22.04.1</Version><State/><ChapterTimes/><SubtitleTracks/><AudioTracks/></FrontendStatus>

I can't reproduce it anymore and always get the same output as in the post above.

@bennettpeter
Copy link
Member

As a workaround you can use the network control port to get the info until this is fixed

telnet localhost 6546
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
MythFrontend Network Control
Type 'help' for usage information
---------------------------------
# query location
Playback Recorded 00:12:15 of 10:14:02 1x 10001 2022-03-13T19:07:59Z 22032 /home/storage/Video/mythtv-local/Default/10001_20220313190759.ts 29.97 Subtitles: *0:[None]* 1:[ATSC CC 1: Undetermined] 2:[ATSC CC 2: Undetermined] 3:[CC 1: Undetermined]
# exit
Connection closed by foreign host.
peter@rocinante:~$ 

@bennettpeter bennettpeter self-assigned this May 18, 2022
@bennettpeter
Copy link
Member

Bug is caused by this line being commented

// customEvent(Event);

Uncommenting that fixes it.
I am waiting for review before making the fix.

linuxdude42 added a commit that referenced this issue May 27, 2022
This bug was introduced while fixing a problem where all the network
control "play" commands were duplicated by MythTV.  Most of the "play"
commands are idempotent, so the only place the duplication was visible
was the "play speed pause" command.

Fixing that problem using a different method restores the
functionality of the GetStatus API call.

Fixes #545.

(cherry picked from commit 0751111)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:general General Bugs component:mythtv:api Services API issues version:v32-fixes fixes/32
Projects
None yet
Development

No branches or pull requests

5 participants