Skip to content

Commit

Permalink
🧹 Install pre-commit and fixes lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bdsoha committed Aug 30, 2023
1 parent 0cb4fd9 commit e796724
Show file tree
Hide file tree
Showing 26 changed files with 200 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ WORKDIR /app
RUN apt-get update && apt-get install -y ffmpeg netcat-openbsd

COPY . .
RUN pip install .
RUN pip install .
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
Expand Down
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
max-line-length = 88
select = C,E,F,W,B,B950
ignore = E203,E501,W503
exclude = .git,__pycache__,venv,build,dist
exclude = .git,__pycache__,venv,build,dist
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug report
description: Create a bug report to help us improve
labels:
labels:
- "Type: Bug"
- "Status: Waiting triage"
body:
Expand All @@ -9,11 +9,11 @@ body:
value: |
# :warning: **Please read before raising the issue** :warning:
If you have a **question**, need clarification on something, need help on a particular situation or want to start a discussion, **DO NOT** open an issue here. _It will be automatically closed!_
Ask the question on one of our [Discord channels](https://discord.gg/Bxk9uGT6MW)
If you have a **question**, need clarification on something, need help on a particular situation or want to start a discussion, **DO NOT** open an issue here. _It will be automatically closed!_
Ask the question on one of our [Discord channels](https://discord.gg/Bxk9uGT6MW)
If you're not keen to Discord, you can also use [GitHub Discussions](https://github.com/keshavdv/unifi-cam-proxy/discussions).
If you realy want to raise an issue, please make sure to follow the template and provide the required information. Failing to do so will most likely end up on the issue being close. Don't take offense at this. It is simply a time management decision. Whenever an issue is raised without following the template and the required information is not provided, very often too much time has to be spent going back and forth to obtain the details that are outlined below.
If you really want to raise an issue, please make sure to follow the template and provide the required information. Failing to do so will most likely end up on the issue being close. Don't take offense at this. It is simply a time management decision. Whenever an issue is raised without following the template and the required information is not provided, very often too much time has to be spent going back and forth to obtain the details that are outlined below.
- type: input
id: camera_model
Expand Down Expand Up @@ -73,7 +73,7 @@ body:
- type: textarea
id: other_things
attributes:
label: Aditional information
label: Additional information
description: Other suggested things. If applicable/relevant.
placeholder: |
for example link to the repository with sample code
Expand All @@ -85,5 +85,5 @@ body:
attributes:
value: |
### Make an effort to fix the bug
Attempt to submit a [Pull Request (PR)](https://help.github.com/articles/about-pull-requests/) that fixes the bug. Include in this PR a test that verifies the fix. If you were not able to fix the bug, a PR that illustrates your partial progress will suffice.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Feature request
description: Suggest an idea to help us improve.
labels:
labels:
- "Type: Feature request"
- "Status: waiting feedback"
body:
Expand All @@ -9,12 +9,12 @@ body:
value: |
# :warning: **Please read before raising the issue** :warning:
If you have a **question**, need clarification on something, need help on a particular situation or want to start a discussion, **DO NOT** open an issue here. _It will be automatically closed!_
If you have a **question**, need clarification on something, need help on a particular situation or want to start a discussion, **DO NOT** open an issue here. _It will be automatically closed!_
Ask the question on one of our [Discord channels](https://discord.gg/Bxk9uGT6MW).
If you're not keen to Discord, you can also use [GitHub Discussions](https://github.com/keshavdv/unifi-cam-proxy/discussions).
If you realy want to raise an issue, please make sure to follow the template and provide the required information. Failing to do so will most likely end up on the issue being close. Don't take offense at this. It is simply a time management decision. Whenever an issue is raised without following the template and the required information is not provided, very often too much time has to be spent going back and forth to obtain the details that are outlined below.
If you really want to raise an issue, please make sure to follow the template and provide the required information. Failing to do so will most likely end up on the issue being close. Don't take offense at this. It is simply a time management decision. Whenever an issue is raised without following the template and the required information is not provided, very often too much time has to be spent going back and forth to obtain the details that are outlined below.
- type: textarea
id: description
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 🔵 Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache-dependency-path: ./docs/yarn.lock

- name: ⏬ Install Dependencies
run: yarn install --frozen-lockfile
working-directory: docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
8 changes: 8 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
default: true

# line-length
MD013:
line_length: 100
code_block_line_length: 120

MD041: false
38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
args:
- --skip=docs/yarn.lock

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
hooks:
- id: markdownlint-fix

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
[![unifi-cam-proxy Discord](https://img.shields.io/discord/937237037466124330?color=0559C9&label=Discord&logo=discord&logoColor=%23FFFFFF&style=for-the-badge)](https://discord.gg/Bxk9uGT6MW)

UniFi Camera Proxy
==================
# UniFi Camera Proxy

## About

This enables using non-Ubiquiti cameras within the UniFi Protect ecosystem. This is
particularly useful to use existing RTSP-enabled cameras in the same UI and
mobile app as your other Unifi devices.

Things that work:

* Live streaming
* Full-time recording
* Motion detection with certain cameras
* Smart Detections using [Frigate](https://github.com/blakeblackshear/frigate)

## Documentation

View the documentation at https://unifi-cam-proxy.com
View the documentation at <https://unifi-cam-proxy.com>

## Donations

Expand Down
File renamed without changes.
36 changes: 19 additions & 17 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,42 @@

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation
## Installation

```
$ yarn
```sh
yarn
```

### Local Development
## Local Development

```
$ yarn start
```sh
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
This command starts a local development server and opens up a browser window.
Most changes are reflected live without having to restart the server.

### Build
## Build

```
$ yarn build
```sh
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
This command generates static content in the `build` directory.
It can then be served using any static content hosting service.

### Deployment
## Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```sh
USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```sh
GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
If you're using GitHub pages, this command is a convenient way to build and push to the `gh-pages` branch.
3 changes: 1 addition & 2 deletions docs/docs/configuration/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"label": "Camera-Specific Configuration",
"position": 1
}

}
23 changes: 13 additions & 10 deletions docs/docs/configuration/amcrest.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ sidebar_position: 3

# Amcrest

### Options
```
## Options

```text
optional arguments:
--ffmpeg-args FFMPEG_ARGS, -f FFMPEG_ARGS
Transcoding args for `ffmpeg -i <src> <args> <dst>`
Expand All @@ -27,20 +28,22 @@ optional arguments:
VideoMotion event index
```

### Amcrest IP8M-T2599E
## Amcrest IP8M-T2599E

- [x] Supports full time recording
- [x] Supports motion events
- [ ] Supports smart detection
- Notes:
* Camera configuration:
* Video codec must be H.264 (H.265/HEVC is not supported).
* Audio codec should be AAC. If not, adjust the ffmpeg args to re-encode to AAC.
* Ensure the sub stream is enabled.
* If desired, ensure motion detection is enabled with the desired anti-dither and detection area.
* The `-bsf:v` parameter is needed to make live video work. The first `tick_rate` value should be `fps * 2000`. See [this comment](https://github.com/keshavdv/unifi-cam-proxy/issues/31#issuecomment-841914363).
- Camera configuration:
- Video codec must be H.264 (H.265/HEVC is not supported).
- Audio codec should be AAC. If not, adjust the ffmpeg args to re-encode to AAC.
- Ensure the sub stream is enabled.
- If desired, ensure motion detection is enabled with the desired anti-dither and detection area.
- The `-bsf:v` parameter is needed to make live video work.
The first `tick_rate` value should be `fps * 2000`.
See [this comment](https://github.com/keshavdv/unifi-cam-proxy/issues/31#issuecomment-841914363).

```
```sh
unifi-cam-proxy --mac '{unique MAC}' -H {NVR IP} -i {camera IP} -c /client.pem -t {Adoption token} \
amcrest \
-u {username} \
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/configuration/dahua.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ sidebar_position: 3

# Dahua/Lorex

### Options
```
## Options

```text
optional arguments:
--ffmpeg-args FFMPEG_ARGS, -f FFMPEG_ARGS
Transcoding args for `ffmpeg -i <src> <args> <dst>`
Expand All @@ -27,14 +28,13 @@ optional arguments:
VideoMotion event index
```


### Lorex LNB4321B

## Lorex LNB4321B

- [x] Supports full time recording
- [x] Supports motion events
- [ ] Supports smart detection
```

```sh
unifi-cam-proxy --mac '{unique MAC}' -H {NVR IP} -i {camera IP} -c /client.pem -t {Adoption token} \
dahua \
-u {username} \
Expand Down
15 changes: 6 additions & 9 deletions docs/docs/configuration/frigate.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,23 @@ sidebar_position: 2

# Frigate


If your camera model is not listed specifically below, try the following:

- [x] Supports full time recording
- [ ] Supports motion events
- [x] Supports smart detection


```
```sh
unifi-cam-proxy --mac '{unique MAC}' -H {NVR IP} -i {camera IP} -c /client.pem -t {Adoption token} \
frigate \
-s {rtsp source} \
--mqtt-host {mqtt host} \
--frigate-camera {Name of camera in frigate}
frigate \
-s {rtsp source} \
--mqtt-host {mqtt host} \
--frigate-camera {Name of camera in frigate}
```

## Options

```
```text
optional arguments:
--ffmpeg-args FFMPEG_ARGS, -f FFMPEG_ARGS
Transcoding args for `ffmpeg -i <src> <args> <dst>`
Expand All @@ -42,4 +40,3 @@ optional arguments:
--frigate-camera FRIGATE_CAMERA
Name of camera in frigate
```

Loading

0 comments on commit e796724

Please sign in to comment.