Skip to content

Commit

Permalink
fix: no media selected showing incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
punxaphil committed Dec 3, 2023
1 parent 7de8e8c commit 568569b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/player-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PlayerHeader extends LitElement {

const speakerList = getSpeakerList(this.activePlayer, this.store.predefinedGroups);
let song = this.config.labelWhenNoMediaIsSelected ? this.config.labelWhenNoMediaIsSelected : 'No media selected';
if (this.activePlayer.attributes.media_title) {
if (this.activePlayer.state !== 'idle') {
song = this.activePlayer.getCurrentTrack();
}
return html` <div class="info">
Expand Down
2 changes: 1 addition & 1 deletion src/model/media-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class MediaPlayer {
);
}
getCurrentTrack() {
return `${this.attributes.media_artist || ''} - ${this.attributes.media_title || ''}`.replace(/^ - /g, '');
return `${this.attributes.media_artist || ''} - ${this.attributes.media_title || ''}`.replace(/^ - | - $/g, '');
}

private getEntityName(hassEntity: HassEntity, config: CardConfig) {
Expand Down

0 comments on commit 568569b

Please sign in to comment.