Skip to content

Commit

Permalink
Merge pull request #330 from bdsoha/feature/pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
keshavdv authored Sep 20, 2023
2 parents 0cb4fd9 + b2ee23c commit cc6d3fc
Show file tree
Hide file tree
Showing 28 changed files with 235 additions and 155 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
27 changes: 10 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths-ignore:
- docs/**
- .github/workflows/docs.yml

pull_request:
branches: [ main ]
paths-ignore:
Expand All @@ -16,31 +17,23 @@ on:
jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.9]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip virtualenv
virtualenv venv
source venv/bin/activate
pip install -e .[test]
- name: Lint with flake8
run: |
source venv/bin/activate
flake8 --show-source --statistics
- name: Check imports with isort
run: |
source venv/bin/activate
isort . --check-only --diff
- name: Run Pyre
run: |
source venv/bin/activate
pyre check
run: pip install -e .[test]

- name: Lint with pre-commit
run: pre-commit run --all-files
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
29 changes: 15 additions & 14 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: Build Docker image

on:
push:
branches: main
tags:
- v*

workflow_dispatch:

jobs:
buildx:
runs-on: ubuntu-latest

steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Prepare
- uses: actions/checkout@v3

- name: Prepare
id: prep
run: |
DOCKER_IMAGE=keshavdv/unifi-cam-proxy
Expand All @@ -33,21 +35,20 @@ jobs:
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
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
48 changes: 48 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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

- repo: local
hooks:
- id: pyre
name: pyre
entry: pyre check
pass_filenames: false
language: python
types:
- python
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
}

}
Loading

1 comment on commit cc6d3fc

@Mr-P-Butthole
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY for the addition of the character line limit. That was really making my head hurt. :)

Please sign in to comment.