Convert the viewer into a carousel.

This commit is contained in:
Dermot Duffy
2021-10-25 23:08:58 -07:00
parent c45c2ec973
commit 30adb637a8
5 changed files with 400 additions and 156 deletions
+5 -1
View File
@@ -43,6 +43,10 @@ export async function homeAssistantWSRequest<T>(
return parseResult.data;
}
export function isTrueMedia(media: BrowseMediaSource): boolean {
return !media.can_expand;
}
// From a BrowseMediaSource item extract the first true media item (i.e. a
// clip/snapshot, not a folder).
export function getFirstTrueMediaChildIndex(
@@ -52,7 +56,7 @@ export function getFirstTrueMediaChildIndex(
return null;
}
for (let i = 0; i < media.children.length; i++) {
if (!media.children[i].can_expand) {
if (isTrueMedia(media.children[i])) {
return i;
}
}