feat: Implement basic general folder support (#2051)

- Related: #1748
This commit is contained in:
Dermot Duffy
2025-05-21 19:59:21 -07:00
committed by GitHub
parent 2eb0d9e35e
commit c6a4c8aea2
350 changed files with 12837 additions and 4509 deletions
+1
View File
@@ -6,6 +6,7 @@
- [`conditions`](conditions.md)
- [`dimensions`](dimensions.md)
- [`elements`](elements/README.md)
- [`folders`](folders.md)
- [`image`](image.md)
- [`live`](live.md)
- [`media_gallery`](media-gallery.md)
+1
View File
@@ -9,6 +9,7 @@
- [`conditions`](../conditions.md)
- [`dimensions`](../dimensions.md)
- [`elements`](../elements/README.md)
- [`folders`](../folders.md)
- [`image`](../image.md)
- [`live`](../live.md)
- [`media_gallery`](../media-gallery.md)
@@ -112,6 +112,20 @@ action: custom:advanced-camera-card-action
advanced_camera_card_action: expand
```
## `folder`
Show a given folder in the folder gallery.
```yaml
action: custom:advanced-camera-card-action
advanced_camera_card_action: folder
# [...]
```
| Parameter | Default | Description |
| --------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| `folder` | The first configured folder (under [`folders`](../../folders.md)). | An optional id of the folder to show, see the `id` parameter under [`folders` configuration](../../folders.md). |
## `fullscreen`
Toggle fullscreen.
@@ -9,6 +9,7 @@
- [`conditions`](../../conditions.md)
- [`dimensions`](../../dimensions.md)
- [`elements`](../../elements/README.md)
- [`folders`](../../folders.md)
- [`image`](../../image.md)
- [`live`](../../live.md)
- [`media_gallery`](../../media-gallery.md)
@@ -9,6 +9,7 @@
- [`conditions`](../../conditions.md)
- [`dimensions`](../../dimensions.md)
- [`elements`](../../elements/README.md)
- [`folders`](../../folders.md)
- [`image`](../../image.md)
- [`live`](../../live.md)
- [`media_gallery`](../../media-gallery.md)
+1
View File
@@ -7,6 +7,7 @@
- [`engine`](engine.md)
- [`conditions`](../conditions.md)
- [`dimensions`](../dimensions.md)
- [`folders`](../folders.md)
- [`elements`](../elements/README.md)
- [`image`](../image.md)
- [`live`](../live.md)
@@ -1 +1 @@
!> This functionality is experimental. It may be broken, slow or change without warning.
!> This functionality is experimental. It may be broken, slow or change without warning or major version number change.
+1
View File
@@ -8,6 +8,7 @@
- [`elements`](README.md)
- [Custom Elements](./custom/README.md)
- [Stock Elements](./stock/README.md)
- [`folders`](../folders.md)
- [`image`](../image.md)
- [`live`](../live.md)
- [`media_gallery`](../media-gallery.md)
@@ -8,6 +8,7 @@
- [`elements`](../../elements/README.md)
- [Custom Actions](README.md)
- [Stock Actions](../stock/README.md)
- [`folders`](../../folders.md)
- [`image`](../../image.md)
- [`live`](../../live.md)
- [`media_gallery`](../../media-gallery.md)
@@ -8,6 +8,7 @@
- [`elements`](../../elements/README.md)
- [Custom Actions](../custom/README.md)
- [Stock Actions](README.md)
- [`folders`](../../folders.md)
- [`image`](../../image.md)
- [`live`](../../live.md)
- [`media_gallery`](../../media-gallery.md)
+91
View File
@@ -0,0 +1,91 @@
# `folders`
[](./common/experimental-warning.md ':include')
The `folders` stanza is used for configuring folders from which media/subfolders may be viewed.
?> To configure the behavior of the gallery in which folders are displayed, see the [`media_gallery` configuration](./media-gallery.md).
```yaml
folders:
# [...]
```
| Option | Default | Description |
| ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` | | An optional folder `id` which can be used by the [`folder` action](./actions/custom/README.md?id=folder) to show a particular folder contents. |
| `ha` | | Options for `ha` folder types. See below. |
| `icon` | | An optional folder icon. |
| `title` | | An optional folder title. |
| `type` | `ha` | The type of folder, `ha` for Home Assistant media folders (currently the only supported type of folder). |
## `ha`
Used to specify a Home Assistant media folder.
```yaml
folders:
- type: ha
ha:
# [...]
```
| Option | Default | Description |
| ------ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `url` | | An optional Home Assistant `Media` browser URL to use as the query base. If `path` is also specified, those matchers are applied against folders "below" the folder specified in `url`. |
| `path` | [`{ id: media-source:// }`] | An optional array of matchers to dynamically compare against the Home Assistant media folder hierarchy. See below. |
?> `url` is never fetched, nor sent over the network. It is only processed
locally in your browser. The host part of the URL can optionally be removed.
### `path`
An array of matchers to navigate "down" a folder hierarchy. If `url` is also
specified, matchers are applied starting at that folder, otherwise they are
applied at the media source root (i.e. `media-source://`).
```yaml
folders:
- type: ha
ha:
path:
# [...]
```
| Option | Default | Description |
| ---------- | ------- | ------------------------------------------------------ |
| `id` | | An optional media source `id` to match against. |
| `title` | | An optional title name to match against. |
| `title_re` | | An optional title regular expression to match against. |
?> Specifying multiple `path` matchers (other than `id`) requires a query at
each level of the folder hierarchy and is slower than directly specifying the
media source `id` (if known) or the `url` of the folder.
#### Examples
See [Folder Examples](../examples.md?id=folders).
#### Understanding Media Source IDs and "parent folders"
Home Assistant Media Source IDs are typically long integration-specific non-user
friendly strings that refer to a media item, or folder of media items. Media
source "folders" do not have an intrinsic parent as with filesystem folders,
rather a trail is built as the user navigates "downwards" -- but anything could
theoretically be the parent of anything.
## Fully expanded reference
[](common/expanded-warning.md ':include')
```yaml
folders:
- type: ha
ha:
url: https://my-ha-instance.local/media-browser/browser/app%2Cmedia-source%3A%2F%2Ffrigate
path:
- id: 'media-source://'
- title: 'Frigate'
- title_re: 'Clips.*'
- title_re: 'Person.*'
```
+9 -8
View File
@@ -1,16 +1,17 @@
# `media_gallery`
The `media_gallery` is used for providing an overview of all `clips`, `snapshots` and `recordings` in a thumbnail gallery.
The `media_gallery` is used for providing an overview of all `clips`,
`snapshots`, `recordings` and `folder` contents in a thumbnail gallery.
```yaml
media_gallery:
# [...]
```
| Option | Default | Description |
| ---------- | ------- | ------------------------------------------------------------------------------------------------------------------------- |
| `actions` | | [Actions](actions/README.md) to use for all views that use the `media_gallery` (e.g. `clips`, `snapshots`, `recordings`). |
| `controls` | | Configuration for the Media viewer controls. See below. |
| Option | Default | Description |
| ---------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `actions` | | [Actions](actions/README.md) to use for all views that use the `media_gallery` (e.g. `clips`, `folder`, `snapshots`, `recordings`). |
| `controls` | | Configuration for the Media Gallery controls. See below. |
## `controls`
@@ -25,9 +26,9 @@ media_gallery:
# [...]
```
| Option | Default | Description |
| ------ | ------- | ----------------------------------------------------------------------------------------------------- |
| `mode` | `right` | Whether to show the gallery media filter to the `left`, to the `right` or `none` for no media filter. |
| Option | Default | Description |
| ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mode` | `right` | Whether to show the gallery media filter to the `left`, to the `right` or `none` for no media filter. The `folder` view does not support media filtering. |
### `thumbnails`
+53 -47
View File
@@ -36,6 +36,7 @@ menu:
| `display_mode` | The `display_mode` button allows changing between single and grid views. |
| `download` | The `download` menu button: allow direct download of the media being displayed. |
| `expand` | The `expand` menu button: expand the card into a popup/dialog. |
| `folders` | The `folders` menu button to select a folder of media to view in the [`media_gallery`](./media-gallery.md). Will only appear if [`folders`](./folders.md) are configured. |
| `fullscreen` | The `fullscreen` menu button: expand the card to consume the fullscreen. Please note that fullscreen behavior on iPhone is limited, see [troubleshooting](../troubleshooting.md?id=fullscreen-doesn39t-work-on-iphone). |
| `image` | The `image` view menu button: brings the user to the static `image` view. |
| `iris` | The main Advanced Camera Card `iris` menu button: brings the user to the default configured view (`view.default`), or collapses/expands the menu if the `menu.style` is `hidden` . |
@@ -80,66 +81,56 @@ This card supports several menu styles.
menu:
alignment: left
buttons:
iris:
priority: 50
enabled: true
alignment: matching
icon: iris
cameras:
priority: 50
enabled: true
alignment: matching
icon: mdi:video-switch
substreams:
priority: 50
enabled: true
alignment: matching
icon: mdi:video-input-component
live:
priority: 50
enabled: true
alignment: matching
icon: mdi:cctv
clips:
priority: 50
enabled: true
alignment: matching
icon: mdi:filmstrip
snapshots:
priority: 50
enabled: true
alignment: matching
icon: mdi:camera
image:
priority: 50
enabled: false
alignment: matching
icon: mdi:image
timeline:
priority: 50
enabled: true
alignment: matching
icon: mdi:chart-gantt
download:
priority: 50
enabled: true
alignment: matching
icon: mdi:download
camera_ui:
priority: 50
enabled: true
alignment: matching
icon: mdi:web
fullscreen:
cameras:
priority: 50
enabled: true
alignment: matching
icon: mdi:fullscreen
icon: mdi:video-switch
clips:
priority: 50
enabled: true
alignment: matching
icon: mdi:filmstrip
download:
priority: 50
enabled: true
alignment: matching
icon: mdi:download
expand:
priority: 50
enabled: true
alignment: matching
icon: mdi:arrow-expand-all
folders:
priority: 50
enabled: true
alignment: matching
icon: mdi:folder-multiple
fullscreen:
priority: 50
enabled: true
alignment: matching
icon: mdi:fullscreen
image:
priority: 50
enabled: false
alignment: matching
icon: mdi:image
iris:
priority: 50
enabled: true
alignment: matching
icon: iris
live:
priority: 50
enabled: true
alignment: matching
icon: mdi:cctv
media_player:
priority: 50
enabled: false
@@ -171,6 +162,21 @@ menu:
enabled: true
alignment: matching
icon: mdi:home
snapshots:
priority: 50
enabled: true
alignment: matching
icon: mdi:camera
substreams:
priority: 50
enabled: true
alignment: matching
icon: mdi:video-input-component
timeline:
priority: 50
enabled: true
alignment: matching
icon: mdi:chart-gantt
button_size: 40
position: top
style: hidden
+1
View File
@@ -142,6 +142,7 @@ This card supports several different views.
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `clip` | Shows a viewer for the most recent clip for this camera. Can also be accessed by holding down the `clips` menu icon. |
| `clips` | Shows a gallery of clips for this camera. |
| `folder` | Shows a gallery of media from a [`folder`](./folders.md). |
| `image` | Shows a static image specified by the `image` parameter, can be used as a discrete default view or a screensaver (via `view.interaction_seconds`). |
| `live` | Shows the live camera view with the configured [live provider](./cameras/live-provider.md). |
| `recording` | Shows a viewer for the most recent recording for this camera. Can also be accessed by holding down the `recordings` menu icon. |