mattblovell / kodi_panel

Front panel LCD display for Kodi (via JSON-RPC)
MIT License
13 stars 5 forks source link

Display doesn't always update when switching between Music and TV Shows etc #7

Closed skunge2000 closed 3 years ago

skunge2000 commented 3 years ago

If I play Music tracks (from files not library in case that's relevant), I get album artwork, running time etc. As I switch tracks with different artwork this updates. If I then play a TV Show, the artwork updates again and I get the right information on screen.

However if I then switch back to music, the information for the previous TV Show remains (no new album artwork is displayed) but the running time display IS updated to reflect the new music track being played.

mattblovell commented 3 years ago

I think this is a consequence of my recent "split" of both audio and video screens into static and dynamic portions (done in an effort to reduce the update loop time on the RPi Zero).

Noting which mode last generated / built the _static_image, audio or video, should fix things. Whenever the current player is different, the whole _static_image just needs to be regenerated.

Separately, on the CoreELEC forums, I believe you stated the following:

Need to get to grips with TOML a bit to work out how to check what type of VideoPlayer we are in (TV Shows, Movies, Live TV/Recordings etc.)

I would definitely take a look at what Kodi's InfoLabels provide

https://kodi.wiki/view/InfoLabels

to see what can be distinguished. The JSON-RPC call that is made around Line 1285 of kodi_panel_display.py can be augmented:

        # Retrieve video InfoLabels in a single JSON-RPC call
        payload = {
            "jsonrpc": "2.0",
            "method"  : "XBMC.GetInfoLabels",
            "params"  : {"labels": ["VideoPlayer.Title",
                                    "VideoPlayer.TVShowTitle",
                                    "VideoPlayer.Season",
                                    "VideoPlayer.Episode",
                                    "VideoPlayer.Duration",
                                    "VideoPlayer.Time",
                                    "VideoPlayer.Genre",
                                    "VideoPlayer.Year",
                                    "VideoPlayer.VideoCodec",
                                    "VideoPlayer.AudioCodec",
                                    "VideoPlayer.Rating",
                                    "VideoPlayer.Cover",
            ]},
            "id"      : 4,
        }
        response = requests.post(rpc_url, data=json.dumps(payload), headers=headers).json()

My guess is that fields such as TVShowTitle, Season, and Episode only get populated for TV shows. You can make use of those fields now, via additions to the associated video screen in the ``V_LAYOUT``` dictionary that gets populated in the TOML file. Anything conditional though (e.g., if this field is non-empty, do something different) will require code updates.

(TOML just yet another in a long line of init / config "languages". I saw that it could handle creating the multi-entry dictionary that I first set up on your suggestion of separating the layout elements. I don't yet know if it's a good choice!)

mattblovell commented 3 years ago

Please try v1.11. I think it should resolve this hiccup.