Commit Graph

176 Commits

Author SHA1 Message Date
Blake Blackshear
9fc93c72a0
more consistent use of iterators in select queries (#8258) 2023-10-21 10:53:33 -05:00
Blake Blackshear
c8b38bdd47
address codeql scan results (#8260) 2023-10-21 08:08:03 -05:00
Nicolas Mowen
1bdfc380c3
Delete timeline items along with event (#8192) 2023-10-17 06:37:07 -05:00
Blake Blackshear
4469507e5b
dont set has_clip to false unless the event is older (#8179) 2023-10-15 13:31:56 -05:00
tpjanssen
a82334ca1c
API enhancements (#8107) 2023-10-09 08:52:26 -05:00
tpjanssen
c47b02d2fe
Added filter option for min/max score for event to API function /events (#8079)
* Update api.md

* Update api.md

* Added filter option for min/max score for event to API function /events

* Added filter for submitted events

* Update http.py
2023-10-07 09:22:14 -05:00
Nicolas Mowen
79fabbb6b0
Fix recording snapshot time range (#8073)
* Fix recording snapshot time range

* Formatting

* Formatting
2023-10-07 09:16:12 -05:00
Nicolas Mowen
8941aa5311
Ensure deleted export file name is safe (#8089)
* Ensure deleted export file name is safe

* Fix import
2023-10-07 09:12:48 -05:00
Blake Blackshear
14d2b79c72
Security fixes (#8081)
* use safeloader

* use json responses wherever possible

* remove CORS and add CSRF token

* formatting fixes

* add envjs back

* fix baseurl test
2023-10-06 22:20:30 -05:00
Nicolas Mowen
1aba8c1ef5
Refactor time filter (#7962)
* Add ability to filter events by start time

* Add tests

* Add time param to events

* Add time picker

* Update docs

* Catch overnight case

Update comment

* Cleanup

* Fix tests
2023-09-27 06:09:38 -05:00
Nicolas Mowen
e5664826b1
Add ability to play and delete exports from webUI (#7882)
* add ability to playback exports on exports screen

* Add ability to delete exports from exports screen

* Fix large dialog

* Formatting
2023-09-21 05:20:57 -05:00
Nicolas Mowen
b9e6afa659
Fix webUI success / error messages (#7820)
* Fix export error handling

* Ensure that config editor success / error is updated each time

* Set response

* Formatting
2023-09-16 04:59:50 -05:00
Nicolas Mowen
a2206bb177
Reduce database queries to necessary fields (#7751)
* Reduce database queries to necessary labels

* Set columns for other queries

* skip creating model instances

---------

Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
2023-09-11 17:07:04 -05:00
Nicolas Mowen
db6ee41f3c
Improve error checking and handling for recordings export (#7647)
* Improve error checking and handling for recordings export

* Cleanup

* Remove order by
2023-09-02 05:42:33 -05:00
Martin Weinelt
d0b38f0a47
Reuse CACHE_DIR constant (#7306) 2023-07-29 13:19:21 -05:00
Nicolas Mowen
947ccbc654
Accept floats for export when used directly with event start / end time (#7314)
* Accept floats for export when used directly with event start / end time

* Formatting

* Formatting
2023-07-29 07:05:17 -05:00
Nicolas Mowen
d30a738960
Show status when mask is saved (#7212) 2023-07-21 07:30:22 -05:00
Nicolas Mowen
c5b8d13beb
Save audio scores and add audio filter config (#7185)
* Send and save score for external events

* Add audio filters config

* Fix access

* Add docs

* Cleanup
2023-07-17 06:07:15 -05:00
Sergey Krashevich
6ac36e8436
Fix: Add limit to event query (#7108)
* Add limit to event query for fetching latest event with specified label and camera name

* Refactor the label_thumbnail function in frigate/http.py to simplify the event_query logic and improve code readability
2023-07-14 06:30:47 -05:00
Nicolas Mowen
3a0c36e8db
Refactor ff queue size (#7116)
* Refactor queue size

* Only use enabled cameras

* Formatting
2023-07-14 06:29:11 -05:00
Nicolas Mowen
6adc810145
Sub label api score (#7113)
* Support setting sub label scores via API

* Update docs

* Update docs

* Formatting

* Throw error when score is outside expected bounds

* Fix / cleanup
2023-07-14 06:28:16 -05:00
Josh Hawkins
88fc0fac8f
Basic PTZ object autotracking functionality (#6913)
* Basic functionality

* Threaded motion estimator

* Revert "Threaded motion estimator"

This reverts commit 3171801607.

* Don't detect motion when ptz is moving

* fix motion logic

* fix mypy error

* Add threaded queue for movement for slower ptzs

* Move queues per camera

* Move autotracker start to app.py

* iou value for tracked object

* mqtt callback

* tracked object should be initially motionless

* only draw thicker box if autotracking is enabled

* Init if enabled when initially disabled in config

* Fix init

* Thread names

* Always use motion estimator

* docs

* clarify fov support

* remove size ratio

* use mp event instead of value for ptz status

* update autotrack at half fps

* fix merge conflict

* fix event type for mypy

* clean up

* Clean up

* remove unused code

* merge conflict fix

* docs: update link to object_detectors page

* Update docs/docs/configuration/autotracking.md

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>

* clarify wording

* pass actual instances directly

* default return preset

* fix type

* Error message when onvif init fails

* disable autotracking if onvif init fails

* disable autotracking if onvif init fails

* ptz module

* verify required_zones in config

* update util after dev merge

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-07-08 07:04:47 -05:00
Nicolas Mowen
69630e7385
Fix incorrect respnses (#7066) 2023-07-07 07:06:42 -05:00
Sergey Krashevich
f48dd8c1ab
Feature: camera debug/config enhancements (#6920)
* Add functionality to update YAML config file with PUT request in HTTP endpoint

* Refactor copying of text to clipboard with Clipboard API and fallback to document.execCommand('copy') in CameraMap.jsx file

* Update YAML file from URL query parameters in frigate/http.py and add functionality to save motion masks, zones, and object masks in CameraMap.jsx

* formatting

* fix merging fuckup

* Refactor camera zone coordinate saving to use single query parameter per zone in CameraMap.jsx

* remove unnecessary print statements in util.py

* Refactor update_yaml_file function to separate the logic for updating YAML data into a new function update_yaml().

* fix merge errors

* Refactor code to improve error handling and add dependencies to useEffect hooks
2023-07-06 13:54:26 -05:00
Sergey Krashevich
cbb77e5794
Bugfix: SqliteQueueDatabase instead of SqliteDatabase and retry_interval for fetching latest frame in http.py (#7059)
* Refactor http.py to use SqliteQueueDatabase instead of SqliteDatabase and add retry interval for fetching latest frame

* isort && black
2023-07-06 13:50:22 -05:00
Nicolas Mowen
baf671b764
Cleanup and organize utils (#7033)
* Force birdseye cameras into standard aspect ratios

* Organize utils

* Update tests

* Formatting

* Isort

* Fix tests

* Cleanup

* isort
2023-07-06 09:28:50 -05:00
Nicolas Mowen
58c6ef1e12
Add designator when events are from the api (#6997)
* Add designator when events are custom

* Add type field and set via API
2023-07-03 09:48:00 -05:00
Nicolas Mowen
c3b313a70d
Audio events (#6848)
* Initial audio classification model implementation

* fix mypy

* Keep audio labelmap local

* Cleanup

* Start adding config for audio

* Add the detector

* Add audio detection process keypoints

* Build out base config

* Load labelmap correctly

* Fix config bugs

* Start audio process

* Fix startup issues

* Try to cleanup restarting

* Add ffmpeg input args

* Get audio detection working

* Save event to db

* End events if not heard for 30 seconds

* Use not heard config

* Stop ffmpeg when shutting down

* Fixes

* End events correctly

* Use api instead of event queue to save audio events

* Get events working

* Close threads when stop event is sent

* remove unused

* Only start audio process if at least one camera is enabled

* Add const for float

* Cleanup labelmap

* Add audio icon in frontend

* Add ability to toggle audio with mqtt

* Set initial audio value

* Fix audio enabling

* Close logpipe

* Isort

* Formatting

* Fix web tests

* Fix web tests

* Handle cases where args are a string

* Remove log

* Cleanup process close

* Use correct field

* Simplify if statement

* Use var for localhost

* Add audio detectors docs

* Add restream docs to mention audio detection

* Add full config docs

* Fix links to other docs

---------

Co-authored-by: Jason Hunter <hunterjm@gmail.com>
2023-07-01 08:18:33 -05:00
Nicolas Mowen
f3f9b36e07
Fix bad check on np.array (#6968) 2023-06-30 07:06:38 -06:00
Nicolas Mowen
0a8249d6fb
Fix Bad Resize For Camera Snapshot (#6797)
* Catch cases where incorrect size is requested

* Set a default if calculated height is incorrect
2023-06-30 07:34:10 -05:00
Nicolas Mowen
ece070fee1
Load labels dynamically for event filters (#6896)
* Load labels dynamically to include custom events and audio, do not include attribute labels

* Formatting

* Fix sorting

* Also filter tracked object list on camera page

* isort

* Don't fail before load
2023-06-28 05:51:53 -05:00
Nicolas Mowen
435d152423
Fix bug introduced in new linter (#6754)
* Fix bug introduced in new linter

* Ignore this error

* Fix more

* Ignore boolean error too
2023-06-11 07:18:47 -05:00
Nicolas Mowen
d3949eebfa
Add API and WebUI to export recordings (#6550)
* Add ability to export frigate clips

* Add http endpoint

* Add dir to nginx

* Add webUI

* Formatting

* Cleanup unused

* Optimize timelapse

* Fix pts

* Use JSON body for params

* Use hwaccel to encode when available

* Print ffmpeg command when fail

* Print ffmpeg command when fail

* Add separate ffmpeg preset for timelapse

* Add docs outlining the export directory

* Add export docs

* Use ''

* Fix playlist max time

* Lower max playlist time

* Add api docs for export

* isort fixes
2023-06-08 07:32:35 -04:00
Nicolas Mowen
62f36b221e
Remove ffmpeg banner (#6600)
* Hide banner in maintainer

* Hide banner in event download
2023-06-01 05:46:34 -05:00
Martin Weinelt
ab50d0b006
Add isort and ruff linter (#6575)
* Add isort and ruff linter

Both linters are pretty common among modern python code bases.

The isort tool provides stable sorting and grouping, as well as pruning
of unused imports.

Ruff is a modern linter, that is very fast due to being written in rust.
It can detect many common issues in a python codebase.

Removes the pylint dev requirement, since ruff replaces it.

* treewide: fix issues detected by ruff

* treewide: fix bare except clauses

* .devcontainer: Set up isort

* treewide: optimize imports

* treewide: apply black

* treewide: make regex patterns raw strings

This is necessary for escape sequences to be properly recognized.
2023-05-29 05:31:17 -05:00
Nicolas Mowen
4940826011
Fix false positives (#6544) 2023-05-19 13:26:19 -06:00
Nicolas Mowen
fec1dd3f46
Fix breakages by manual_event_api branch (#6542)
* Fix breakages by manual_event_api branch

* More fixes
2023-05-19 10:59:24 -06:00
Blake Blackshear
42f3ee3de5 sync master 2023-05-19 05:47:49 -05:00
Nicolas Mowen
e357715a8c
Ability to manually create events through the API (#3184)
* Move to events package

* Improve handling of external events

* Handle external events in the event queue

* Pass in event processor

* Check event json

* Fix json parsing and change defaults

* Fix snapshot saving

* Hide % score when not available

* Correct docs and add json example

* Save event png db

* Adjust image

* Formatting

* Add catch for failure ending event

* Add init to modules

* Fix naming

* Formatting

* Fix http creation

* fix test

* Change to PUT and include response in docs

* Add ability to set bounding box locations in snapshot

* Support multiple box annotations

* Cleanup docs example response

Co-authored-by: Blake Blackshear <blake@frigate.video>

* Cleanup docs wording

Co-authored-by: Blake Blackshear <blake@frigate.video>

* Store full frame for thumbnail

* Formatting

* Set thumbnail height to 175

* Formatting

---------

Co-authored-by: Blake Blackshear <blake@frigate.video>
2023-05-19 05:16:11 -05:00
Sergey Krashevich
03b45c153b
Increase maximum event sub_label length to 100 characters (#6350)
* Increase maximum sub label length to 100 characters and update corresponding fields in models and API

* black format...
2023-05-04 17:59:44 -05:00
Blake Blackshear
19890310fe
Bug fixes (#6332)
* fix timeline delete

* fix labelmap in config response

* create cache dirs if needed
2023-04-30 14:58:39 -05:00
Blake Blackshear
9bf98f908d
add plus integration for models (#6328) 2023-04-30 13:32:36 -05:00
Nicolas Mowen
ad52e238ce
Refactor events to be more generic (#6320)
* Organize event table to be more generalized

* Add appropriate fields to data

* Move tracked object logic to own function

* Add source type to event queue

* rename enum

* Fix types that are used in webUI

* remove redundant

* Formatting

* fix typing

* Rename enum
2023-04-30 12:07:14 -05:00
Nicolas Mowen
43ade86796
Support Controlling PTZ Cameras Via WebUI (#4715)
* Add support for ptz commands via websocket

* Fix startup issues

* Fix bugs

* Set config manually

* Add more commands

* Add presets

* Add zooming

* Fixes

* Set name

* Cleanup

* Add ability to set presets from UI

* Add ability to set preset from UI

* Cleanup for errors

* Ui tweaks

* Add visual design for pan / tilt

* Add pan/tilt support

* Support zooming

* Try to set wsdl

* Fix duplicate logs

* Catch auth errors

* Don't init onvif for disabled cameras

* Fix layout sizing

* Don't comment out

* Fix formatting

* Add ability to control camera with keyboard shortcuts

* Disallow user selection

* Fix mobile pressing

* Remove logs

* Substitute onvif password

* Add ptz controls ot birdseye

* Put wsdl back

* Add padding

* Formatting

* Catch onvif error

* Optimize layout for mobile and web

* Place ptz controls next to birdseye view in large layout

* Fix pt support

* Center text titles

* Update tests

* Update docs

* Write camera docs for PTZ

* Add MQTT docs for PTZ

* Add ptz info docs for http

* Fix test

* Make half width when full screen

* Fix preset panel logic

* Fix parsing

* Update mqtt.md

* Catch preset error

* Add onvif example to docs

* Remove template example from main camera docs
2023-04-26 06:08:53 -05:00
Blake Blackshear
0d16bd0144
False positives (#6217)
* add false positive submission

* switch timeline events to x,y,w,h

* update docs

* fix type checks

* convert to upsert

* fix config test
2023-04-24 07:24:28 -05:00
Nicolas Mowen
fbaab71d78
Metadata Timeline (#6194)
* Create timeline table

* Fix indexes

* Add other fields

* Adjust schema to be less descriptive

* Handle timeline queue from tracked object data

* Setup timeline queue in events

* Add source id for index

* Add other fields

* Fixes

* Formatting

* Store better data

* Add api with filtering

* Setup basic UI for timeline in events

* Cleanups

* Add recordings snapshot url

* Start working on timeline ui

* Add tooltip with info

* Improve icons

* Fix start time with clip

* Move player logic back to clips

* Make box in timeline relative coordinates

* Make region relative

* Get box overlay working

* Remove overlay when playing again

* Add disclaimer when selecting overlay points

* Add docs for new apis

* Fix mobile

* Fix docs

* Change color of bottom center box

* Fix vscode formatting
2023-04-23 10:45:19 -05:00
Nicolas Mowen
3b62ff093a
Ensure the frigate config validators are also checked when saving config (#6069) 2023-04-15 07:24:13 -05:00
Dermot Duffy
e8d8cc4f55
Return sub_labels in event summary information. (#5642) 2023-03-05 11:39:41 -06:00
Nicolas Mowen
17c26c9fa9
Sub label filter fixes (#5602)
* Fix list access issue

* Specifically include item when in list or individual only

* Formatting

* Sort sub labels to ensure consistent list
2023-03-03 17:43:27 -06:00
Nicolas Mowen
34bdf2fc10
Clean up output for vainfo and ffprobe (#5586)
* Clean up output for vainfo and ffprobe

* Fix cleanup

* Format vainfo display

* Fix ffprobe output

* Fix stringification

* remove unused
2023-02-26 07:05:27 -06:00