Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support generic media library queries as events #884

Closed
skynet01 opened this issue Oct 26, 2022 · 3 comments
Closed

Support generic media library queries as events #884

skynet01 opened this issue Oct 26, 2022 · 3 comments

Comments

@skynet01
Copy link

Is your feature request related to a problem? Please describe.
I have a few cameras that are not part of Frigate and I am so thankful that I can use this amazing card to not only show a basic feed but utilize motion triggering and other bells and whistles. The only thing missing is events browsing.

Describe the solution you'd like
Most camera integrations map the camera events to the media library for example Onvif, Reolink etc. Or we can even set up mapping ourselves in HA to a remote drive.
The way it would work is when adding a none Frigate camera you can specify what folder to use in your media library. Then all the files will just show up as events using whatever gallery settings you are using from newest to oldest. Doing playback of clips would be great too, but if that's not possible it can take you to the media library where the clip is.

I think even a reduced functionality option where we just see thumbnails of events (or date and time if thumbs are not possible) would be great, then not having anything at all.

This way our dashboards for all our cameras stay consistent.

Describe alternatives you've considered
Point to a folder in HA if the media library is not accessible, for example, you just enter a path: /config/camera-footage/garage/

@dermotduffy dermotduffy changed the title Support to show events from other cameras if those events are mapped to media library already Supports generic media library queries as events Oct 26, 2022
@dermotduffy
Copy link
Owner

dermotduffy commented Oct 26, 2022

Thanks for the great suggestion @skynet01 . I'm keen to keep this card useful for non-Frigate cameras, so this fits. The timing is excellent for you to file this issue, as I'm actually in the middle of exploring #835 , and my chosen way to do that would make this feature much harder (i.e. moves in the opposite direction to what you propose). So let me think about this some more and either close this as something not supported, or change the direction I'm going in ...

PS: Here is what is extractable from the HA media browser interface:

  • Title (arbitrary text set by each integration)
  • Media type (e.g. video or image)
  • Thumbnail

... i.e. not date/time, camera name, or anything else that is probably useful. The way this could work is that the user would pass in a generic media_content_id (this is the internal identifier used to represent a media item or folder in the media browser) and the card would query that whenever it needs to show media associated with a camera.

@skynet01
Copy link
Author

skynet01 commented Oct 26, 2022

The way this could work is that the user would pass in a generic media_content_id (this is the internal identifier used to represent a media item or folder in the media browser) and the card would query that whenever it needs to show media associated with a camera.

This is EXACTLY how I would expect it to work. If there is no date that's not a big issue, in every integration that I've seen, and even if I mount a remote drive with camera clips/snapshots to the media folder the camera puts the timestamp of the video in the file name so just a title can be used. Obviously, we won't have the option to see a timeline or favorite a clip but that's completely ok.

Maybe have the option to limit the number of items to show so If someone has a ton of files it doesn't overload the card. Since we don't know how people have folders/naming setup it should probably do a recursive scan on whatever folder you select. Then just break out snapshots and clips like we already do for Frigate.

Most of the time users just want to glance to see if there was something of interest on that camera that happened within a day maybe a week max. Ex: "Did the mailman come? ... Let me check the door cam events really quick...". I don't think a small UI Lovelace card suppose to be a full-camera NVR management system .. ... at least not for none frigate cameras

Since I also have some Frigate cameras as well. The "average" home user at my house asks me... "how come I can see events on this camera but not on this other one... :) "

I really hope this gets added, as this will make this card completely universal :)

@skynet01 skynet01 changed the title Supports generic media library queries as events Support generic media library queries as events Oct 26, 2022
@dermotduffy dermotduffy added this to the v4.1 milestone Mar 1, 2023
@dermotduffy
Copy link
Owner

This feature is not implementable in the originally imagined form, for two reasons:

  • [Major] There is no consistent folder hierarchy for media, so even taking a content-id would require custom logic to navigate down from that point to the correct folder that matches the sought media type, start/end dates, etc. Workarounds such as recursively resolving all media would likely be major performance hits.
  • [Small] The content-ids used to browse clips are not visible (you need to dig them out of integration code).

In other words: There is no good generic solution to this problem.

So I went a different direction. After considerable work on refactoring the card (mostly in #908), ~all the Frigate logic is now confined to a single place behind a reasonably consistent API. This allows other camera types to sit behind that same API. This does require some custom code per integration to (as above) navigate the folder hierarchy correctly, but once that is done the support gives the appearance of being 'seamless' with Frigate cameras.

I've implemented richer support for MotionEye as a proof of concept of this scheme. It can show snapshots, clips, render things on a timeline, show thumbnails, download media, filter media, etc.

For now, I am going to close this bug, but I encourage people to open new issues requesting support for specific non-Frigate cameras that they would find useful. Those issues with the most support from people will filter to the top of the TODO list.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants