Frontend GetStatus not working?

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
mythpi
Junior
Posts: 18
Joined: Thu Jan 13, 2022 3:38 pm
United States of America

Frontend GetStatus not working?

Post by mythpi »

I'm running a frontend on a Raspberry Pi 4B, built from source. When I attempt to use the Frontend Services API, most of it works, but the Frontend GetStatus API refuses to indicate that live TV is playing, or that a recording is playing. While watching live tv, I get the following status return (nothing removed, this is all I get):

Code: Select all

<FrontendStatus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>
I have verified it's not a caching issue, and the results are similar when playing back a recording.

In looking at the source, I can't actually find anywhere that it's actually updating the FrontendStatus state info to either "playbackbox" or something similar (I'd expect it to be calling something under mythtv/programs/mythfrontend/services/mythfrontendservice.cpp, but can't find any such calls).

So am I misunderstanding where the update should be taking place? Do I have something misconfigured? Any suggestions of where to look would be appreciated.
User avatar
pgbennett
Developer
Posts: 504
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: Frontend GetStatus not working?

Post by pgbennett »

I see that it is not working correctly. It seems to be returning whatever value was return previously by that call. You can also use the frontend control port. That one is giving better information.

Code: Select all

telnet localhost 6546
# query location
Playback Recorded 00:10:09 of 10:14:02 1x 10001 2022-03-13T19:07:59Z 18262 /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]
mythpi
Junior
Posts: 18
Joined: Thu Jan 13, 2022 3:38 pm
United States of America

Re: Frontend GetStatus not working?

Post by mythpi »

Peter -

Thanks, I've been using the frontend control port in the past via mythmote, but am trying to move away from it as it tends to experience significant lag on my system (up to 10 seconds at times). Interestingly, the services API doesn't seem to lag much, if at all, in the same config.

As long as I'm correctly understanding where the updates should be taking place, I'll dig into the code and see if I can come up with a fix. Several of my other projects are wrapping up shortly, so hopefully I'll have some time to look at it.
mythpi
Junior
Posts: 18
Joined: Thu Jan 13, 2022 3:38 pm
United States of America

Re: Frontend GetStatus not working?

Post by mythpi »

On a side note, I posted an issue to track this.
User avatar
pgbennett
Developer
Posts: 504
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: Frontend GetStatus not working?

Post by pgbennett »

I had problems before with it causing slowdowns. I am not sure what the exact cause was, but this logic works for me (checking for not in standby mode):

Code: Select all

fstate=`( sleep 1 ; echo query location ; sleep 1 ; echo quit ) \
        | nc localhost 6546 | grep "#" | head -1 | sed  "s/# //" \
        | dos2unix`
if [[ "$fstate" != standbymode ]] ; then
    .....
mythpi
Junior
Posts: 18
Joined: Thu Jan 13, 2022 3:38 pm
United States of America

Re: Frontend GetStatus not working?

Post by mythpi »

So a quick look through the code explains why they return different information (for future Googlers).

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, however, to expect it to be notified the player is running, and data about the active playback (once, at startup). It seems like this discussion might be better held in the issue I filed (#545).

For my immediate purposes, I can use a mix of the two communication strategies, though.
Post Reply