mattblovell / kodi_panel

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

Augment JSON-RPC calls with XBMC.GetInfoBooleans #45

Closed mattblovell closed 3 years ago

mattblovell commented 3 years ago

See Idea #44.

I'll likely define an initially empty set of arrays:

The existing InfoLabel calls can then be augmented with a second JSON-RPC call invoking XMBC.GetInfoBooleans. Unforutnately, I believe JSON-RPC only allows for a single method invocation per call, so a second network interaction is necessary (which will slow things down somewhat).

The results can be merged into the existing dictionaries that get passed around within kodi_panel_display, such that InfoLabels and InfoBooleans can be treated equivalently.

mattblovell commented 3 years ago

The arrays will all start out empty, so that the existing program behavior is unchanged. The end user's setup.toml file can list desired InfoBooleans to retrieve.

mattblovell commented 3 years ago

I may as well discuss the other portion of Idea #44 here, permitting for a "screensaver is running" layout. I'll pursue that by allowing for a context-driven "auto-selection" mode for the status screen.

Currently, status_screen() assumes there's just a single layout to use:

layout = STATUS_LAYOUT

That assignment can be made more intelligent, matching what's done at the start of audio_screens() or video_screens(). That, combined with the ability for the existing display_if or display_ifnot conditionals to make use of InfoBooleans should permit for a "screensaver layout".

mattblovell commented 3 years ago

Hmm.... maybe multiple RPC methods can be combined in a single JSON-RPC request. I'm reading about "batch" requests.

I'll have to experiment.

mattblovell commented 3 years ago

Update that may be of interest to @nico1080 ...

One can use batch JSON-RPC requests to pack multiple methods into a single network interaction.

With the just-started dev/info_booleans branch, one can have a layout field like that shown below. This example is for an audio layout:

# Show text over the album cover if paused
[[A_LAYOUT.FULL_ALTERNATE.fields]]
name  = "paused" 
posx  = 10
posy  = 10
font  = "font_artist"
fill  = "color_artist"
format_str = "PAUSED"
display_if = [ "Player.Paused", "true" ]
dynamic = 1

That fields element has to be flagged as dynamic, since the state of Player.Paused can change over time. The above is working, though!

mattblovell commented 3 years ago

Should be supported with v1.44