Skip to content

Commit

Permalink
feature: make it possible to don't switch player when grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
punxaphil committed Apr 8, 2024
1 parent 0b1f6a9 commit ac144de
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ predefinedGroups: # defaults to empty
entities:
- media_player.tv
skipApplyButtonWhenGrouping: true # default is false. Will skip the apply button when grouping.
dontSwitchPlayerWhenGrouping: true # default is false. Will not switch to another player if main player is ungrouped.

# player specific
showVolumeUpAndDownButtons: true # default is false, shows buttons for increasing and decreasing volume
Expand Down
4 changes: 4 additions & 0 deletions src/editor/advanced-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ export const ADVANCED_SCHEMA = [
name: 'playerVolumeOnlyAffectsMainPlayer',
selector: { boolean: {} },
},
{
name: 'dontSwitchPlayerWhenGrouping',
selector: { boolean: {} },
},
{
type: 'string',
help: 'Override default fallback artwork image if artwork is missing for the currently selected media',
Expand Down
2 changes: 1 addition & 1 deletion src/sections/grouping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class Grouping extends LitElement {
}
await this.handlePredefinedGroupConfig(isSelected);
if (unJoin.includes(this.activePlayer.id)) {
main = isSelected[0].player.id;
main = !!this.store.config.dontSwitchPlayerWhenGrouping ? this.activePlayer.id : isSelected[0].player.id;
dispatchActivePlayerId(main, this.store.config, this);
}
this.modifiedItems = [];
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export interface CardConfig extends LovelaceCardConfig {
artworkMinHeight?: number;
artworkAsBackground?: boolean;
playerVolumeOnlyAffectsMainPlayer?: boolean;
dontSwitchPlayerWhenGrouping?: boolean;
}

export interface MediaArtworkOverride {
Expand Down

0 comments on commit ac144de

Please sign in to comment.