Merge branch 'release-0.11.0' of https://github.com/blakeblackshear/frigate into reorder-hide-cameras

This commit is contained in:
Nick Mowen 2022-04-12 09:14:42 -06:00
commit cccbee1f85
9 changed files with 87 additions and 38 deletions

View File

@ -5,9 +5,9 @@ services:
user: vscode
# add groups from host for render, plugdev, video
group_add:
- 109 # render
- 44 # video
- 46 # plugdev
- "109" # render
- "44" # video
- "46" # plugdev
shm_size: "256mb"
build:
context: .

View File

@ -38,27 +38,11 @@ RUN apt-get -qq update \
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
&& python3 get-pip.py "pip"
RUN pip3 install scikit-build
COPY requirements.txt /requirements.txt
RUN pip3 install -r requirements.txt
# TODO: lock with requirements.txt
RUN pip3 wheel --wheel-dir=/wheels \
opencv-python-headless \
numpy \
imutils \
scipy \
psutil \
Flask \
paho-mqtt \
PyYAML \
matplotlib \
click \
setproctitle \
peewee \
peewee_migrate \
pydantic \
zeroconf \
ws4py \
requests
COPY requirements-wheels.txt /requirements-wheels.txt
RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt
# Frigate Container
FROM debian:11-slim

View File

@ -17,7 +17,8 @@ RUN groupadd --gid $USER_GID $USERNAME \
RUN apt-get update \
&& apt-get install -y git curl vim htop
RUN pip3 install pylint black
COPY requirements-dev.txt /opt/frigate/requirements-dev.txt
RUN pip3 install -r requirements-dev.txt
# Install Node 16
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - \

View File

@ -110,7 +110,8 @@ Sample response:
"service": {
/* Uptime in seconds */
"uptime": 10,
"version": "0.8.0-8883709",
"version": "0.10.1-8883709",
"latest_version": "0.10.1",
/* Storage data in MB for important locations */
"storage": {
"/media/frigate/clips": {

View File

@ -5,6 +5,7 @@ import time
import psutil
import shutil
import os
import requests
from frigate.config import FrigateConfig
from frigate.const import RECORD_DIR, CLIPS_DIR, CACHE_DIR
@ -13,11 +14,22 @@ from frigate.version import VERSION
logger = logging.getLogger(__name__)
def get_latest_version() -> str:
request = requests.get('https://api.github.com/repos/blakeblackshear/frigate/releases/latest')
response = request.json()
if request.ok and response:
return response.get("tag_name", "unknown").replace("v", "")
else:
return "unknown"
def stats_init(camera_metrics, detectors):
stats_tracking = {
"camera_metrics": camera_metrics,
"detectors": detectors,
"started": int(time.time()),
"latest_frigate_version": get_latest_version(),
}
return stats_tracking
@ -83,6 +95,7 @@ def stats_snapshot(stats_tracking):
stats["service"] = {
"uptime": (int(time.time()) - stats_tracking["started"]),
"version": VERSION,
"latest_version": stats_tracking["latest_frigate_version"],
"storage": {},
"temperatures": get_temperatures(),
}

2
requirements-dev.txt Normal file
View File

@ -0,0 +1,2 @@
pylint == 2.13.*
black == 22.3.*

17
requirements-wheels.txt Normal file
View File

@ -0,0 +1,17 @@
click == 8.1.*
Flask == 2.1.*
imutils == 0.5.*
matplotlib == 3.5.*
numpy == 1.22.*
opencv-python-headless == 4.5.5.*
paho-mqtt == 1.6.*
peewee == 3.14.*
peewee_migrate == 1.4.*
psutil == 5.9.*
pydantic == 1.9.*
PyYAML == 6.0.*
requests == 2.27.*
scipy == 1.8.*
setproctitle == 1.2.*
ws4py == 0.5.*
zeroconf == 0.38.4

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
scikit-build == 0.14.1

View File

@ -53,7 +53,12 @@ export default function Events({ path, ...props }) {
});
const [uploading, setUploading] = useState([]);
const [viewEvent, setViewEvent] = useState();
const [downloadEvent, setDownloadEvent] = useState({ id: null, has_clip: false, has_snapshot: false });
const [downloadEvent, setDownloadEvent] = useState({
id: null,
has_clip: false,
has_snapshot: false,
plus_id: undefined,
});
const eventsFetcher = useCallback((path, params) => {
params = { ...params, include_thumbnails: 0, limit: API_LIMIT };
@ -123,7 +128,12 @@ export default function Events({ path, ...props }) {
const onDownloadClick = (e, event) => {
e.stopPropagation();
setDownloadEvent((_prev) => ({ id: event.id, has_clip: event.has_clip, has_snapshot: event.has_snapshot }));
setDownloadEvent((_prev) => ({
id: event.id,
has_clip: event.has_clip,
has_snapshot: event.has_snapshot,
plus_id: event.plus_id,
}));
downloadButton.current = e.target;
setState({ ...state, showDownloadMenu: true });
};
@ -177,6 +187,10 @@ export default function Events({ path, ...props }) {
e.stopPropagation();
}
if (uploading.includes(id)) {
return;
}
if (!config.plus.enabled) {
setState({ ...state, showDownloadMenu: false, showPlusConfig: true });
return;
@ -202,6 +216,10 @@ export default function Events({ path, ...props }) {
}
setUploading((prev) => prev.filter((i) => i !== id));
if (state.showDownloadMenu && downloadEvent.id === id) {
setState({ ...state, showDownloadMenu: false });
}
};
if (!config) {
@ -278,11 +296,19 @@ export default function Events({ path, ...props }) {
{downloadEvent.has_snapshot && !downloadEvent.plus_id && (
<MenuItem
icon={UploadPlus}
label="Send to Frigate+"
label={uploading.includes(downloadEvent.id) ? 'Uploading...' : 'Send to Frigate+'}
value="plus"
onSelect={() => onSendToPlus(downloadEvent.id)}
/>
)}
{downloadEvent.plus_id && (
<MenuItem
icon={UploadPlus}
label={'Sent to Frigate+'}
value="plus"
onSelect={() => setState({ ...state, showDownloadMenu: false })}
/>
)}
</Menu>
)}
{state.showDatePicker && (
@ -398,6 +424,8 @@ export default function Events({ path, ...props }) {
</div>
</div>
<div class="hidden sm:flex flex-col justify-end mr-2">
{event.has_snapshot && (
<Fragment>
{event.plus_id ? (
<div className="uppercase text-xs">Sent to Frigate+</div>
) : (
@ -409,6 +437,8 @@ export default function Events({ path, ...props }) {
{uploading.includes(event.id) ? 'Uploading...' : 'Send to Frigate+'}
</Button>
)}
</Fragment>
)}
</div>
<div class="flex flex-col">
<Delete className="cursor-pointer" stroke="#f87171" onClick={(e) => onDelete(e, event.id)} />