Skip to content

Commit 6f3c924

Browse files
authored
Update fast-search-card.js
1 parent 1256838 commit 6f3c924

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

dist/fast-search-card.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12192,37 +12192,34 @@ class FastSearchCard extends HTMLElement {
1219212192
// Helper: Get Music Assistant Queue State
1219312193
async getQueueState(playerId) {
1219412194
try {
12195-
const playerName = this.extractPlayerNameFromId(playerId);
12196-
if (!playerName) {
12197-
console.log(`❌ Could not extract player name from: ${playerId}`);
12195+
const playerState = this._hass.states[playerId];
12196+
if (!playerState) {
12197+
console.log(`❌ Player state not found: ${playerId}`);
1219812198
return null;
1219912199
}
1220012200

12201-
const queueEntityId = `media_player.music_assistant_queue_${playerName}`;
12202-
const queueState = this._hass.states[queueEntityId];
12201+
const activeQueue = playerState.attributes.active_queue;
12202+
const mediaContentId = playerState.attributes.media_content_id;
1220312203

12204-
if (!queueState) {
12205-
console.log(`❌ Queue entity not found: ${queueEntityId}`);
12204+
if (!activeQueue) {
12205+
console.log(`❌ No active queue found for: ${playerId}`);
1220612206
return null;
1220712207
}
1220812208

12209-
const queueItems = queueState.attributes.queue_items || 0;
12210-
const mediaContentId = queueState.attributes.media_content_id;
12211-
12212-
console.log(`🔍 Queue ${queueEntityId}: ${queueItems} items, current: ${mediaContentId}`);
12209+
console.log(`🔍 Active queue ${activeQueue}, current media: ${mediaContentId}`);
1221312210

1221412211
return {
12215-
hasContent: queueItems > 0 && mediaContentId,
12212+
hasContent: activeQueue && mediaContentId,
1221612213
mediaContentId: mediaContentId,
12217-
queueItems: queueItems,
12218-
queueEntityId: queueEntityId
12214+
queueId: activeQueue,
12215+
playerId: playerId
1221912216
};
1222012217

1222112218
} catch (error) {
1222212219
console.error(`❌ Error checking queue state for ${playerId}:`, error);
1222312220
return null;
1222412221
}
12225-
}
12222+
}
1222612223

1222712224
// Smart Play/Pause with Queue awareness
1222812225
async smartPlayPause(item) {

0 commit comments

Comments
 (0)