Skip to content

Commit

Permalink
fix: don't get favorite children if parent is playable
Browse files Browse the repository at this point in the history
  • Loading branch information
punxaphil committed Jan 4, 2025
1 parent b1e575b commit 9ad269d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/services/media-browse-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,16 @@ export default class MediaBrowseService {
}

private async browseDir(player: MediaPlayer, favoritesDir: MediaPlayerItem, favorites: MediaPlayerItem[]) {
console.log('browsing dir', favoritesDir.title);
const dir = await this.hassService.browseMedia(
player,
favoritesDir.media_content_type,
favoritesDir.media_content_id,
);
for (const child of dir.children ?? []) {
if (child.can_expand) {
await this.browseDir(player, child, favorites);
}
if (child.can_play) {
console.log('adding favorite', child.title);
favorites.push(child);
} else if (child.can_expand) {
await this.browseDir(player, child, favorites);
}
}
}
Expand Down

0 comments on commit 9ad269d

Please sign in to comment.