diff --git a/companion-modules/media-player-classic/README.md b/companion-modules/media-player-classic/README.md index 1b5a53d..9869650 100644 --- a/companion-modules/media-player-classic/README.md +++ b/companion-modules/media-player-classic/README.md @@ -103,6 +103,9 @@ would not preload it in MPC-HC and is not implemented here. ## Variables and custom feedback +The elapsed preset uses the compact label **ELAP.** to avoid wrapping. The +playback-state preset displays **Playing**, **Paused**, **Stopped**, or **Idle**. + These are connection/module variables, not button-local variables. With the connection labelled `MPC_DEV`, use `$(MPC_DEV:remaining)` in button text. Presets are wired automatically to the connection label. @@ -116,6 +119,9 @@ Presets are wired automatically to the connection label. | `elapsed_seconds`, `duration_seconds`, `remaining_seconds` | Numeric media seconds; null when unknown | | `progress` | Percentage from 0 to 100; null when duration is unknown | +`state_label` provides capitalized display text; `state` retains lowercase values +for expressions and existing buttons. + Mute is separate from volume zero: `muted` follows MPC's mute switch. For existing/custom buttons, add **Playing**, **Stopped**, **Paused**, **Audio muted**, **No active media (idle)**, **Status unavailable**, or **Playback progress diff --git a/companion-modules/media-player-classic/src/definitions.js b/companion-modules/media-player-classic/src/definitions.js index 0b32ee4..0580770 100644 --- a/companion-modules/media-player-classic/src/definitions.js +++ b/companion-modules/media-player-classic/src/definitions.js @@ -59,10 +59,10 @@ export function presets(label = 'MPC_DEV') { transport_remaining: button('Remaining time and progress', `LEFT\n$(${label}:remaining)`, null, [ { feedbackId: 'progress_bar', options: {} }, ]), - transport_elapsed: button('Elapsed time and progress', `ELAPSED\n$(${label}:elapsed)`, null, [ + transport_elapsed: button('Elapsed time and progress', `ELAP.\n$(${label}:elapsed)`, null, [ { feedbackId: 'progress_bar', options: {} }, ]), - transport_state: button('Playback state', `$(${label}:state)`, null, [ + transport_state: button('Playback state', `$(${label}:state_label)`, null, [ active('playing', colors.green), active('paused', colors.amber), active('stopped', colors.red), diff --git a/companion-modules/media-player-classic/src/state.js b/companion-modules/media-player-classic/src/state.js index 18d02a3..570b26d 100644 --- a/companion-modules/media-player-classic/src/state.js +++ b/companion-modules/media-player-classic/src/state.js @@ -65,6 +65,7 @@ export const variableDefinitions = Object.fromEntries( Object.entries({ connected: 'Status data is available', state: 'Playback state: playing, paused, stopped, idle, or offline', + state_label: 'Playback state for display: Playing, Paused, Stopped, Idle, or Offline', playing: 'Player reports playing', stopped: 'Player reports stopped (idle is separate)', paused: 'Player reports paused', @@ -87,6 +88,7 @@ export function variables(state) { return { connected: !!state, state: state?.state ?? 'offline', + state_label: state ? state.state[0].toUpperCase() + state.state.slice(1) : 'Offline', playing: state ? state.state === 'playing' : null, stopped: state ? state.state === 'stopped' : null, paused: state ? state.state === 'paused' : null,