Showing preview only (3,845K chars total). Download the full file or copy to clipboard to get everything.
Repository: motioneye-project/motioneye
Branch: main
Commit: 358fb6df047a
Files: 232
Total size: 3.6 MB
Directory structure:
gitextract_q2e7vtjm/
├── .github/
│ ├── dependabot.yaml
│ └── workflows/
│ ├── docker.yml
│ ├── pre-commit-autoupdate.yml
│ ├── pre-commit.yml
│ ├── pypi_release.yml
│ ├── python_safety.yml
│ ├── shellcheck.yml
│ ├── test_python.yml
│ ├── ubuntu_build.yml
│ └── update_locales.yml
├── .gitignore
├── .pre-commit-config.yaml
├── AUTHORS
├── LICENSE
├── Makefile
├── README.md
├── docker/
│ ├── Dockerfile
│ ├── README.md
│ ├── docker-compose.override.yml
│ ├── docker-compose.yml
│ ├── entrypoint.sh
│ └── motioneye-docker.conf
├── l10n/
│ ├── babel.cfg
│ ├── po2json
│ ├── traduki_js.txt
│ ├── traduki_po.sh
│ ├── traduki_python.txt
│ ├── traduko.sh
│ └── v4l2.js
├── motioneye/
│ ├── .gitignore
│ ├── __init__.py
│ ├── cleanup.py
│ ├── config.py
│ ├── controls/
│ │ ├── __init__.py
│ │ ├── diskctl.py
│ │ ├── mmalctl.py
│ │ ├── powerctl.py
│ │ ├── smbctl.py
│ │ ├── tzctl.py
│ │ ├── v4l2ctl.py
│ │ └── wifictl.py
│ ├── extra/
│ │ ├── linux_init
│ │ ├── motioneye.conf.sample
│ │ ├── motioneye.systemd
│ │ └── motioneye.sysv
│ ├── handlers/
│ │ ├── __init__.py
│ │ ├── action.py
│ │ ├── base.py
│ │ ├── config.py
│ │ ├── log.py
│ │ ├── login.py
│ │ ├── main.py
│ │ ├── movie.py
│ │ ├── movie_playback.py
│ │ ├── picture.py
│ │ ├── power.py
│ │ ├── prefs.py
│ │ ├── relay_event.py
│ │ ├── update.py
│ │ └── version.py
│ ├── locale/
│ │ ├── ar/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── bn/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ca/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── cs/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── da/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── de/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── el/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── en/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── es/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── fi/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── fr/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── hi/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── hu/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── it/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ja/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ko/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ms/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── nb_NO/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ne/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── nl/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── pa/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── pl/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── pt/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ro/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ru/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── sk/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── sv/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ta/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── tr/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── uk/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ └── zh/
│ │ └── LC_MESSAGES/
│ │ ├── motioneye.js.po
│ │ ├── motioneye.mo
│ │ └── motioneye.po
│ ├── mediafiles.py
│ ├── meyectl.py
│ ├── mjpgclient.py
│ ├── monitor.py
│ ├── motionctl.py
│ ├── motioneye_init.py
│ ├── prefs.py
│ ├── remote.py
│ ├── scripts/
│ │ ├── migrateconf.sh
│ │ └── relayevent.sh
│ ├── sendmail.py
│ ├── sendtelegram.py
│ ├── server.py
│ ├── settings.py
│ ├── shell.py
│ ├── static/
│ │ ├── css/
│ │ │ ├── frame.css
│ │ │ ├── main.css
│ │ │ └── ui.css
│ │ └── js/
│ │ ├── frame.js
│ │ ├── main.js
│ │ ├── motioneye.ar.json
│ │ ├── motioneye.bn.json
│ │ ├── motioneye.ca.json
│ │ ├── motioneye.cs.json
│ │ ├── motioneye.da.json
│ │ ├── motioneye.de.json
│ │ ├── motioneye.el.json
│ │ ├── motioneye.en.json
│ │ ├── motioneye.es.json
│ │ ├── motioneye.fi.json
│ │ ├── motioneye.fr.json
│ │ ├── motioneye.hi.json
│ │ ├── motioneye.hu.json
│ │ ├── motioneye.it.json
│ │ ├── motioneye.ja.json
│ │ ├── motioneye.ko.json
│ │ ├── motioneye.ms.json
│ │ ├── motioneye.nb_NO.json
│ │ ├── motioneye.ne.json
│ │ ├── motioneye.nl.json
│ │ ├── motioneye.pa.json
│ │ ├── motioneye.pl.json
│ │ ├── motioneye.pt.json
│ │ ├── motioneye.ro.json
│ │ ├── motioneye.ru.json
│ │ ├── motioneye.sk.json
│ │ ├── motioneye.sv.json
│ │ ├── motioneye.ta.json
│ │ ├── motioneye.tr.json
│ │ ├── motioneye.uk.json
│ │ ├── motioneye.zh.json
│ │ ├── ui.js
│ │ └── version.js
│ ├── tasks.py
│ ├── template.py
│ ├── templates/
│ │ ├── base.html
│ │ ├── main.html
│ │ ├── manifest.json
│ │ └── version.html
│ ├── update.py
│ ├── uploadservices.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── dtconv.py
│ │ ├── http.py
│ │ ├── mjpeg.py
│ │ ├── rtmp.py
│ │ └── rtsp.py
│ ├── webhook.py
│ └── wsswitch.py
├── pyproject.toml
└── tests/
├── __init__.py
├── test_handlers/
│ ├── __init__.py
│ ├── test_base.py
│ └── test_login.py
├── test_mediafiles.py
└── test_utils/
├── __init__.py
├── test_http.py
├── test_mjpeg.py
└── test_rtmp.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/dependabot.yaml
================================================
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
# Workflow files stored in the default location of `.github/workflows`
directory: "/"
schedule:
interval: "daily"
target-branch: "dev"
labels:
- "CI/CD"
================================================
FILE: .github/workflows/docker.yml
================================================
name: Docker
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
docker:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- uses: docker/metadata-action@v5
id: meta
with:
images: |
motioneyeproject/motioneye
ghcr.io/${{ github.repository_owner }}/motioneye
tags: |
type=edge,branch=dev
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- uses: docker/setup-qemu-action@v3
with:
cache-image: false
- uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.event_name == 'push' && github.repository == 'motioneye-project/motioneye' && steps.meta.outputs.tags != null
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name == 'push' && github.repository == 'motioneye-project/motioneye' && steps.meta.outputs.tags != null
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/build-push-action@v6
with:
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/riscv64
push: ${{ github.event_name == 'push' && github.repository == 'motioneye-project/motioneye' && steps.meta.outputs.tags != null }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
================================================
FILE: .github/workflows/pre-commit-autoupdate.yml
================================================
name: pre-commit-autoupdate
on:
workflow_dispatch:
schedule:
- cron: 42 15 * * *
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
pre-commit-autoupdate:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
ref: dev
# https://github.com/peter-evans/create-pull-request/issues/48
token: ${{ secrets.GH_PAT }}
- uses: actions/setup-python@v6
with:
python-version: 3.x
check-latest: true
- run: |
branch_exists=0
git fetch origin pre-commit-autoupdate && branch_exists=1
if (( branch_exists ))
then
git switch pre-commit-autoupdate
else
git checkout -b pre-commit-autoupdate
fi
pip install pre-commit
pre-commit --version
pre-commit autoupdate
git diff --exit-code && exit 0
git add -A
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
if (( branch_exists ))
then
git commit --amend --no-edit
git push -f origin pre-commit-autoupdate
else
git commit -m '[CI/CD] pre-commit autoupdate'
git push origin pre-commit-autoupdate
export GH_TOKEN='${{ secrets.GH_PAT }}'
gh pr create -B dev -H pre-commit-autoupdate -f -l 'CI/CD'
fi
================================================
FILE: .github/workflows/pre-commit.yml
================================================
# https://pre-commit.com
# This GitHub Action assumes that the repo contains a valid .pre-commit-config.yaml file.
name: pre-commit
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
pre-commit:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
check-latest: true
- run: |
pip install pre-commit
pre-commit --version
pre-commit run --all-files --show-diff-on-failure
================================================
FILE: .github/workflows/pypi_release.yml
================================================
name: PyPI release
on: workflow_dispatch
permissions:
contents: read
jobs:
release:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
check-latest: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade build twine
- name: Build package
run: python -m build
- name: Publish package
#run: twine upload -r testpypi -u '__token__' -p '${{ secrets.TEST_PYPI_API_TOKEN }}' dist/*
run: twine upload -r pypi -u '__token__' -p '${{ secrets.PYPI_TOKEN }}' dist/*
================================================
FILE: .github/workflows/python_safety.yml
================================================
name: python_safety
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
python_safety:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
runs-on: ubuntu-24.04
steps:
- run: echo -e '[global]\nbreak-system-packages=true' | sudo tee /etc/pip.conf # error: externally-managed-environment
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.x
check-latest: true
- run: pip install --upgrade pip setuptools
- run: pip install safety .
# Ignore CVE-2018-20225, which is IMO reasonably disputed: https://data.safetycli.com/v/67599/97c/
# "extra"-index-url means an index to "additionally" look for newer versions, pre-compiled wheels, or similar, not to force this index being used.
# There is "index-url" to enforce a different index: https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-i
# Ignore CVE-2019-8341 as well: https://github.com/pyupio/safety/issues/527
- run: safety check --ignore 67599,70612
================================================
FILE: .github/workflows/shellcheck.yml
================================================
name: shellcheck
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
shellcheck:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
runs-on: ubuntu-24.04
steps:
- name: Install xz-utils
run: |
command -v xz && exit 0
sudo apt-get -q update
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq --no-install-recommends install xz-utils
- uses: actions/checkout@v6
- name: Download shellcheck
run: |
curl -sSfLo shellcheck.tar.xz "$(curl -sSfH 'Authorization: Bearer ${{ github.token }}' 'https://api.github.com/repos/koalaman/shellcheck/releases/latest' | mawk -F\" '/"browser_download_url.*\.linux\.x86_64\.tar\.xz"/{print $4;exit}')"
tar --wildcards --strip-components=1 -xf shellcheck.tar.xz '*/shellcheck'
rm shellcheck.tar.xz
- name: Run shellcheck
run: |
mapfile -t FILES < <(find . -not \( -path './.git' -prune \) -type f) # read all files to array
for i in "${!FILES[@]}"
do
[[ ${FILES[$i]##*/} =~ '.'[^.]*'sh'$ ]] && continue # file has shell extension
[[ $(mawk '/^#!.*sh([[:blank:]]|$)/;{exit}' "${FILES[$i]}") ]] && continue # file has shell shebang
unset -v "FILES[$i]" # else remove from array
done
./shellcheck -xC -o all -e SC2244,SC2250,SC2312 "${FILES[@]}"
================================================
FILE: .github/workflows/test_python.yml
================================================
name: test_python
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
strategy:
matrix:
include:
# https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=python3
- { dist: 'ubuntu-22.04', python: '3.10.6' }
- { dist: 'ubuntu-24.04', python: '3.12.3' }
- { dist: 'ubuntu-22.04-arm', python: '3.10.6' }
- { dist: 'ubuntu-24.04-arm', python: '3.12.3' }
fail-fast: false
runs-on: ${{ matrix.dist }}
name: "Test on ${{ matrix.dist }}"
steps:
- name: Ubuntu Noble workarounds
if: matrix.dist == 'ubuntu-24.04' || matrix.dist == 'ubuntu-24.04-arm'
run: |
# error: externally-managed-environment
echo -e '[global]\nbreak-system-packages=true' | sudo tee /etc/pip.conf
# ERROR: Cannot uninstall pip 24.0, RECORD file not found. Hint: The package was installed by debian.
- run: sudo DEBIAN_FRONTEND="noninteractive" apt-get -qq autopurge python3-pip python3-setuptools python3-wheel
- run: sudo apt-get -q update
- run: sudo DEBIAN_FRONTEND="noninteractive" apt-get -qq --no-install-recommends install curl ffmpeg motion v4l-utils
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- run: python3 -m pip install --upgrade pip setuptools wheel
- run: python3 -m pip install --upgrade build mypy pytest
- run: python3 -m build
- run: python3 -m pip install .
- run: mkdir --parents --verbose .mypy_cache
- run: mypy --ignore-missing-imports --install-types --non-interactive --exclude build/ . || true
- run: pytest --ignore=tests/test_utils/test_mjpeg.py
--ignore=tests/test_utils/test_rtmp.py . || true
- run: pytest --fixtures tests/test_utils/test_mjpeg.py || true
- run: pytest --fixtures tests/test_utils/test_rtmp.py || true
- run: pytest . || pytest --doctest-modules . || true
================================================
FILE: .github/workflows/ubuntu_build.yml
================================================
name: ubuntu_build
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
build:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
strategy:
matrix:
dist: ['ubuntu-22.04', 'ubuntu-24.04', 'ubuntu-22.04-arm', 'ubuntu-24.04-arm']
fail-fast: false
runs-on: ${{ matrix.dist }}
name: "Test on ${{ matrix.dist }}"
steps:
- name: Ubuntu Noble workarounds
if: matrix.dist == 'ubuntu-24.04' || matrix.dist == 'ubuntu-24.04-arm'
run: |
# error: externally-managed-environment
echo -e '[global]\nbreak-system-packages=true' | sudo tee /etc/pip.conf
# ERROR: Cannot uninstall pip 24.0, RECORD file not found. Hint: The package was installed by debian.
- run: sudo DEBIAN_FRONTEND="noninteractive" apt-get -qq autopurge python3-pip python3-setuptools python3-wheel python3-dev
- run: sudo apt-get -q update
- run: sudo DEBIAN_FRONTEND=noninteractive apt-get -qq --no-install-recommends install ca-certificates curl python3
- run: curl -sSfO 'https://bootstrap.pypa.io/get-pip.py'
- run: sudo python3 get-pip.py
- run: sudo python3 -m pip install --upgrade pip setuptools wheel
- run: |
REPO=$GITHUB_REPOSITORY BRANCH=$GITHUB_REF_NAME
[ ${{ github.event_name }} = 'pull_request' ] && REPO=${{ github.event.pull_request.head.repo.full_name }} BRANCH=${{ github.event.pull_request.head.ref }}
sudo python3 -m pip install "https://github.com/$REPO/archive/$BRANCH.tar.gz"
- run: sudo motioneye_init --skip-apt-update
- run: i=0; until ss -tln | grep 8765; do [ $i -le 10 ] || exit 0; sleep 1; i=$(expr $i + 1); done
- run: sudo systemctl status motioneye
- run: sudo systemctl is-active motioneye
================================================
FILE: .github/workflows/update_locales.yml
================================================
name: update_locales
on: pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
update_locales:
# Skip for forks which have no access to secrets (PAT)
if: github.event.pull_request.head.repo.fork == false
runs-on: ubuntu-24.04
steps:
- uses: actions/setup-python@v6
with:
python-version: '3.x'
check-latest: true
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install --upgrade babel jinja2
sudo apt-get -q update
sudo DEBIAN_FRONTEND='noninteractive' apt-get -qq --no-install-recommends install gettext
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
# https://github.com/peter-evans/create-pull-request/issues/48
token: ${{ secrets.GH_PAT }}
- name: Generate backend template
run: |
pybabel extract --no-wrap -F l10n/babel.cfg -o motioneye/locale/motioneye.pot motioneye/
# Remove python-format flag, and trailing empty line to satisfy pre-commit
sed -i -e '/^#, python-format$/d' -e '${/^$/d}' motioneye/locale/motioneye.pot
- name: Generate frontend template
run: xgettext --no-wrap --from-code=UTF-8 -o motioneye/locale/motioneye.js.pot motioneye/static/js/*.js l10n/*.js
- name: Generate frontend locales
run: |
rm motioneye/static/js/motioneye.*.json
for i in motioneye/locale/*/LC_MESSAGES/motioneye.js.po
do
lang=${i#motioneye/locale/}
lang=${lang%/LC_MESSAGES/motioneye.js.po}
echo "Generating motioneye.$lang.json"
l10n/po2json "$i" "motioneye/static/js/motioneye.$lang.json"
done
- name: Cleanup backend locales
run: |
for i in motioneye/locale/*/LC_MESSAGES/motioneye.mo
do
[ -f "${i%mo}po" ] || rm "$i"
done
- name: Commit changes
run: |
git add -A
git diff -I '^"POT-Creation-Date: ' --exit-code HEAD && exit 0
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git commit -m 'Update translation files'
git push
================================================
FILE: .gitignore
================================================
*.log
*.py[cod]
__pycache__
*.bak
*.pid
*.pot
*.po~
*.old
toto*
.project
.pydevproject
.settings
.idea
run
build
dist
dropbox.keys
.venv
_traduko.jar
.DS_Store
*.egg-info
================================================
FILE: .pre-commit-config.yaml
================================================
# Learn more about this config here: https://pre-commit.com/
# To enable these pre-commit hook run:
# `brew install pre-commit` or `python3 -m pip install pre-commit`
# Then in the project root directory run `pre-commit install`
# default_language_version:
# python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-builtin-literals
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/PyCQA/bandit
rev: 1.9.2
hooks:
- id: bandit
args:
- --skip=B104,B105,B108,B110,B301,B310,B321,B324,B402,B403,B404,B602,B603,B604,B605,B607,B701
- repo: https://github.com/python/black
rev: 25.12.0
hooks:
- id: black
args: [--skip-string-normalization]
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
# See args in setup.cfg
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
hooks:
- id: flake8
# Skipped plugins which are currently not used by "--select": flake8-return, which does not support Python 3.14 yet: https://github.com/afonasev/flake8-return/pull/139
additional_dependencies: [flake8-2020, flake8-bugbear, flake8-comprehensions]
args:
- --builtins=_
- --count
- --max-complexity=68
- --max-line-length=125
- --select=C901,E501,E9,F63,F7,F82
- --show-source
- --statistics
- repo: https://github.com/timothycrosley/isort
rev: 7.0.0
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
args: [--py37-plus]
================================================
FILE: AUTHORS
================================================
A list with contributors can be found here: https://github.com/motioneye-project/motioneye/graphs/contributors
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
================================================
FILE: Makefile
================================================
all: motioneye/locale/*/LC_MESSAGES/motioneye.mo motioneye/static/js/motioneye.*.json
%.mo: %.po
msgfmt -f $*.po -o $*.mo
%/motioneye.po: motioneye/locale/motioneye.pot
msgmerge --no-wrap -N -U $@ $<
# Disable Google Translator usage for now, which does rarely work from GitHub CI due to rate limiting.
# Also Weblate supports auto-translation from various sources as well.
#l10n/traduki_po.sh $@
motioneye/static/js/motioneye.%.json: motioneye/locale/%/LC_MESSAGES/motioneye.js.po
l10n/po2json motioneye/locale/$*/LC_MESSAGES/motioneye.js.po motioneye/static/js/motioneye.$*.json
%/motioneye.js.po: motioneye/locale/motioneye.js.pot
msgmerge --no-wrap -N -U $@ $<
# Disable Google Translator usage for now, which does rarely work from GitHub CI due to rate limiting.
# Also Weblate supports auto-translation from various sources as well.
#l10n/traduki_po.sh $@
motioneye/locale/motioneye.js.pot: motioneye/static/js/*.js l10n/*.js
xgettext --no-wrap --from-code=UTF-8 -o motioneye/locale/motioneye.js.pot motioneye/static/js/*.js l10n/*.js
motioneye/locale/motioneye.pot: motioneye/*.py motioneye/*/*.py motioneye/templates/*.html
pybabel extract -F l10n/babel.cfg -o motioneye/locale/motioneye.pot motioneye/
# Remove trailing empty line to satisfy pre-commit
sed -i '$${/^$$/d}' motioneye/locale/motioneye.pot
#####
# regulo por krei novan tradukon
# ekz. : uzi "make initro" por krei la rumana traduko.
#####
init%:
mkdir motioneye/locale/$*
mkdir motioneye/locale/$*/LC_MESSAGES
msginit --no-wrap -i motioneye/locale/motioneye.js.pot -o motioneye/locale/$*.js.tmp -l$* --no-translator
#l10n/traduki_po.sh motioneye/locale/$*.js.tmp
mv motioneye/locale/$*.js.tmp motioneye/locale/$*/LC_MESSAGES/motioneye.js.po
make motioneye/static/js/motioneye.$*.json
msginit --no-wrap -i motioneye/locale/motioneye.pot -o motioneye/locale/$*.tmp -l$* --no-translator
#l10n/traduki_po.sh motioneye/locale/$*.tmp
mv motioneye/locale/$*.tmp motioneye/locale/$*/LC_MESSAGES/motioneye.po
make motioneye/locale/$*/LC_MESSAGES/motioneye.mo
#msgattrib --no-wrap --set-fuzzy --clear-obsolete locale/$*.tmp -o locale/$*/LC_MESSAGES/motioneye.po
traduki:
find motioneye/locale -name "*.po" -exec l10n/traduki_po.sh {} \;
================================================
FILE: README.md
================================================
# What is motionEye?
**motionEye** is an online interface for the software [_motion_](https://motion-project.github.io/), a video surveillance program with motion detection.
Check out the [__wiki__](https://github.com/motioneye-project/motioneye/wiki) for more details. Changelog is available on the [__releases page__](https://github.com/motioneye-project/motioneye/releases).
From version 0.43, **motionEye** is multilingual:
| [<br>](https://hosted.weblate.org/engage/motioneye-project/) |
| -: |
You can contribute to translations on [__Weblate__](https://hosted.weblate.org/projects/motioneye-project).
# Installation
1. Install **Python 3.7 or later** and build dependencies
_Here the commands for APT-based Linux distributions are given._
Thanks to pre-compiled wheels from PyPI, installing motionEye usually does not require anything but Python 3 and cURL with the ability to do HTTPS network requests:
```sh
sudo apt update
sudo apt --no-install-recommends install ca-certificates curl python3
```
On **ARMv6/ARMv7 (32-bit), RISC-V, and other rare CPU architectures** additional build dependencies may be required to compile the [Pillow](https://pypi.org/project/pillow/) and [PycURL](https://pypi.org/project/pycurl/) modules:
```sh
sudo apt --no-install-recommends install python3-dev gcc libjpeg62-turbo-dev libcurl4-openssl-dev libssl-dev
```
2. Install the Python package manager `pip`
```sh
curl -sSfO 'https://bootstrap.pypa.io/get-pip.py'
sudo python3 get-pip.py
rm get-pip.py
```
**On recent distro versions, like Debian 12/Bookworm, Ubuntu 23.04/Lunar, and later**, the `libpython3.*-stdlib` package ships a file `/usr/lib/python3.*/EXTERNALLY-MANAGED`, which prevents the installation of Python modules outside of `venv` environments.
motionEye however has a small number of dependencies with no strict version requirements and hence is very unlikely to break any Python package you might have installed via APT. To bypass this block, add `break-system-packages=true` to the `[global]` section of your `pip.conf`:
```sh
grep -q '\[global\]' /etc/pip.conf 2> /dev/null || printf '%b' '[global]\n' | sudo tee -a /etc/pip.conf > /dev/null
sudo sed -i '/^\[global\]/a\break-system-packages=true' /etc/pip.conf
```
3. Install and setup **motionEye**
```sh
sudo python3 -m pip install motioneye
sudo motioneye_init
```
_NB: `motioneye_init` currently assumes either an APT- or RPM-based distribution with `systemd` as init system. For a manual setup, config and service files can be found here: <https://github.com/motioneye-project/motioneye/tree/dev/motioneye/extra>_
4. Access the web interface
After having successfully followed the installation instructions, the motionEye server should be running on your system and listening on port **8765**. Fire up your favorite web browser and visit the following URL (replacing `[your_ip]` with... well, your system's IP address):
```
http://[your_ip]:8765/
```
Use usernamme _admin_ with empty password when prompted for credentials. For security, __please do set up a proper password for the admin user__, at least if you plan to make your motionEye installation accessible from the Internet.
# Upgrade
When upgrading motionEye, remember to restart the service. To rule out any mix of old in-memory backend code with new frontend assets, it is recommended to stop it prior to the upgrade, and start it back up afterwards:
```sh
sudo systemctl stop motioneye
sudo python3 -m pip install --upgrade motioneye
sudo systemctl start motioneye
```
# Pre-releases
We may push beta versions to PyPI to give upcoming releases some testing period. Those can be installed with `pip`'s `--pre` flag:
```sh
sudo systemctl stop motioneye
sudo python3 -m pip install --upgrade --pre motioneye
sudo systemctl start motioneye
```
If you want to test a recent commit on our development branch:
```sh
sudo systemctl stop motioneye
sudo python3 -m pip install --upgrade 'https://github.com/motioneye-project/motioneye/archive/dev.tar.gz'
sudo systemctl start motioneye
```
================================================
FILE: docker/Dockerfile
================================================
FROM debian:trixie-slim
LABEL maintainer="Marcus Klein <himself@kleini.org>"
# By default, run as root
ARG RUN_UID=0
ARG RUN_GID=0
COPY . /tmp/motioneye
COPY docker/entrypoint.sh /entrypoint.sh
# Build deps:
# - armhf/riscv64: Python headers, C compiler and libjpeg for Pillow: https://pypi.org/project/pillow/#files, libcurl and libssl for pycurl: https://pypi.org/project/pycurl/#files
RUN printf '%b' '[global]\nbreak-system-packages=true\n' > /etc/pip.conf && \
case "$(dpkg --print-architecture)" in \
'armhf'|'riscv64') PACKAGES='python3-dev gcc libjpeg62-turbo-dev libcurl4-openssl-dev libssl-dev';; \
*) PACKAGES='';; \
esac && \
apt-get -q update && \
DEBIAN_FRONTEND="noninteractive" apt-get -qq --option Dpkg::Options::="--force-confnew" --no-install-recommends install \
ca-certificates curl python3 fdisk $PACKAGES && \
curl -sSfO 'https://bootstrap.pypa.io/get-pip.py' && \
python3 get-pip.py && \
python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
python3 -m pip install --no-cache-dir /tmp/motioneye && \
motioneye_init --skip-systemd --skip-apt-update && \
# Change uid/gid of user/group motion to match our desired IDs. This will
# make it easier to use execute motion as our desired user later.
sed -i "s/^\(motion:[^:]*\):[0-9]*:[0-9]*:\(.*\)/\1:${RUN_UID}:${RUN_GID}:\2/" /etc/passwd && \
sed -i "s/^\(motion:[^:]*\):[0-9]*:\(.*\)/\1:${RUN_GID}:\2/" /etc/group && \
mv /etc/motioneye/motioneye.conf /etc/motioneye.conf.sample && \
mkdir /var/log/motioneye /var/lib/motioneye && \
chown motion:motion /var/log/motioneye /var/lib/motioneye && \
# Cleanup
python3 -m pip uninstall -y pip setuptools wheel && \
DEBIAN_FRONTEND="noninteractive" apt-get -qq autopurge $PACKAGES && \
apt-get clean && \
rm -r /var/lib/apt/lists /var/cache/apt /tmp/motioneye get-pip.py /root/.cache
# R/W needed for motionEye to update configurations
VOLUME /etc/motioneye
# Video & images
VOLUME /var/lib/motioneye
EXPOSE 8765
ENTRYPOINT ["/entrypoint.sh"]
================================================
FILE: docker/README.md
================================================
# Docker instructions
## Running from the official images
The easiest way to run motionEye under docker is to use the official images.
The command below will run motionEye and preserve your configuration and videos
across motionEye restarts.
```bash
docker pull ccrisan/motioneye:master-amd64
docker run \
--rm \
-d \
-p 8765:8765 \
--hostname="motioneye" \
-v /etc/localtime:/etc/localtime:ro \
-v /data/motioneye/config:/etc/motioneye \
-v /data/motioneye/videos:/var/lib/motioneye \
ccrisan/motioneye:master-amd64
```
This configuration maps motionEye configs into the `/data/motioneye/config`
directory on the host. Videos will be saved under `/data/motioneye/videos`.
Change the directories to suit your particular needs and make sure those
directories exist on the host before you start the container.
Some may prefer to use docker volumes instead of mapped directories on the
host. You can easily accomplish this by using the commands below:
```bash
docker volume create motioneye-config
docker volume create motioneye-videos
docker pull ccrisan/motioneye:master-amd64
docker run \
--rm \
-d \
-p 8765:8765 \
--hostname="motioneye" =
-v /etc/localtime:/etc/localtime:ro \
--mount type=volume,source=motioneye-config,destination=/etc/motioneye \
--mount type=volume,source=motioneye-videos,destination=/var/lib/motioneye \
ccrisan/motioneye:master-amd64
```
Use `docker volume ls` to view existing volumes.
## Building your own image
It's also possible to build your own motionEye docker image. This allows the
use of UIDs other than root for the `motion` and `meyectl` daemons (the default
on official images). If you want to use a non-privileged user/group for
motionEye, *please make sure that user/group exist on the host* before running
the commands below.
For the examples below, we assume user `motion` and group `motion` exist on the host server.
```bash
RUN_USER="motion"
RUN_UID=$(id -u ${RUN_USER})
RUN_GID=$(id -g ${RUN_USER})
TIMESTAMP="$(date '+%Y%m%d-%H%M')"
cd /tmp && \
git clone https://github.com/motioneye-project/motioneye.git && \
cd motioneye && \
docker build \
--network host \
--build-arg="RUN_UID=${RUN_UID?}" \
--build-arg="RUN_GID=${RUN_GID?}" \
-t "${USER?}/motioneye:${TIMESTAMP}" \
--no-cache \
-f docker/Dockerfile .
```
This will create a local image called `your_username/motioneye:YYYYMMDD-HHMM`.
You can run this image using the examples under "Running official images", but
omitting the `docker pull` command and replacing
`ccrisan/motioneye:master-amd64` with the name of the local image you just built.
================================================
FILE: docker/docker-compose.override.yml
================================================
version: "3.5"
services:
motioneye:
restart: unless-stopped
image: ghcr.io/motioneye-project/motioneye:edge # https://github.com/motioneye-project/motioneye/pkgs/container/motioneye
devices:
- "/dev/video0:/dev/video0"
- "/dev/video1:/dev/video1"
volumes:
- /etc/localtime:/etc/localtime:ro
================================================
FILE: docker/docker-compose.yml
================================================
---
version: "3.5"
services:
motioneye:
# ToDo: Change from unstable dev/edge to stable GitHub registry release and Docker registry release, once available
image: ghcr.io/motioneye-project/motioneye:edge # https://github.com/motioneye-project/motioneye/pkgs/container/motioneye
ports:
- "8081:8081"
- "8765:8765"
volumes:
- etc_motioneye:/etc/motioneye
- var_lib_motioneye:/var/lib/motioneye
volumes:
etc_motioneye:
var_lib_motioneye:
================================================
FILE: docker/entrypoint.sh
================================================
#!/usr/bin/env sh
# We need to chown at startup time since volumes are mounted as root. This is fugly.
mkdir -p /run/motioneye
chown motion:motion /run/motioneye
[ -f '/etc/motioneye/motioneye.conf' ] || cp -a /etc/motioneye.conf.sample /etc/motioneye/motioneye.conf
exec su -g motion motion -s /bin/dash -c "LANGUAGE=en exec /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf"
================================================
FILE: docker/motioneye-docker.conf
================================================
description "motionEye Server in Docker container"
author "Marcus Klein <himself@kleini.org>"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
script
/usr/bin/docker stop motioneye || true
/usr/bin/docker rm motioneye || true
docker run --name=motioneye \
-p 8081:8081 \
-p 8765:8765 \
-h server \
-e TZ="Europe/Berlin" \
-v /docker/motioneye:/etc/motioneye \
-v /var/lib/motioneye:/var/lib/motioneye \
--restart=always \
kleini/motioneye:docker
end script
pre-stop script
if docker ps | grep -q motioneye
then
docker stop motioneye
docker rm motioneye
fi
end script
================================================
FILE: l10n/babel.cfg
================================================
[python: **.py]
[jinja2: **/templates/**.html]
================================================
FILE: l10n/po2json
================================================
#!/usr/bin/env sh
FICIN=$1
FICOUT=$2
awk '{
if (CONTMSG==1 && substr($1,1,1) != "\"")
{
CONTMSG=0;
}
if (CONTMSG2==1 && substr($1,1,1) != "\"")
{
CONTMSG2=0;
if (MSGID != "\"\"")
print("," MSGID ":" MSGSTR);
}
if (substr($1,2,9) == "Language:")
{
print("{\"\":{\"language\":\"" substr($2,1,2) "\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}");
}
else if ($1 == "msgid")
{
MSGID=substr($0,7);
if (MSGID=="\"\"")
CONTMSG=1;
}
else if (MSGID != "\"\"" && $1 == "msgstr")
{
MSGSTR=substr($0,7);
if (MSGSTR=="\"\"")
CONTMSG2=1;
else
print("," MSGID ":" MSGSTR);
}
else if (CONTMSG==1 && substr($1,1,1) == "\"")
{
MSGID=MSGID $0;
}
else if (CONTMSG2==1 && substr($1,1,1) == "\"")
{
MSGSTR=MSGSTR $0;
}
else
{
CONTMSG=0;
CONTMSG2=0;
}
}
END {
print ("}");
}' "$FICIN" > "$FICOUT"
================================================
FILE: l10n/traduki_js.txt
================================================
Ni uzas por ĉiu lingvo json-dosieron, kiu enhavas la tradukojn.
Ni ŝarĝas ĉi tiun dosieron en "templates/main.html":
<script type="text/javascript" src="{{static_path}}js/gettext.min.js"></script>
<script type="text/javascript">
function Get(yourUrl){
var Httpreq = new XMLHttpRequest(); // a new request
Httpreq.open("GET",yourUrl,false);
Httpreq.send(null);
return Httpreq.responseText;
}
var i18n = window.i18n();
var i18njson=Get("{{static_path}}js/motioneye.{{lingvo}}.json");
i18n.loadJSON(i18njson, 'messages');
i18n.setLocale('{{lingvo}}');
</script>
Kaj ni uzas la funkcion i18n.gettext donitan de gettext.min.js por traduki, ekz. :
return i18n.gettext("Ĉi tiu kampo estas deviga");
La dosiero "pot" estas ĝisdatigita per la komando xgettext, ekz. :
xgettext --from-code=UTF-8 --no-wrap -o motioneye/locale/motioneye.js.pot static/js/*.js
La dosiero "po" estas ĝisdatigita per la komando msgmerge, ekz. :
msgmerge --no-wrap -N -U motioneye/locale/en/LC_MESSAGES/motioneye.js.po motioneye/locale/motioneye.js.pot
Tradukoj povas esti ĝisdatigitaj per teksta redaktilo aŭ per poedit.
La dosiero "json" estas ĝisdatigita per la komando scripts/po2json, ekz. :
l10n/po2json motioneye/locale/en/LC_MESSAGES/motioneye.js.po motioneye/static/js/motioneye.en.json
La dosiero "Makefile" permesas aŭtomate administri xgettext, msgmerge kaj po2json. Simple enigu "make" post modifi dosieron "js" aŭ "po".
"Makefile" havas regulo "init%" por krei novan tradukon
ekz. : uzi "make initro" por krei la rumana traduko.
================================================
FILE: l10n/traduki_po.sh
================================================
#!/usr/bin/env sh
#################################################################
# skripto por aŭtomate traduki frazojn sen traduko en po-dosieron
#################################################################
src=eo
#FIC=locale/en/LC_MESSAGES/motioneye.po
FIC=$1
dst=$(grep '^"Language: .*\n"$' "$FIC" | sed 's/^"Language: //;s/.n"$//')
awk -v "src=$src" -v "dst=$dst" '{
if (CONTMSG==1 && substr($1,1,1) != "\"")
{
CONTMSG=0;
}
if ($1 == "msgid")
{
MSGID=substr($0,7);
if (MSGID=="\"\"")
CONTMSG=1;
}
else if (CONTMSG==1 && substr($1,1,1) == "\"")
{
MSGID = substr(MSGID,1,length(MSGID)-1) substr($0,2);
}
else if ($1 == "msgstr")
{
if ($2 != "\"\"" || MSGID == "\"\"")
{
print ("msgid " MSGID);
print $0;
}
else
{
getline nextline
if (nextline == "")
{
print ("msgid " MSGID);
printf("msgstr \"");
MSG=system("l10n/traduko.sh " src " " dst " " MSGID)
printf("\"\n\n");
}
else
{
print ("msgid " MSGID);
print $0;
print nextline;
}
}
}
else
print $0;
}' "$FIC" > "$FIC.$$"
mv "$FIC" "$FIC.old"
mv "$FIC.$$" "$FIC"
# Remove trailing empty line, to satisfy pre-commit
sed -i '${/^$/d}' "$FIC"
================================================
FILE: l10n/traduki_python.txt
================================================
Objektivo: havi python-fonton en utf-8 kun multlingva gettext-administrado.
la unua aŭ dua linio de .py devas enhavi: «coding: utf-8» aŭ «encoding: utf-8», ekz. :
# This Python file uses the following encoding: utf-8
kordoj enhavantaj specialajn signojn devas esti prefiksitaj per «u», ekz. :
logging.fatal( _(u'bonvolu instali tornado version 3.1 aŭ pli') )
================================================
FILE: l10n/traduko.sh
================================================
#!/usr/bin/env sh
################################################################
# skripto por aŭtomate traduki frazon
################################################################
#DEBUG=
src=$1
dst=$2
txt=$3
# Reuse cookie if not older than 15 minutes
cookie=$(find . -maxdepth 1 -name _traduko.jar -mmin -14)
# Obtain cookie
[ "$cookie" ] || curl -sSfc _traduko.jar -A 'Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0' 'https://translate.google.com' -o /dev/null > /dev/null
# Obtain translation from Google Translator API
MSG0=$(curl -sSfb _traduko.jar -A 'Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0' \
--refer 'https://translate.google.com/' \
"https://translate.google.com/translate_a/single?client=webapp&sl=${src}&tl=${dst}&hl=${dst}&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=gt&pc=1&otf=1&ssel=0&tsel=0&kc=1&tk=&ie=UTF-8&oe=UTF-8" \
--data-urlencode "q=$txt" \
)
[ "$DEBUG" ] && printf '%s\n' "$src txt=$txt" >&2
if printf '%s' "$MSG0" | grep -q 'sorry'
then
# Failed: Print error
printf '%s\n%s\n' 'ERROR: Google Translator returned "sorry":' "$MSG0" >&2
else
# Success: Extract translated txt
MSG=$(printf '%s' "$MSG0" | jq '.[0][][0]' | grep -v '^null$' \
| sed "s/\\\\u003d/=/g;s/\\\\u003c/</g;s/\\\\u003e/>/g" \
| sed "s/\\\\u200b//g" \
| sed "s/\xe2\x80\x8b//g" \
| sed "s/^\"//;s/\"$//" \
| tr -d "\n" \
| sed "s/\\\ [nN]/n/g;s/] (/](/g;s/ __ / __/g" \
| sed "s/\. \\\n$/. \\\n/" \
)
fi
[ "$DEBUG" ] && printf '%s\n' "$dst txt=$MSG" >&2
# Reset cookie if no message returned
if [ "$MSG" ]
then
printf '%s' "$MSG"
else
printf '%s\n' 'ERROR: Google Translator did not return a translation' >&2
rm -f _traduko.jar
fi
================================================
FILE: l10n/v4l2.js
================================================
/* fake file to allow translation of v4l2-ctl output */
/* non exhaustive list of possible controls */
i18n.gettext("Auto Exposure");
i18n.gettext("Backlight Compensation");
i18n.gettext("Brightness");
i18n.gettext("Contrast");
i18n.gettext("Exposure Absolute");
i18n.gettext("Exposure Auto");
i18n.gettext("Exposure Auto Priority");
i18n.gettext("Exposure Time Absolute");
i18n.gettext("Focus Absolute");
i18n.gettext("Focus Auto");
i18n.gettext("Gain");
i18n.gettext("Gamma");
i18n.gettext("Hue");
i18n.gettext("Led1 Mode");
i18n.gettext("Led1 Frequency");
i18n.gettext("Pan Absolute");
i18n.gettext("Power Line Frequency");
i18n.gettext("Saturation");
i18n.gettext("Sharpness");
i18n.gettext("Tilt Absolute");
i18n.gettext("White Balance Temperature");
i18n.gettext("White Balance Temperature Auto");
i18n.gettext("Zoom Absolute");
================================================
FILE: motioneye/.gitignore
================================================
traduko.jar
================================================
FILE: motioneye/__init__.py
================================================
VERSION = "0.43.1"
================================================
FILE: motioneye/cleanup.py
================================================
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
import logging
import multiprocessing
import os
import signal
from tornado.ioloop import IOLoop
from motioneye import mediafiles, settings
_process = None
def start():
if not settings.CLEANUP_INTERVAL:
return
# schedule the first call a bit later to improve performance at startup
io_loop = IOLoop.current()
io_loop.add_timeout(
datetime.timedelta(seconds=min(settings.CLEANUP_INTERVAL, 60)), _run_process
)
def stop():
global _process
if not running():
_process = None
return
if _process.is_alive():
_process.join(timeout=10)
if _process.is_alive():
logging.error('cleanup process did not finish in time, killing it...')
os.kill(_process.pid, signal.SIGKILL)
_process = None
def running():
return _process is not None and _process.is_alive()
def _run_process():
global _process
io_loop = IOLoop.current()
# schedule the next call
io_loop.add_timeout(
datetime.timedelta(seconds=settings.CLEANUP_INTERVAL), _run_process
)
if not running(): # check that the previous process has finished
logging.debug('running cleanup process...')
_process = multiprocessing.Process(target=_do_cleanup)
_process.start()
def _do_cleanup():
# this will be executed in a separate subprocess
# ignore the terminate and interrupt signals in this subprocess
signal.signal(signal.SIGINT, signal.SIG_IGN)
signal.signal(signal.SIGTERM, signal.SIG_IGN)
try:
mediafiles.cleanup_media('picture')
mediafiles.cleanup_media('movie')
logging.debug('cleanup done')
except Exception as e:
logging.error(f'failed to cleanup media files: {str(e)}', exc_info=True)
================================================
FILE: motioneye/config.py
================================================
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import collections
import datetime
import glob
import hashlib
import logging
import os.path
import subprocess
from errno import EEXIST, ENOENT
from re import match, sub
from shlex import split
from urllib.parse import urlunparse
from tornado.ioloop import IOLoop
from motioneye import meyectl, motionctl, settings, tasks, uploadservices, utils
from motioneye.controls import diskctl, smbctl, v4l2ctl
from motioneye.controls.powerctl import PowerControl
_CAMERA_CONFIG_FILE_NAME = 'camera-%(id)s.conf'
_MAIN_CONFIG_FILE_NAME = 'motion.conf'
_ACTIONS = [
'lock',
'unlock',
'light_on',
'light_off',
'alarm_on',
'alarm_off',
'up',
'right',
'down',
'left',
'zoom_in',
'zoom_out',
'preset1',
'preset2',
'preset3',
'preset4',
'preset5',
'preset6',
'preset7',
'preset8',
'preset9',
]
_main_config_cache = None
_camera_config_cache = {}
_camera_ids_cache = None
_additional_section_funcs = []
_additional_config_funcs = []
_additional_structure_cache = {}
_monitor_command_cache = {}
_USED_MOTION_OPTIONS = {
'auto_brightness',
'despeckle_filter',
'camera_name',
'emulate_motion',
'event_gap',
'framerate',
'height',
'lightswitch_percent',
'locate_motion_mode',
'locate_motion_style',
'mask_file',
'mask_privacy',
'movie_codec',
'movie_filename',
'movie_max_time',
'movie_output_motion',
'movie_output',
'movie_quality',
'movie_passthrough',
'minimum_motion_frames',
'mmalcam_name',
'netcam_keepalive',
'netcam_tolerant_check',
'netcam_url',
'netcam_use_tcp',
'netcam_userpass',
'noise_level',
'noise_tune',
'on_event_end',
'on_event_start',
'on_movie_end',
'on_picture_save',
'picture_filename',
'picture_output_motion',
'picture_output',
'picture_quality',
'post_capture',
'pre_capture',
'rotate',
'smart_mask_speed',
'snapshot_filename',
'snapshot_interval',
'stream_authentication',
'stream_auth_method',
'stream_localhost',
'stream_maxrate',
'stream_motion',
'stream_port',
'stream_quality',
'target_dir',
'text_changes',
'text_scale',
'text_left',
'text_right',
'threshold',
'threshold_maximum',
'threshold_tune',
'videodevice',
'vid_control_params',
'webcontrol_interface',
'webcontrol_localhost',
'webcontrol_parms',
'webcontrol_port',
'width',
}
def text_double(v, data):
return {'text_scale': [1, 2][v]}
def webcontrol_html_output(v, data):
return {'webcontrol_interface': int(v)}
def text_scale(v, data):
return {'text_double': True if int(v) > 1 else False}
def webcontrol_interface(v, data):
return {'webcontrol_html_output': bool(v)}
_MOTION_41_TO_43_OPTIONS_MAPPING = {
'ffmpeg_video_codec': 'movie_codec',
'ffmpeg_output_movies': 'movie_output',
'ffmpeg_output_debug_movies': 'movie_output_motion',
'ffmpeg_variable_bitrate': 'movie_quality',
'lightswitch': 'lightswitch_percent',
'max_movie_time': 'movie_max_time',
'output_pictures': 'picture_output',
'output_debug_pictures': 'picture_output_motion',
'quality': 'picture_quality',
'rtsp_uses_tcp': 'netcam_use_tcp',
'text_double': text_double,
'webcontrol_html_output': webcontrol_html_output,
}
_MOTION_43_TO_41_OPTIONS_MAPPING = {
'movie_codec': 'ffmpeg_video_codec',
'movie_output': 'ffmpeg_output_movies',
'movie_output_motion': 'ffmpeg_output_debug_movies',
'movie_quality': 'ffmpeg_variable_bitrate',
'lightswitch_percent': 'lightswitch',
'movie_max_time': 'max_movie_time',
'picture_output': 'output_pictures',
'picture_output_motion': 'output_debug_pictures',
'picture_quality': 'quality',
'netcam_use_tcp': 'rtsp_uses_tcp',
'text_scale': text_scale,
'webcontrol_interface': webcontrol_interface,
# motion pre-v4.1
'webcontrol_parms': None,
}
def netcam_keepalive_params(v, data):
# value can be 'force' as well
v = 'on' if v == True else 'off' if v == False else v
if 'netcam_params' in data and data['netcam_params']:
return {'netcam_params': data['netcam_params'] + ',keepalive = ' + v}
return {'netcam_params': 'keepalive = ' + v}
def netcam_tolerant_check_params(v, data):
v = 'on' if v else 'off'
if 'netcam_params' in data and data['netcam_params']:
return {'netcam_params': data['netcam_params'] + ',tolerant_check = ' + v}
return {'netcam_params': 'tolerant_check = ' + v}
def netcam_use_tcp_params(v, data):
v = 'tcp' if v else 'udp'
if 'netcam_params' in data and data['netcam_params']:
return {'netcam_params': data['netcam_params'] + ',rtsp_transport = ' + v}
return {'netcam_params': 'rtsp_transport = ' + v}
def netcam_params(v, data):
params = {}
for param in v.split(','):
param = [x.strip() for x in param.split('=')]
if param[0] == 'keepalive':
params['netcam_keepalive'] = param[1]
elif param[0] == 'tolerant_check':
params['netcam_tolerant_check'] = param[1]
elif param[0] == 'rtsp_transport':
if param[1] == 'udp':
params['netcam_use_tcp'] = False
else:
params['netcam_use_tcp'] = True
return params
_MOTION_43_TO_44_OPTIONS_MAPPING = {
'netcam_keepalive': netcam_keepalive_params,
'netcam_tolerant_check': netcam_tolerant_check_params,
'netcam_use_tcp': netcam_use_tcp_params,
'vid_control_params': 'video_params',
'videodevice': 'video_device',
}
_MOTION_44_TO_43_OPTIONS_MAPPING = {
'netcam_params': netcam_params,
'video_params': 'vid_control_params',
'video_device': 'videodevice',
}
def adapt_config_directives(data, mapping):
for name in list(data.keys()):
mapped = mapping.get(name)
if mapped is None:
continue
value = data.pop(name)
if callable(mapped):
data.update(mapped(value, data))
else: # assuming simple new name
data[mapped] = value
def additional_section(func):
_additional_section_funcs.append(func)
def additional_config(func):
_additional_config_funcs.append(func)
def get_main(as_lines=False):
global _main_config_cache
if not as_lines and _main_config_cache is not None:
return _main_config_cache
config_file_path = os.path.join(settings.CONF_PATH, _MAIN_CONFIG_FILE_NAME)
logging.debug(f'reading main config from file {config_file_path}...')
lines = None
try:
f = open(config_file_path)
except OSError as e:
if e.errno == ENOENT: # file does not exist
logging.info(
f'main config file {config_file_path} does not exist, using default values'
)
lines = []
f = None
else:
logging.error(f'could not open main config file {config_file_path}: {e}')
raise
if lines is None and f:
try:
lines = [line[:-1] for line in f.readlines()]
except Exception as e:
logging.error(f'could not read main config file {config_file_path}: {e}')
raise
finally:
f.close()
if as_lines:
return lines
main_config = _conf_to_dict(
lines,
list_names=['camera'],
no_convert=[
'@admin_username',
'@admin_password',
'@normal_username',
'@normal_password',
],
)
# adapt directives for motion versions < 4.2 and > 4.3
adapt_config_directives(main_config, _MOTION_41_TO_43_OPTIONS_MAPPING)
adapt_config_directives(main_config, _MOTION_44_TO_43_OPTIONS_MAPPING)
_get_additional_config(main_config)
_set_default_motion(main_config)
_main_config_cache = main_config
return main_config
def set_main(main_config):
global _main_config_cache
main_config = dict(main_config)
for n, v in list(_main_config_cache.items()):
main_config.setdefault(n, v)
_main_config_cache = main_config
main_config = dict(main_config)
_set_additional_config(main_config)
# adapt directives for motion versions < 4.2 and > 4.3
if motionctl.is_motion_pre42():
adapt_config_directives(main_config, _MOTION_43_TO_41_OPTIONS_MAPPING)
elif motionctl.is_motion_post43():
adapt_config_directives(main_config, _MOTION_43_TO_44_OPTIONS_MAPPING)
config_file_path = os.path.join(settings.CONF_PATH, _MAIN_CONFIG_FILE_NAME)
# read the actual configuration from file
lines = get_main(as_lines=True)
# write the configuration to file
logging.debug(f'writing main config to {config_file_path}...')
try:
f = open(config_file_path, 'w')
except Exception as e:
logging.error(
f'could not open main config file {config_file_path} for writing: {e}'
)
raise
lines = _dict_to_conf(lines, main_config, list_names=['camera'])
try:
f.writelines([utils.make_str(line) + '\n' for line in lines])
except Exception as e:
logging.error(f'could not write main config file {config_file_path}: {e}')
raise
finally:
f.close()
def get_camera_ids(filter_valid=True):
global _camera_ids_cache
if _camera_ids_cache is not None:
return _camera_ids_cache
config_path = settings.CONF_PATH
logging.debug(f'listing config dir {config_path}...')
try:
ls = os.listdir(config_path)
except Exception as e:
logging.error(f'failed to list config dir {config_path}: {e}')
raise
camera_ids = []
pattern = '^' + _CAMERA_CONFIG_FILE_NAME.replace('%(id)s', r'(\d+)') + '$'
for name in ls:
_match = match(pattern, name)
if _match:
camera_id = int(_match.groups()[0])
logging.debug(f'found camera with id {camera_id}')
camera_ids.append(camera_id)
camera_ids.sort()
if not filter_valid:
return camera_ids
filtered_camera_ids = []
for camera_id in camera_ids:
if get_camera(camera_id):
filtered_camera_ids.append(camera_id)
_camera_ids_cache = filtered_camera_ids
return filtered_camera_ids
def get_enabled_local_motion_cameras():
if not get_main().get('@enabled'):
return []
camera_ids = get_camera_ids()
cameras = [get_camera(camera_id) for camera_id in camera_ids]
return [c for c in cameras if c.get('@enabled') and utils.is_local_motion_camera(c)]
def get_network_shares():
if not get_main().get('@enabled'):
return []
camera_ids = get_camera_ids()
cameras = [get_camera(camera_id) for camera_id in camera_ids]
mounts = []
for camera in cameras:
if camera.get('@storage_device') != 'network-share':
continue
mounts.append(
{
'server': camera['@network_server'],
'share': camera['@network_share_name'],
'smb_ver': camera['@network_smb_ver'],
'username': camera['@network_username'],
'password': camera['@network_password'],
}
)
return mounts
def get_camera(camera_id, as_lines=False):
if not as_lines and camera_id in _camera_config_cache:
return _camera_config_cache[camera_id]
camera_config_path = os.path.join(settings.CONF_PATH, _CAMERA_CONFIG_FILE_NAME) % {
'id': camera_id
}
logging.debug(f'reading camera config from {camera_config_path}...')
try:
f = open(camera_config_path)
except Exception as e:
logging.error(f'could not open camera config file: {str(e)}')
raise
try:
lines = [line.strip() for line in f.readlines()]
except Exception as e:
logging.error(f'could not read camera config file {camera_config_path}: {e}')
raise
finally:
f.close()
if as_lines:
return lines
camera_config = _conf_to_dict(
lines,
no_convert=[
'@network_share_name',
'@network_smb_ver',
'@network_server',
'@network_username',
'@network_password',
'@storage_device',
'@upload_server',
'@upload_username',
'@upload_password',
'@upload_endpoint_url',
'@upload_access_key',
'@upload_secret_key',
'@upload_bucket',
'camera_name',
],
)
if utils.is_local_motion_camera(camera_config):
# determine the enabled status
main_config = get_main()
cameras = main_config.get('camera', [])
camera_config['@enabled'] = (
_CAMERA_CONFIG_FILE_NAME % {'id': camera_id} in cameras
)
camera_config['@id'] = camera_id
# adapt directives for motion versions < 4.2 and > 4.3
adapt_config_directives(camera_config, _MOTION_41_TO_43_OPTIONS_MAPPING)
adapt_config_directives(camera_config, _MOTION_44_TO_43_OPTIONS_MAPPING)
_get_additional_config(camera_config, camera_id=camera_id)
_set_default_motion_camera(camera_id, camera_config)
elif utils.is_remote_camera(camera_config):
pass
elif utils.is_simple_mjpeg_camera(camera_config):
_get_additional_config(camera_config, camera_id=camera_id)
_set_default_simple_mjpeg_camera(camera_id, camera_config)
else: # incomplete configuration
logging.warning(
f'camera config file at {camera_config_path} is incomplete, ignoring'
)
return None
_camera_config_cache[camera_id] = dict(camera_config)
return camera_config
def set_camera(camera_id, camera_config):
camera_config['@id'] = camera_id
_camera_config_cache[camera_id] = camera_config
camera_config = dict(camera_config)
if utils.is_local_motion_camera(camera_config):
# adapt directives for motion versions < 4.2 and > 4.3
if motionctl.is_motion_pre42():
adapt_config_directives(camera_config, _MOTION_43_TO_41_OPTIONS_MAPPING)
elif motionctl.is_motion_post43():
adapt_config_directives(camera_config, _MOTION_43_TO_44_OPTIONS_MAPPING)
# set the enabled status in main config
main_config = get_main()
cameras = main_config.setdefault('camera', [])
config_file_name = _CAMERA_CONFIG_FILE_NAME % {'id': camera_id}
if camera_config['@enabled'] and config_file_name not in cameras:
cameras.append(config_file_name)
elif not camera_config['@enabled']:
cameras = [c for c in cameras if c != config_file_name]
main_config['camera'] = cameras
set_main(main_config)
_set_additional_config(camera_config, camera_id=camera_id)
elif utils.is_remote_camera(camera_config):
pass
elif utils.is_simple_mjpeg_camera(camera_config):
_set_additional_config(camera_config, camera_id=camera_id)
# read the actual configuration from file
config_file_path = os.path.join(settings.CONF_PATH, _CAMERA_CONFIG_FILE_NAME) % {
'id': camera_id
}
if os.path.isfile(config_file_path):
lines = get_camera(camera_id, as_lines=True)
else:
lines = []
# write the configuration to file
camera_config_path = os.path.join(settings.CONF_PATH, _CAMERA_CONFIG_FILE_NAME) % {
'id': camera_id
}
logging.debug(f'writing camera config to {camera_config_path}...')
try:
f = open(camera_config_path, 'w')
except Exception as e:
logging.error(
f'could not open camera config file {camera_config_path} for writing: {e}'
)
raise
lines = _dict_to_conf(lines, camera_config)
try:
f.writelines([utils.make_str(line) + '\n' for line in lines])
except Exception as e:
logging.error(f'could not write camera config file {camera_config_path}: {e}')
raise
finally:
f.close()
def add_camera(device_details):
global _camera_ids_cache
proto = device_details['proto']
if proto in ['netcam', 'mjpeg']:
host = device_details['host']
if device_details['port']:
host += ':' + str(device_details['port'])
device_details['url'] = urlunparse(
(device_details['scheme'], host, device_details['path'], '', '', '')
)
# determine the last camera id
camera_ids = get_camera_ids()
camera_id = 1
while camera_id in camera_ids:
camera_id += 1
logging.info(f'adding new {proto} camera with id {camera_id}...')
# prepare a default camera config
camera_config = {'@enabled': True}
if proto == 'v4l2':
# find a suitable resolution
for w, h in v4l2ctl.list_resolutions(device_details['path']):
if w > 300:
camera_config['width'] = w
camera_config['height'] = h
break
camera_config['videodevice'] = device_details['path']
elif proto == 'motioneye':
camera_config['@proto'] = 'motioneye'
camera_config['@scheme'] = device_details['scheme']
camera_config['@host'] = device_details['host']
camera_config['@port'] = device_details['port']
camera_config['@path'] = device_details['path']
camera_config['@username'] = device_details['username']
camera_config['@password'] = device_details['password']
camera_config['@remote_camera_id'] = device_details['remote_camera_id']
elif proto == 'mmal':
camera_config['mmalcam_name'] = device_details['path']
camera_config['width'] = 640
camera_config['height'] = 480
elif proto == 'netcam':
camera_config['netcam_url'] = device_details['url']
if device_details['username']:
camera_config['netcam_userpass'] = (
device_details['username'] + ':' + device_details['password']
)
camera_config['netcam_keepalive'] = device_details.get('keep_alive', False)
camera_config['netcam_tolerant_check'] = True
if device_details.get('camera_index') == 'udp':
camera_config['netcam_use_tcp'] = False
if match(r'^rtsp|^rtmp', camera_config['netcam_url']):
camera_config['width'] = 640
camera_config['height'] = 480
else: # assuming mjpeg
camera_config['@proto'] = 'mjpeg'
camera_config['@url'] = device_details['url']
if utils.is_local_motion_camera(camera_config):
_set_default_motion_camera(camera_id, camera_config)
# go through the config conversion functions back and forth once
camera_config = motion_camera_ui_to_dict(
motion_camera_dict_to_ui(camera_config), camera_config
)
elif utils.is_simple_mjpeg_camera(camera_config):
_set_default_simple_mjpeg_camera(camera_id, camera_config)
# go through the config conversion functions back and forth once
camera_config = simple_mjpeg_camera_ui_to_dict(
simple_mjpeg_camera_dict_to_ui(camera_config), camera_config
)
# write the configuration to file
set_camera(camera_id, camera_config)
_camera_ids_cache = None
_camera_config_cache.clear()
camera_config = get_camera(camera_id)
return camera_config
def rem_camera(camera_id):
global _camera_ids_cache
camera_config_name = _CAMERA_CONFIG_FILE_NAME % {'id': camera_id}
camera_config_path = os.path.join(settings.CONF_PATH, _CAMERA_CONFIG_FILE_NAME) % {
'id': camera_id
}
# remove the camera from the main config
main_config = get_main()
cameras = main_config.setdefault('camera', [])
cameras = [t for t in cameras if t != camera_config_name]
main_config['camera'] = cameras
set_main(main_config)
logging.info(f'removing camera config file {camera_config_path}...')
_camera_ids_cache = None
_camera_config_cache.clear()
try:
os.remove(camera_config_path)
except Exception as e:
logging.error(f'could not remove camera config file {camera_config_path}: {e}')
raise
def main_ui_to_dict(ui):
data = {
'@admin_username': ui['admin_username'],
'@normal_username': ui['normal_username'],
}
def call_hook(u, p):
if settings.PASSWORD_HOOK:
env = {'MEYE_USERNAME': u, 'MEYE_PASSWORD': p}
try:
utils.call_subprocess(
settings.PASSWORD_HOOK, env=env, stderr=subprocess.STDOUT
)
logging.debug('password hook exec succeeded')
except Exception as e:
logging.error(f'password hook exec failed: {e}')
if ui.get('admin_password') is not None:
if ui['admin_password']:
data['@admin_password'] = hashlib.sha1(
ui['admin_password'].encode('utf-8')
).hexdigest()
else:
data['@admin_password'] = ''
call_hook(ui['admin_username'], ui['admin_password'])
if ui.get('normal_password') is not None:
data['@normal_password'] = ui['normal_password']
call_hook(ui['normal_username'], ui['normal_password'])
if ui.get('lang') is not None:
data['@lang'] = ui['lang']
# additional configs
for name, value in list(ui.items()):
if not name.startswith('_'):
continue
data['@' + name] = value
return data
def main_dict_to_ui(data):
ui = {
'admin_username': data['@admin_username'],
'normal_username': data['@normal_username'],
}
if data['@lang']:
ui['lang'] = data['@lang']
# don't transmit password (or its hash) to the client;
# instead transmit an indication of password being set
if data['@admin_password']:
ui['admin_password'] = '*****'
else:
ui['admin_password'] = ''
if data['@normal_password']:
ui['normal_password'] = '*****'
else:
ui['normal_password'] = ''
# additional configs
for name, value in list(data.items()):
if not name.startswith('@_'):
continue
ui[name[1:]] = value
return ui
def input_sanity_check(regex, value, key, msg):
if match(regex, value):
return value
else:
raise ValueError(
f'Value "{value}" for setting "{key}" did not match regex "{regex}": {msg}'
)
def motion_camera_ui_to_dict(ui, prev_config=None):
prev_config = dict(prev_config or {})
main_config = get_main() # needed for surveillance password
# regex definitions for input sanity checks in backend
# they must match the ones in motioneye/static/js/main.js
deviceNameValidRegExp = '^[A-Za-z0-9-_+ ]+$'
deviceNameFailMessage = _(
'Device names are only allowed to contain alphanumerical characters, hyphen -, underscore _, plus +, and space'
)
filenameValidRegExp = '^([A-Za-z0-9 ()/._-]|%[CYmdHMSqv])+$'
filenameFailMessage = _(
'File names are only allowed to contain alphanumerical characters, parenthesis (), forward slash /, dot ., '
'underscore _, hyphen -, space, and a subset of motion conversion specifiers: %C %Y %m %d %H %M %S %q %v'
)
dirnameValidRegExp = '^[A-Za-z0-9 ()/._-]+$'
dirnameFailMessage = _(
'Directory names are only allowed to contain alphanumerical characters, space, parenthesis (), forward slash /, '
'dot ., underscore _, and hyphen -'
)
emailValidRegExp = '^[A-Za-z0-9 _+.@^~<>,-]+$'
emailFailMessage = _(
'Email addresses are only allowed to contain alphanumerical characters, underscore _, plus +, dot ., at @, '
'caret ^, tilde ~, angle brackets <>, hyphen -, and may be separated by comma, and space'
)
webHookUrlValidRegExp = '^[^;\']+$'
webHookUrlFailMessage = _(
'URLs are not allowed to contain caret ^, semicolon ;, or apostrophe \''
)
data = {
# device
'camera_name': input_sanity_check(
deviceNameValidRegExp, ui['name'], 'camera_name', deviceNameFailMessage
),
'@enabled': ui['enabled'],
'auto_brightness': ui['auto_brightness'],
'framerate': int(ui['framerate']),
'rotate': int(ui['rotation']),
'mask_privacy': '',
# file storage
'@storage_device': ui['storage_device'],
'@network_server': ui['network_server'],
'@network_share_name': ui['network_share_name'],
'@network_smb_ver': ui['network_smb_ver'],
'@network_username': ui['network_username'],
'@network_password': ui['network_password'],
'@upload_enabled': ui['upload_enabled'],
'@upload_movie': ui['upload_movie'],
'@upload_picture': ui['upload_picture'],
'@upload_service': ui['upload_service'],
'@upload_server': ui['upload_server'],
'@upload_port': ui['upload_port'],
'@upload_method': ui['upload_method'],
'@upload_location': ui['upload_location'],
'@upload_subfolders': ui['upload_subfolders'],
'@upload_username': ui['upload_username'],
'@upload_password': ui['upload_password'],
'@upload_endpoint_url': ui['upload_endpoint_url'],
'@upload_access_key': ui['upload_access_key'],
'@upload_secret_key': ui['upload_secret_key'],
'@upload_bucket': ui['upload_bucket'],
'@clean_cloud_enabled': ui['clean_cloud_enabled'],
# text overlay
'text_left': '',
'text_right': '',
'text_scale': ui['text_scale'],
# streaming
'stream_localhost': not ui['video_streaming'],
'stream_port': int(ui['streaming_port']),
'stream_maxrate': int(ui['streaming_framerate']),
'stream_quality': max(1, int(ui['streaming_quality'])),
'@webcam_resolution': max(1, int(ui['streaming_resolution'])),
'@webcam_server_resize': ui['streaming_server_resize'],
'stream_motion': ui['streaming_motion'],
'stream_auth_method': {'disabled': 0, 'basic': 1, 'digest': 2}.get(
ui['streaming_auth_mode'], 0
),
'stream_authentication': main_config['@normal_username']
+ ':'
+ main_config['@normal_password'],
'@lang': main_config['@lang'],
# still images
'picture_output': False,
'snapshot_interval': 0,
'picture_filename': '',
'snapshot_filename': '',
'picture_quality': max(1, int(ui['image_quality'])),
'@preserve_pictures': int(ui['preserve_pictures']),
'@manual_snapshots': ui['manual_snapshots'],
# movies
'movie_output': False,
'movie_passthrough': bool(ui['movie_passthrough']),
'movie_filename': input_sanity_check(
filenameValidRegExp,
ui['movie_file_name'],
'movie_filename',
filenameFailMessage,
),
'movie_max_time': ui['max_movie_length'],
'@preserve_movies': int(ui['preserve_movies']),
# motion detection
'@motion_detection': ui['motion_detection'],
'emulate_motion': False,
'text_changes': ui['show_frame_changes'],
'locate_motion_mode': ui['show_frame_changes'],
'threshold_maximum': ui['max_frame_change_threshold'],
'threshold_tune': ui['auto_threshold_tuning'],
'noise_tune': ui['auto_noise_detect'],
'noise_level': max(1, round(int(ui['noise_level']) * 2.55)),
'lightswitch_percent': ui['light_switch_detect'],
'event_gap': int(ui['event_gap']),
'pre_capture': int(ui['pre_capture']),
'post_capture': int(ui['post_capture']),
'minimum_motion_frames': int(ui['minimum_motion_frames']),
'smart_mask_speed': 0,
'mask_file': '',
'picture_output_motion': ui['create_debug_media'],
'movie_output_motion': ui['create_debug_media'],
# working schedule
'@working_schedule': '',
# events
'on_event_start': '',
'on_event_end': '',
'on_movie_end': '',
'on_picture_save': '',
}
if utils.is_v4l2_camera(prev_config):
proto = 'v4l2'
elif utils.is_mmal_camera(prev_config):
proto = 'mmal'
else:
proto = 'netcam'
if proto in ('v4l2', 'mmal'):
# leave videodevice unchanged
# resolution
if not ui['resolution']:
ui['resolution'] = '320x240'
width = int(ui['resolution'].split('x')[0])
height = int(ui['resolution'].split('x')[1])
data['width'] = width
data['height'] = height
threshold = int(float(ui['frame_change_threshold']) * width * height / 100)
if proto == 'v4l2':
# video controls
vid_control_params = (
('{}={}'.format(n, c['value']))
for n, c in list(ui['video_controls'].items())
)
data['vid_control_params'] = ','.join(vid_control_params)
else: # assuming netcam
if match(
r'^rtsp|^rtmp', data.get('netcam_url', prev_config.get('netcam_url', ''))
):
# motion uses the configured width and height for RTSP/RTMP cameras
width = int(ui['resolution'].split('x')[0])
height = int(ui['resolution'].split('x')[1])
data['width'] = width
data['height'] = height
threshold = int(float(ui['frame_change_threshold']) * width * height / 100)
else: # width & height are not available for other netcams
threshold = int(float(ui['frame_change_threshold']) * 640 * 480 / 100)
data['threshold'] = threshold
if ui['privacy_mask']:
capture_width, capture_height = data.get('width'), data.get('height')
if data.get('rotate') in [90, 270]:
capture_width, capture_height = capture_height, capture_width
data['mask_privacy'] = utils.build_editable_mask_file(
prev_config['@id'],
'privacy',
ui['privacy_mask_lines'],
capture_width,
capture_height,
)
data['target_dir'] = input_sanity_check(
dirnameValidRegExp, ui['root_directory'], 'target_dir', dirnameFailMessage
)
if (ui['storage_device'] == 'network-share') and settings.SMB_SHARES:
mount_point = smbctl.make_mount_point(
ui['network_server'], ui['network_share_name'], ui['network_username']
)
if ui['root_directory'].startswith('/'):
ui['root_directory'] = ui['root_directory'][1:]
data['target_dir'] = os.path.normpath(
os.path.join(mount_point, ui['root_directory'])
)
elif ui['storage_device'].startswith('local-disk'):
target_dev = ui['storage_device'][10:].replace('-', '/')
mounted_partitions = diskctl.list_mounted_partitions()
partition = mounted_partitions[target_dev]
mount_point = partition['mount_point']
if ui['root_directory'].startswith('/'):
ui['root_directory'] = ui['root_directory'][1:]
data['target_dir'] = os.path.normpath(
os.path.join(mount_point, ui['root_directory'])
)
# try to create the target dir
try:
os.makedirs(data['target_dir'])
logging.debug(
f'created root directory {data["target_dir"]} for camera {data["camera_name"]}'
)
except OSError as e:
if isinstance(e, OSError) and e.errno == EEXIST:
pass # already exists, things should be just fine
else:
logging.error(
f'failed to create root directory "{data["target_dir"]}": {e}',
exc_info=True,
)
if ui['upload_enabled'] and '@id' in prev_config:
upload_settings = {
k[7:]: ui[k] for k in list(ui.keys()) if k.startswith('upload_')
}
tasks.add(
0,
uploadservices.update,
tag=f"uploadservices.update({ui['upload_service']})",
camera_id=prev_config['@id'],
service_name=ui['upload_service'],
settings=upload_settings,
)
if ui['text_overlay']:
left_text = ui['left_text']
if left_text == 'camera-name':
data['text_left'] = ui['name']
elif left_text == 'timestamp':
data['text_left'] = '%Y-%m-%d\\n%T'
elif left_text == 'disabled':
data['text_left'] = ''
else:
data['text_left'] = ui['custom_left_text']
right_text = ui['right_text']
if right_text == 'camera-name':
data['text_right'] = ui['name']
elif right_text == 'timestamp':
data['text_right'] = '%Y-%m-%d\\n%T'
elif right_text == 'disabled':
data['text_right'] = ''
else:
data['text_right'] = ui['custom_right_text']
if ui['still_images']:
data['picture_filename'] = input_sanity_check(
filenameValidRegExp,
ui['image_file_name'],
'picture_filename',
filenameFailMessage,
)
# script aborts if above sanity check failed, hence no need to check again
data['snapshot_filename'] = ui['image_file_name']
capture_mode = ui['capture_mode']
if capture_mode == 'motion-triggered':
data['picture_output'] = True
elif capture_mode == 'motion-triggered-one':
data['picture_output'] = 'best'
elif capture_mode == 'interval-snapshots':
data['snapshot_interval'] = int(ui['snapshot_interval'])
elif capture_mode == 'all-frames':
data['picture_output'] = True
data['emulate_motion'] = True
elif capture_mode == 'manual':
data['picture_output'] = False
data['emulate_motion'] = False
if ui['movies']:
data['movie_output'] = True
recording_mode = ui['recording_mode']
if recording_mode == 'motion-triggered':
data['emulate_motion'] = False
elif recording_mode == 'continuous':
data['emulate_motion'] = True
data['movie_codec'] = ui['movie_format']
q = int(ui['movie_quality'])
data['movie_quality'] = max(1, q)
# motion detection
if ui['despeckle_filter']:
data['despeckle_filter'] = prev_config['despeckle_filter'] or 'EedDl'
else:
data['despeckle_filter'] = ''
if ui['motion_mask']:
if ui['motion_mask_type'] == 'smart':
data['smart_mask_speed'] = 11 - int(ui['smart_mask_sluggishness'])
elif ui['motion_mask_type'] == 'editable':
capture_width, capture_height = data.get('width'), data.get('height')
if data.get('rotate') in [90, 270]:
capture_width, capture_height = capture_height, capture_width
data['mask_file'] = utils.build_editable_mask_file(
prev_config['@id'],
'motion',
ui['motion_mask_lines'],
capture_width,
capture_height,
)
# working schedule
if ui['working_schedule']:
data['@working_schedule'] = (
ui['monday_from']
+ '-'
+ ui['monday_to']
+ '|'
+ ui['tuesday_from']
+ '-'
+ ui['tuesday_to']
+ '|'
+ ui['wednesday_from']
+ '-'
+ ui['wednesday_to']
+ '|'
+ ui['thursday_from']
+ '-'
+ ui['thursday_to']
+ '|'
+ ui['friday_from']
+ '-'
+ ui['friday_to']
+ '|'
+ ui['saturday_from']
+ '-'
+ ui['saturday_to']
+ '|'
+ ui['sunday_from']
+ '-'
+ ui['sunday_to']
)
data['@working_schedule_type'] = ui['working_schedule_type']
# event start
on_event_start = [f"{meyectl.find_command('relayevent')} start %t"]
if ui['email_notifications_enabled']:
emails = sub(
'\\s',
'',
input_sanity_check(
emailValidRegExp,
ui['email_notifications_addresses'],
'email_notifications_addresses',
emailFailMessage,
),
)
line = (
"%(script)s '%(server)s' '%(port)s' '%(account)s' '%(password)s' '%(tls)s' '%(from)s' '%(to)s' "
"'motion_start' '%%t' '%%Y-%%m-%%dT%%H:%%M:%%S' '%(timespan)s'"
% {
'script': meyectl.find_command('sendmail'),
'server': ui['email_notifications_smtp_server'],
'port': ui['email_notifications_smtp_port'],
'account': ui['email_notifications_smtp_account'],
'password': ui['email_notifications_smtp_password']
.replace(';', '\\;')
.replace('%', '%%'),
'tls': ui['email_notifications_smtp_tls'],
'from': input_sanity_check(
emailValidRegExp,
ui['email_notifications_from'],
'email_notifications_from',
emailFailMessage,
),
'to': emails,
'timespan': ui['email_notifications_picture_time_span'],
}
)
on_event_start.append(line)
if ui['telegram_notifications_enabled']:
line = (
"%(script)s '%(api)s' '%(chatid)s' '%%t' '%%Y-%%m-%%dT%%H:%%M:%%S' '%(timespan)s'"
% {
'script': meyectl.find_command('sendtelegram'),
'api': ui['telegram_notifications_api'],
'chatid': ui['telegram_notifications_chat_id'],
'timespan': ui['telegram_notifications_picture_time_span'],
}
)
on_event_start.append(line)
if ui['web_hook_notifications_enabled']:
url = sub(
'\\s',
'+',
input_sanity_check(
webHookUrlValidRegExp,
ui['web_hook_notifications_url'],
'web_hook_notifications_url',
webHookUrlFailMessage,
),
)
on_event_start.append(
"{script} '{method}' '{url}'".format(
script=meyectl.find_command('webhook'),
method=ui['web_hook_notifications_http_method'],
url=url,
)
)
if ui['command_notifications_enabled']:
on_event_start += utils.split_semicolon(ui['command_notifications_exec'])
data['on_event_start'] = '; '.join(on_event_start)
# event end
on_event_end = [f"{meyectl.find_command('relayevent')} stop %t"]
if ui['web_hook_end_notifications_enabled']:
url = sub(
r'\s',
'+',
input_sanity_check(
webHookUrlValidRegExp,
ui['web_hook_end_notifications_url'],
'web_hook_end_notifications_url',
webHookUrlFailMessage,
),
)
on_event_end.append(
"%(script)s '%(method)s' '%(url)s'"
% {
'script': meyectl.find_command('webhook'),
'method': ui['web_hook_end_notifications_http_method'],
'url': url,
}
)
if ui['command_end_notifications_enabled']:
on_event_end += utils.split_semicolon(ui['command_end_notifications_exec'])
data['on_event_end'] = '; '.join(on_event_end)
# movie end
on_movie_end = [f"{meyectl.find_command('relayevent')} movie_end %t %f"]
if ui['web_hook_storage_enabled']:
url = sub('\\s', '+', ui['web_hook_storage_url'])
on_movie_end.append(
"{script} '{method}' '{url}'".format(
script=meyectl.find_command('webhook'),
method=ui['web_hook_storage_http_method'],
url=url,
)
)
if ui['command_storage_enabled']:
on_movie_end += utils.split_semicolon(ui['command_storage_exec'])
data['on_movie_end'] = '; '.join(on_movie_end)
# picture save
on_picture_save = [f"{meyectl.find_command('relayevent')} picture_save %t %f"]
if ui['web_hook_storage_enabled']:
url = sub('\\s', '+', ui['web_hook_storage_url'])
on_picture_save.append(
"{script} '{method}' '{url}'".format(
script=meyectl.find_command('webhook'),
method=ui['web_hook_storage_http_method'],
url=url,
)
)
if ui['command_storage_enabled']:
on_picture_save += utils.split_semicolon(ui['command_storage_exec'])
data['on_picture_save'] = '; '.join(on_picture_save)
# additional configs
for name, value in list(ui.items()):
if not name.startswith('_'):
continue
data['@' + name] = value
# extra motion options
for name in list(prev_config.keys()):
if name not in _USED_MOTION_OPTIONS and not name.startswith('@'):
prev_config.pop(name)
extra_options = ui.get('extra_options', [])
for name, value in extra_options:
data[name] = value or ''
prev_config.update(data)
return prev_config
def motion_camera_dict_to_ui(data):
ui = {
# device
'name': data['camera_name'],
'enabled': data['@enabled'],
'id': data['@id'],
'auto_brightness': data['auto_brightness'],
'framerate': int(data['framerate']),
'rotation': int(data['rotate']),
'privacy_mask': False,
'privacy_mask_lines': [],
# file storage
'smb_shares': settings.SMB_SHARES,
'storage_device': data['@storage_device'],
'network_server': data['@network_server'],
'network_share_name': data['@network_share_name'],
'network_smb_ver': data['@network_smb_ver'],
'network_username': data['@network_username'],
'network_password': data['@network_password'],
'disk_used': 0,
'disk_total': 0,
'available_disks': diskctl.list_mounted_disks(),
'upload_enabled': data['@upload_enabled'],
'upload_picture': data['@upload_picture'],
'upload_movie': data['@upload_movie'],
'upload_service': data['@upload_service'],
'upload_server': data['@upload_server'],
'upload_port': data['@upload_port'],
'upload_method': data['@upload_method'],
'upload_location': data['@upload_location'],
'upload_subfolders': data['@upload_subfolders'],
'upload_username': data['@upload_username'],
'upload_password': data['@upload_password'],
'upload_authorization_key': '', # needed, otherwise the field is hidden
'upload_endpoint_url': data['@upload_endpoint_url'],
'upload_access_key': data['@upload_access_key'],
'upload_secret_key': data['@upload_secret_key'],
'upload_bucket': data['@upload_bucket'],
'clean_cloud_enabled': data['@clean_cloud_enabled'],
'web_hook_storage_enabled': False,
'command_storage_enabled': False,
# text overlay
'text_overlay': False,
'left_text': 'camera-name',
'right_text': 'timestamp',
'custom_left_text': '',
'custom_right_text': '',
# streaming
'video_streaming': not data['stream_localhost'],
'streaming_framerate': int(data['stream_maxrate']),
'streaming_quality': int(data['stream_quality']),
'streaming_resolution': int(data['@webcam_resolution']),
'streaming_server_resize': data['@webcam_server_resize'],
'streaming_port': int(data['stream_port']),
'streaming_auth_mode': {0: 'disabled', 1: 'basic', 2: 'digest'}.get(
data.get('stream_auth_method'), 'disabled'
),
'streaming_motion': int(data['stream_motion']),
# still images
'still_images': False,
'capture_mode': 'motion-triggered',
'image_file_name': '%Y-%m-%d/%H-%M-%S',
'image_quality': data['picture_quality'],
'snapshot_interval': 0,
'preserve_pictures': data['@preserve_pictures'],
'manual_snapshots': data['@manual_snapshots'],
# movies
'movies': False,
'recording_mode': 'motion-triggered',
'movie_file_name': data['movie_filename'],
'max_movie_length': data['movie_max_time'],
'preserve_movies': data['@preserve_movies'],
'movie_passthrough': data['movie_passthrough'],
# motion detection
'motion_detection': data['@motion_detection'],
'show_frame_changes': data['text_changes'] or data['locate_motion_mode'],
'auto_noise_detect': data['noise_tune'],
'max_frame_change_threshold': data['threshold_maximum'],
'auto_threshold_tuning': data['threshold_tune'],
'noise_level': round(int(data['noise_level']) / 2.55),
'light_switch_detect': data['lightswitch_percent'],
'despeckle_filter': data['despeckle_filter'],
'event_gap': int(data['event_gap']),
'pre_capture': int(data['pre_capture']),
'post_capture': int(data['post_capture']),
'minimum_motion_frames': int(data['minimum_motion_frames']),
'motion_mask': False,
'motion_mask_type': 'smart',
'smart_mask_sluggishness': 5,
'motion_mask_lines': [],
'create_debug_media': data['movie_output_motion']
or data['picture_output_motion'],
# motion notifications
'email_notifications_enabled': False,
'telegram_notifications_enabled': False,
'web_hook_notifications_enabled': False,
'web_hook_end_notifications_enabled': False,
'command_notifications_enabled': False,
'command_end_notifications_enabled': False,
# working schedule
'working_schedule': False,
'working_schedule_type': 'during',
'monday_from': '',
'monday_to': '',
'tuesday_from': '',
'tuesday_to': '',
'wednesday_from': '',
'wednesday_to': '',
'thursday_from': '',
'thursday_to': '',
'friday_from': '',
'friday_to': '',
'saturday_from': '',
'saturday_to': '',
'sunday_from': '',
'sunday_to': '',
}
if utils.is_net_camera(data):
ui['device_url'] = data['netcam_url']
ui['proto'] = 'netcam'
# resolutions
if match(r'^rtsp|^rtmp', data['netcam_url']):
# motion uses the configured width and height for RTSP/RTMP cameras
resolutions = utils.COMMON_RESOLUTIONS
resolutions = [r for r in resolutions if motionctl.resolution_is_valid(*r)]
ui['available_resolutions'] = [
(str(w) + 'x' + str(h)) for (w, h) in resolutions
]
ui['resolution'] = str(data['width']) + 'x' + str(data['height'])
threshold = data['threshold'] * 100.0 / (data['width'] * data['height'])
else: # width & height are not available for other netcams
# we have no other choice but use something like 640x480 as reference
threshold = data['threshold'] * 100.0 / (640 * 480)
elif utils.is_mmal_camera(data):
ui['device_url'] = data['mmalcam_name']
ui['proto'] = 'mmal'
resolutions = utils.COMMON_RESOLUTIONS
resolutions = [r for r in resolutions if motionctl.resolution_is_valid(*r)]
ui['available_resolutions'] = [
(str(w) + 'x' + str(h)) for (w, h) in resolutions
]
ui['resolution'] = str(data['width']) + 'x' + str(data['height'])
threshold = data['threshold'] * 100.0 / (data['width'] * data['height'])
else: # assuming v4l2
ui['device_url'] = data['videodevice']
ui['proto'] = 'v4l2'
# resolutions
resolutions = v4l2ctl.list_resolutions(data['videodevice'])
ui['available_resolutions'] = [
(str(w) + 'x' + str(h)) for (w, h) in resolutions
]
ui['resolution'] = str(data['width']) + 'x' + str(data['height'])
video_controls = v4l2ctl.list_ctrls(data['videodevice'])
video_controls = [
(n, c)
for (n, c) in list(video_controls.items())
if 'min' in c and 'max' in c and 'value' in c
]
vid_control_params = data['vid_control_params'].split(',')
vid_control_values = {}
for param in vid_control_params:
parts = param.split('=')
if len(parts) == 1:
name, value = param, 1
elif len(parts) == 2:
name, value = parts
else:
continue # ignore any other kind of param
vid_control_values[name] = value
ui['video_controls'] = {
n: {
'min': int(c['min']),
'max': int(c['max']),
'step': int(c['step']) if 'step' in c else None,
'value': int(vid_control_values.get(n, c['value'])),
}
for n, c in video_controls
}
threshold = data['threshold'] * 100.0 / (data['width'] * data['height'])
ui['frame_change_threshold'] = threshold
if (data['@storage_device'] == 'network-share') and settings.SMB_SHARES:
mount_point = smbctl.make_mount_point(
data['@network_server'],
data['@network_share_name'],
data['@network_username'],
)
ui['root_directory'] = data['target_dir'][len(mount_point) :] or '/'
elif data['@storage_device'].startswith('local-disk'):
target_dev = data['@storage_device'][10:].replace('-', '/')
mounted_partitions = diskctl.list_mounted_partitions()
for partition in list(mounted_partitions.values()):
if partition['target'] == target_dev and data['target_dir'].startswith(
partition['mount_point']
):
ui['root_directory'] = (
data['target_dir'][len(partition['mount_point']) :] or '/'
)
break
else: # not found for some reason
logging.error(
f'could not find mounted partition for device "{target_dev}" and target dir "{data["target_dir"]}"'
)
ui['root_directory'] = data['target_dir']
else:
ui['root_directory'] = data['target_dir']
# disk usage
usage = None
if os.path.exists(data['target_dir']):
usage = utils.get_disk_usage(data['target_dir'])
if usage:
ui['disk_used'], ui['disk_total'] = usage
ui['text_scale'] = data['text_scale']
text_left = data['text_left']
text_right = data['text_right']
if text_left or text_right:
ui['text_overlay'] = True
if text_left == data['camera_name']:
ui['left_text'] = 'camera-name'
elif text_left == '%Y-%m-%d\\n%T':
ui['left_text'] = 'timestamp'
elif text_left == '':
ui['left_text'] = 'disabled'
else:
ui['left_text'] = 'custom-text'
ui['custom_left_text'] = text_left
if text_right == data['camera_name']:
ui['right_text'] = 'camera-name'
elif text_right == '%Y-%m-%d\\n%T':
ui['right_text'] = 'timestamp'
elif text_right == '':
ui['right_text'] = 'disabled'
else:
ui['right_text'] = 'custom-text'
ui['custom_right_text'] = text_right
emulate_motion = data['emulate_motion']
picture_output = data['picture_output']
picture_filename = data['picture_filename']
snapshot_interval = data['snapshot_interval']
snapshot_filename = data['snapshot_filename']
ui['still_images'] = bool(snapshot_filename) or bool(picture_filename)
if emulate_motion:
ui['capture_mode'] = 'all-frames'
if picture_filename:
ui['image_file_name'] = picture_filename
elif snapshot_interval:
ui['capture_mode'] = 'interval-snapshots'
ui['snapshot_interval'] = snapshot_interval
if snapshot_filename:
ui['image_file_name'] = snapshot_filename
elif picture_output:
if picture_output == 'best':
ui['capture_mode'] = 'motion-triggered-one'
else:
ui['capture_mode'] = 'motion-triggered'
if picture_filename:
ui['image_file_name'] = picture_filename
else: # assuming manual
ui['capture_mode'] = 'manual'
if snapshot_filename:
ui['image_file_name'] = snapshot_filename
if data['movie_output']:
ui['movies'] = True
if emulate_motion:
ui['recording_mode'] = 'continuous'
else:
ui['recording_mode'] = 'motion-triggered'
ui['movie_format'] = data['movie_codec']
ui['movie_quality'] = data['movie_quality']
# masks
if data['mask_file']:
ui['motion_mask'] = True
ui['motion_mask_type'] = 'editable'
capture_width, capture_height = data.get('width'), data.get('height')
if int(data.get('rotate')) in [90, 270]:
capture_width, capture_height = capture_height, capture_width
ui['motion_mask_lines'] = utils.parse_editable_mask_file(
data['@id'], 'motion', capture_width, capture_height
)
elif data['smart_mask_speed']:
ui['motion_mask'] = True
ui['motion_mask_type'] = 'smart'
ui['smart_mask_sluggishness'] = 11 - data['smart_mask_speed']
if data['mask_privacy']:
ui['privacy_mask'] = True
capture_width, capture_height = data.get('width'), data.get('height')
if int(data.get('rotate')) in [90, 270]:
capture_width, capture_height = capture_height, capture_width
ui['privacy_mask_lines'] = utils.parse_editable_mask_file(
data['@id'], 'privacy', capture_width, capture_height
)
# working schedule
working_schedule = data['@working_schedule']
if working_schedule:
days = working_schedule.split('|')
ui['working_schedule'] = True
ui['monday_from'], ui['monday_to'] = days[0].split('-')
ui['tuesday_from'], ui['tuesday_to'] = days[1].split('-')
ui['wednesday_from'], ui['wednesday_to'] = days[2].split('-')
ui['thursday_from'], ui['thursday_to'] = days[3].split('-')
ui['friday_from'], ui['friday_to'] = days[4].split('-')
ui['saturday_from'], ui['saturday_to'] = days[5].split('-')
ui['sunday_from'], ui['sunday_to'] = days[6].split('-')
ui['working_schedule_type'] = data['@working_schedule_type']
# event start
on_event_start = data.get('on_event_start') or []
if on_event_start:
on_event_start = utils.split_semicolon(on_event_start)
ui['email_notifications_picture_time_span'] = 0
ui['telegram_notifications_picture_time_span'] = 0
command_notifications = []
for e in on_event_start:
if ' sendmail ' in e:
e = split(e)
if len(e) < 10:
continue
if len(e) < 16:
# backwards compatibility with older configs lacking "from" field
e.insert(-5, '')
ui['email_notifications_enabled'] = True
ui['email_notifications_smtp_server'] = e[-11]
ui['email_notifications_smtp_port'] = e[-10]
ui['email_notifications_smtp_account'] = e[-9]
ui['email_notifications_smtp_password'] = (
e[-8].replace('\\;', ';').replace('%%', '%')
)
ui['email_notifications_smtp_tls'] = e[-7].lower() == 'true'
ui['email_notifications_from'] = e[-6]
ui['email_notifications_addresses'] = e[-5]
try:
ui['email_notifications_picture_time_span'] = int(e[-1])
except (TypeError, ValueError):
ui['email_notifications_picture_time_span'] = 0
elif ' sendtelegram ' in e:
e = split(e)
if len(e) < 6:
continue
ui['telegram_notifications_enabled'] = True
ui['telegram_notifications_api'] = e[-5]
ui['telegram_notifications_chat_id'] = e[-4]
try:
ui['telegram_notifications_picture_time_span'] = int(e[-1])
except (TypeError, ValueError):
ui['telegram_notifications_picture_time_span'] = 0
elif ' webhook ' in e:
e = split(e)
if len(e) < 3:
continue
ui['web_hook_notifications_enabled'] = True
ui['web_hook_notifications_http_method'] = e[-2]
ui['web_hook_notifications_url'] = e[-1]
elif 'relayevent' in e:
continue # ignore internal relay script
else: # custom command
command_notifications.append(e)
if command_notifications:
ui['command_notifications_enabled'] = True
ui['command_notifications_exec'] = '; '.join(command_notifications)
# event end
on_event_end = data.get('on_event_end') or []
if on_event_end:
on_event_end = utils.split_semicolon(on_event_end)
command_end_notifications = []
for e in on_event_end:
if ' webhook ' in e:
e = split(e)
if len(e) < 3:
continue
ui['web_hook_end_notifications_enabled'] = True
ui['web_hook_end_notifications_http_method'] = e[-2]
ui['web_hook_end_notifications_url'] = e[-1]
elif 'relayevent' in e or 'eventrelay.py' in e:
continue # ignore internal relay script
else: # custom command
command_end_notifications.append(e)
if command_end_notifications:
ui['command_end_notifications_enabled'] = True
ui['command_end_notifications_exec'] = '; '.join(command_end_notifications)
# movie end
on_movie_end = data.get('on_movie_end') or []
if on_movie_end:
on_movie_end = utils.split_semicolon(on_movie_end)
command_storage = []
for e in on_movie_end:
if ' webhook ' in e:
e = split(e)
if len(e) < 3:
continue
ui['web_hook_storage_enabled'] = True
ui['web_hook_storage_http_method'] = e[-2]
ui['web_hook_storage_url'] = e[-1]
elif 'relayevent' in e:
continue # ignore internal relay script
else: # custom command
command_storage.append(e)
if command_storage:
ui['command_storage_enabled'] = True
ui['command_storage_exec'] = '; '.join(command_storage)
# additional configs
for name, value in list(data.items()):
if not name.startswith('@_'):
continue
ui[name[1:]] = value
# extra motion options
extra_options = []
for name, value in list(data.items()):
if name not in _USED_MOTION_OPTIONS and not name.startswith('@'):
if isinstance(value, bool):
# boolean values should be transferred as on/off
value = ['off', 'on'][value]
extra_options.append((name, value))
ui['extra_options'] = extra_options
# action commands
action_commands = get_action_commands(data)
ui['actions'] = list(action_commands.keys())
return ui
def simple_mjpeg_camera_ui_to_dict(ui, prev_config=None):
prev_config = dict(prev_config or {})
data = {
# device
'camera_name': ui['name'],
'@enabled': ui['enabled'],
}
# additional configs
for name, value in list(ui.items()):
if not name.startswith('_'):
continue
data['@' + name] = value
prev_config.update(data)
return prev_config
def simple_mjpeg_camera_dict_to_ui(data):
ui = {
'name': data['camera_name'],
'enabled': data['@enabled'],
'id': data['@id'],
'proto': 'mjpeg',
'url': data['@url'],
}
# additional configs
for name, value in list(data.items()):
if not name.startswith('@_'):
continue
ui[name[1:]] = value
# action commands
action_commands = get_action_commands(data)
ui['actions'] = list(action_commands.keys())
return ui
def get_action_commands(camera_config):
camera_id = camera_config['@id']
action_commands = {}
for action in _ACTIONS:
path = os.path.join(settings.CONF_PATH, f'{action}_{camera_id}')
if os.access(path, os.X_OK):
action_commands[action] = path
if camera_config.get('@manual_snapshots') and bool(
camera_config.get('snapshot_filename')
):
action_commands['snapshot'] = True
if camera_config.get('@manual_record'):
action_commands['record'] = True
return action_commands
def get_monitor_command(camera_id):
if camera_id not in _monitor_command_cache:
path = os.path.join(settings.CONF_PATH, f'monitor_{camera_id}')
if os.access(path, os.X_OK):
_monitor_command_cache[camera_id] = path
else:
_monitor_command_cache[camera_id] = None
return _monitor_command_cache[camera_id]
def invalidate_monitor_commands():
_monitor_command_cache.clear()
def backup():
logging.debug('generating config backup file')
if len(os.listdir(settings.CONF_PATH)) > 100:
logging.debug(
f'config path "{settings.CONF_PATH}" appears to be a system-wide config directory, performing a selective backup'
)
cmd = ['tar', 'zc', 'motion.conf']
cmd += list(
map(
os.path.basename,
glob.glob(os.path.join(settings.CONF_PATH, 'camera-*.conf')),
)
)
try:
content = utils.call_subprocess(cmd, cwd=settings.CONF_PATH, encoding=None)
logging.debug(f'backup file created ({len(content)} bytes)')
return content
except Exception as e:
logging.error(f'backup failed: {e}', exc_info=True)
return None
else:
logging.debug(
f'config path "{settings.CONF_PATH}" appears to be a motion-specific config directory, performing a full backup'
)
try:
content = utils.call_subprocess(
['tar', 'zc', '.'], cwd=settings.CONF_PATH, encoding=None
)
logging.debug(f'backup file created ({len(content)} bytes)')
return content
except Exception as e:
logging.error(f'backup failed: {e}', exc_info=True)
return None
def restore(content):
logging.info('restoring config from backup file')
cmd = ['tar', 'zxC', settings.CONF_PATH]
try:
p = subprocess.Popen(
cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
msg = p.communicate(content)[0]
if msg:
logging.error(f'failed to restore configuration: {msg}')
return False
logging.debug('configuration restored successfully')
if settings.ENABLE_REBOOT:
def later():
PowerControl.reboot()
io_loop = IOLoop.current()
io_loop.add_timeout(datetime.timedelta(seconds=2), later)
else:
invalidate()
return {'reboot': settings.ENABLE_REBOOT}
except Exception as e:
logging.error(f'failed to restore configuration: {e}', exc_info=True)
return None
def invalidate():
global _main_config_cache
global _camera_config_cache
global _camera_ids_cache
global _additional_structure_cache
logging.debug('invalidating config cache')
_main_config_cache = None
_camera_config_cache = {}
_camera_ids_cache = None
_additional_structure_cache = {}
def _value_to_python(value):
value_lower = value.lower()
if value_lower == 'off':
return False
elif value_lower == 'on':
return True
try:
return int(value)
except ValueError:
try:
return float(value)
except ValueError:
return value
def _python_to_value(value):
if value is True:
return 'on'
elif value is False:
return 'off'
elif isinstance(value, (int, float)):
return str(value)
else:
return value
def _conf_to_dict(lines, list_names=None, no_convert=None):
if list_names is None:
list_names = []
if no_convert is None:
no_convert = []
data = collections.OrderedDict()
for line in lines:
line = line.strip()
if len(line) == 0: # empty line
continue
_match = match(r'^#\s*(@\w+)\s*(.*)', line)
if _match:
name, value = _match.groups()[:2]
elif line.startswith('#') or line.startswith(';'): # comment line
continue
else:
parts = line.split(None, 1)
if len(parts) == 1: # empty value
parts.append('')
(name, value) = parts
value = value.strip()
if name not in no_convert:
value = _value_to_python(value)
if name in list_names:
data.setdefault(name, []).append(value)
else:
data[name] = value
return data
def _dict_to_conf(lines, data, list_names=None):
if list_names is None:
list_names = []
conf_lines = []
remaining = collections.OrderedDict(data)
processed = set()
# parse existing lines and replace the values
for line in lines:
line = line.strip()
if len(line) == 0: # empty line
conf_lines.append(line)
continue
_match = match(r'^#\s*(@\w+)\s*(.*)', line)
if _match: # @line
(name, value) = _match.groups()[:2]
elif line.startswith('#') or line.startswith(';'): # simple comment line
conf_lines.append(line)
continue
else:
parts = line.split(None, 1)
if len(parts) == 2:
(name, value) = parts
else:
(name, value) = parts[0], ''
if name in processed:
continue # name already processed
processed.add(name)
if name in list_names:
new_value = data.get(name)
if new_value is not None:
for v in new_value:
if v is None:
continue
line = name + ' ' + _python_to_value(v)
conf_lines.append(line)
else:
line = name + ' ' + value
conf_lines.append(line)
else:
new_value = data.get(name)
if new_value is not None:
value = _python_to_value(new_value)
line = name + ' ' + value
conf_lines.append(line)
remaining.pop(name, None)
# add the remaining config values not covered by existing lines
if len(remaining) and len(lines):
conf_lines.append('') # add a blank line
for name, value in list(remaining.items()):
if name.startswith('@_'):
continue # ignore additional configs
if name in list_names:
for v in value:
if v is None:
continue
line = name + ' ' + _python_to_value(v)
conf_lines.append(line)
else:
line = name + ' ' + _python_to_value(value)
conf_lines.append(line)
# build the final config lines
conf_lines.sort(key=lambda line: not line.startswith('@'))
lines = []
for i, line in enumerate(conf_lines):
# squeeze successive blank lines
if i > 0 and len(line.strip()) == 0 and len(conf_lines[i - 1].strip()) == 0:
continue
if line.startswith('@'):
line = '# ' + line
elif i > 0 and conf_lines[i - 1].startswith('@'):
lines.append('') # add a blank line between @lines and the rest
lines.append(line)
return lines
def _set_default_motion(data):
data.setdefault('@enabled', True)
data.setdefault('@admin_username', 'admin')
data.setdefault('@admin_password', '')
data.setdefault('@normal_username', 'user')
data.setdefault('@normal_password', '')
data.setdefault('@lang', 'en')
data.setdefault('setup_mode', False)
data.setdefault('webcontrol_port', settings.MOTION_CONTROL_PORT)
data.setdefault('webcontrol_interface', 1)
data.setdefault('webcontrol_localhost', settings.MOTION_CONTROL_LOCALHOST)
# the advanced list of parameters will be available
data.setdefault('webcontrol_parms', 2)
def _set_default_motion_camera(camera_id, data):
data.setdefault('camera_name', 'Camera' + str(camera_id))
data.setdefault('@id', camera_id)
if utils.is_v4l2_camera(data):
data.setdefault('videodevice', '/dev/video0')
data.setdefault('vid_control_params', '')
data.setdefault('width', 352)
data.setdefault('height', 288)
data.setdefault('auto_brightness', False)
data.setdefault('framerate', 2)
data.setdefault('rotate', 0)
data.setdefault('mask_privacy', '')
data.setdefault('@storage_device', 'custom-path')
data.setdefault('@network_server', '')
data.setdefault('@network_share_name', '')
data.setdefault('@network_smb_ver', '1.0')
data.setdefault('@network_username', '')
data.setdefault('@network_password', '')
data.setdefault(
'target_dir', os.path.join(settings.MEDIA_PATH, data['camera_name'])
)
data.setdefault('@upload_enabled', False)
data.setdefault('@upload_picture', True)
data.setdefault('@upload_movie', True)
data.setdefault('@upload_service', 'ftp')
data.setdefault('@upload_server', '')
data.setdefault('@upload_port', '')
data.setdefault('@upload_method', 'POST')
data.setdefault('@upload_location', '')
data.setdefault('@upload_subfolders', True)
data.setdefault('@upload_username', '')
data.setdefault('@upload_password', '')
data.setdefault('@upload_endpoint_url', '')
data.setdefault('@upload_access_key', '')
data.setdefault('@upload_secret_key', '')
data.setdefault('@upload_bucket', '')
data.setdefault('@clean_cloud_enabled', False)
data.setdefault('stream_localhost', False)
data.setdefault('stream_port', 9080 + camera_id)
data.setdefault('stream_maxrate', 5)
data.setdefault('stream_quality', 85)
data.setdefault('stream_motion', False)
data.setdefault('stream_auth_method', 0)
data.setdefault('@webcam_resolution', 100)
data.setdefault('@webcam_server_resize', False)
data.setdefault('text_left', data['camera_name'])
data.setdefault('text_right', '%Y-%m-%d\\n%T')
data.setdefault('text_scale', 1)
data.setdefault('@motion_detection', True)
data.setdefault('text_changes', False)
data.setdefault('locate_motion_mode', False)
data.setdefault('locate_motion_style', 'redbox')
data.setdefault('threshold', 2000)
data.setdefault('threshold_maximum', 0)
data.setdefault('threshold_tune', False)
data.setdefault('noise_tune', True)
data.setdefault('noise_level', 32)
data.setdefault('lightswitch_percent', 0)
data.setdefault('despeckle_filter', '')
data.setdefault('minimum_motion_frames', 20)
data.setdefault('smart_mask_speed', 0)
data.setdefault('mask_file', '')
data.setdefault('movie_output_motion', False)
data.setdefault('picture_output_motion', False)
data.setdefault('pre_capture', 1)
data.setdefault('post_capture', 1)
data.setdefault('picture_output', False)
data.setdefault('picture_filename', '')
data.setdefault('emulate_motion', False)
data.setdefault('event_gap', 30)
data.setdefault('snapshot_interval', 0)
data.setdefault('snapshot_filename', '')
data.setdefault('picture_quality', 85)
data.setdefault('@preserve_pictures', 0)
data.setdefault('@manual_snapshots', True)
data.setdefault('movie_filename', '%Y-%m-%d/%H-%M-%S')
data.setdefault('movie_max_time', 0)
data.setdefault('movie_output', False)
data.setdefault('movie_passthrough', False)
if motionctl.has_h264_omx_support():
data.setdefault('movie_codec', 'mp4:h264_omx') # will use h264 codec
elif motionctl.has_h264_v4l2m2m_support():
data.setdefault('movie_codec', 'mp4:h264_v4l2m2m') # will use h264 codec
else:
data.setdefault('movie_codec', 'mp4') # will use h264 codec
data.setdefault('movie_quality', 75) # 75%
data.setdefault('@preserve_movies', 0)
data.setdefault('@manual_record', False)
data.setdefault('@working_schedule', '')
data.setdefault('@working_schedule_type', 'outside')
data.setdefault('on_event_start', '')
data.setdefault('on_event_end', '')
data.setdefault('on_movie_end', '')
data.setdefault('on_picture_save', '')
def _set_default_simple_mjpeg_camera(camera_id, data):
data.setdefault('camera_name', 'Camera' + str(camera_id))
data.setdefault('@id', camera_id)
def get_additional_structure(camera, separators=False):
if _additional_structure_cache.get((camera, separators)) is None:
logging.debug(
'loading additional config structure for {}, {} separators'.format(
'camera' if camera else 'main', 'with' if separators else 'without'
)
)
# gather sections
sections = collections.OrderedDict()
for func in _additional_section_funcs:
result = func()
if not result:
continue
if result.get('reboot') and not settings.ENABLE_REBOOT:
continue
if bool(result.get('camera')) != bool(camera):
continue
result['name'] = func.__name__
sections[func.__name__] = result
logging.debug(f"additional config section: {result['name']}")
configs = collections.OrderedDict()
for func in _additional_config_funcs:
result = func()
if not result:
continue
if result.get('reboot') and not settings.ENABLE_REBOOT:
continue
if bool(result.get('camera')) != bool(camera):
continue
if result['type'] == 'separator' and not separators:
continue
result['name'] = func.__name__
configs[func.__name__] = result
section = sections.setdefault(result.get('section'), {})
section.setdefault('configs', []).append(result)
logging.debug(f"additional config item: {result['name']}")
_additional_structure_cache[(camera, separators)] = sections, configs
return _additional_structure_cache[(camera, separators)]
def _get_additional_config(data, camera_id=None):
args = [camera_id] if camera_id else []
(sections, configs) = get_additional_structure(camera=bool(camera_id))
get_funcs = {c.get('get') for c in list(configs.values()) if c.get('get')}
get_func_values = collections.OrderedDict((f, f(*args)) for f in get_funcs)
for name, section in list(sections.items()):
if not section.get('get'):
continue
if section.get('get_set_dict'):
data['@_' + name] = get_func_values.get(section['get'], {}).get(name)
else:
data['@_' + name] = get_func_values.get(section['get'])
for name, config in list(configs.items()):
if not config.get('get'):
continue
if config.get('get_set_dict'):
data['@_' + name] = get_func_values.get(config['get'], {}).get(name)
else:
data['@_' + name] = get_func_values.get(config['get'])
def _set_additional_config(data, camera_id=None):
args = [camera_id] if camera_id else []
(sections, configs) = get_additional_structure(camera=bool(camera_id))
set_func_values = collections.OrderedDict()
for name, section in list(sections.items()):
if not section.get('set'):
continue
if ('@_' + name) not in data:
continue
if section.get('get_set_dict'):
set_func_values.setdefault(section['set'], {})[name] = data['@_' + name]
else:
set_func_values[section['set']] = data['@_' + name]
for name, config in list(configs.items()):
if not config.get('set'):
continue
if ('@_' + name) not in data:
continue
if config.get('get_set_dict'):
set_func_values.setdefault(config['set'], {})[name] = data['@_' + name]
else:
set_func_values[config['set']] = data['@_' + name]
for func, value in list(set_func_values.items()):
func(*(args + [value]))
================================================
FILE: motioneye/controls/__init__.py
================================================
================================================
FILE: motioneye/controls/diskctl.py
================================================
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import os
import re
from motioneye import utils
def _list_mounts():
logging.debug('listing mounts...')
seen_targets = set()
mounts = []
with open('/proc/mounts') as f:
for line in f:
line = line.strip()
if not line:
continue
parts = line.split()
if len(parts) < 4:
continue
target = parts[0]
mount_point = parts[1]
fstype = parts[2]
opts = parts[3]
if not os.access(mount_point, os.W_OK):
continue
if target in seen_targets:
continue # probably a bind mount
seen_targets.add(target)
if fstype == 'fuseblk':
fstype = 'ntfs' # most likely
logging.debug(f'found mount "{target}" at "{mount_point}"')
mounts.append(
{
'target': target,
'mount_point': mount_point,
'fstype': fstype,
'opts': opts,
}
)
return mounts
def _list_disks():
if os.path.exists('/dev/disk/by-id/'):
return _list_disks_dev_by_id()
else: # fall back to fdisk -l
return _list_disks_fdisk()
def _list_disks_dev_by_id():
logging.debug('listing disks using /dev/disk/by-id/')
disks_by_dev = {}
partitions_by_dev = {}
for entry in os.listdir('/dev/disk/by-id/'):
parts = entry.split('-', 1)
if len(parts) < 2:
continue
target = os.path.realpath(os.path.join('/dev/disk/by-id/', entry))
bus, entry = parts
m = re.search(r'-part(\d+)$', entry)
if m:
part_no = int(m.group(1))
entry = re.sub(r'-part\d+$', '', entry)
else:
part_no = None
parts = entry.split('_')
if len(parts) < 2:
vendor = parts[0]
model = ''
else:
vendor, model = parts[:2]
if part_no is not None:
logging.debug(
f'found partition "{part_no}" at "{target}" on bus "{bus}": "{vendor} {model}"'
)
partitions_by_dev[target] = {
'target': target,
'bus': bus,
'vendor': vendor,
'model': model,
'part_no': part_no,
'unmatched': True,
}
else:
logging.debug(
f'found disk at "{target}" on bus "{bus}": "{vendor} {model}"'
)
disks_by_dev[target] = {
'target': target,
'bus': bus,
'vendor': vendor,
'model': model,
'partitions': [],
}
# group partitions by disk
for dev, partition in list(partitions_by_dev.items()):
for disk_dev, disk in list(disks_by_dev.items()):
if dev.startswith(disk_dev):
disk['partitions'].append(partition)
partition.pop('unmatched', None)
# add separate partitions that did not match any disk
for partition in list(partitions_by_dev.values()):
if partition.pop('unmatched', False):
disks_by_dev[partition['target']] = partition
partition['partitions'] = [dict(partition)]
# prepare flat list of disks
disks = list(disks_by_dev.values())
disks.sort(key=lambda d: d['vendor'])
for disk in disks:
disk['partitions'].sort(key=lambda p: p['part_no'])
return disks
def _list_disks_fdisk():
try:
output = utils.call_subprocess(['fdisk', '-l'], stderr=utils.DEV_NULL)
except Exception as e:
logging.error('failed to list disks using "fdisk -l": %s' % e, exc_info=True)
return []
disks = []
disk = None
def add_disk(d):
logging.debug(
'found disk at "%s" on bus "%s": "%s %s"'
% (d['target'], d['bus'], d['vendor'], d['model'])
)
for part in d['partitions']:
logging.debug(
'found partition "%s" at "%s" on bus "%s": "%s %s"'
% (
part['part_no'],
part['target'],
part['bus'],
part['vendor'],
part['model'],
)
)
disks.append(d)
for line in output.split('\n'):
line = line.replace('*', '')
line = re.sub(r'\s+', ' ', line.strip())
if not line:
continue
if line.startswith('Disk /dev/'):
if disk and disk['partitions']:
add_disk(disk)
parts = line.split()
disk = {
'target': parts[1].strip(':'),
'bus': '',
'vendor': '',
'model': parts[2] + ' ' + parts[3].strip(','),
'partitions': [],
}
elif line.startswith('/dev/') and disk:
parts = line.split()
part_no = re.findall(r'\d+$', parts[0])
partition = {
'part_no': int(part_no[0]) if part_no else None,
'target': parts[0],
'bus': '',
'vendor': '',
'model': parts[4] + ' ' + ' '.join(parts[6:]),
}
disk['partitions'].append(partition)
if disk and disk['partitions']:
add_disk(disk)
disks.sort(key=lambda d: d['target'])
for disk in disks:
disk['partitions'].sort(key=lambda p: p['part_no'])
return disks
def list_mounted_disks():
mounted_disks = []
try:
disks = _list_disks()
mounts_by_target = {m['target']: m for m in _list_mounts()}
for disk in disks:
for partition in disk['partitions']:
mount = mounts_by_target.get(partition['target'])
if mount:
partition.update(mount)
# filter out unmounted partitions
disk['partitions'] = [p for p in disk['partitions'] if p.get('mount_point')]
# filter out unmounted disks
mounted_disks = [d for d in disks if d['partitions']]
except Exception as e:
logging.error('failed to list mounted disks: %s' % e, exc_info=True)
return mounted_disks
def list_mounted_partitions():
mounted_partitions = {}
try:
disks = _list_disks()
mounts_by_target = {m['target']: m for m in _list_mounts()}
for disk in disks:
for partition in disk['partitions']:
mount = mounts_by_target.get(partition['target'])
if mount:
partition.update(mount)
mounted_partitions[partition['target']] = partition
except Exception as e:
logging.error('failed to list mounted partitions: %s' % e, exc_info=True)
return mounted_partitions
================================================
FILE: motioneye/controls/mmalctl.py
================================================
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from logging import debug
from subprocess import CalledProcessError
from motioneye import utils
def list_devices():
# currently MMAL support is designed specifically for the RPi;
# therefore we can rely on the vcgencmd to report MMAL cameras
debug('detecting MMAL camera')
try:
binary = utils.call_subprocess(['which', 'vcgencmd'])
except CalledProcessError: # not found
debug('unable to detect MMAL camera: vcgencmd has not been found')
return []
try:
support = utils.call_subprocess([binary, 'get_camera'])
except CalledProcessError: # not found
debug('unable to detect MMAL camera: "vcgencmd get_camera" failed')
return []
if support.startswith('supported=1 detected=1'):
debug('MMAL camera detected')
return [('vc.ril.camera', 'VideoCore Camera')]
return []
================================================
FILE: motioneye/controls/powerctl.py
================================================
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import os
import subprocess
from collections import OrderedDict
from typing import Dict
from motioneye import utils
__all__ = ('PowerControl',)
class PowerControl:
_shut_down_cmd_sequence = OrderedDict(
[
('poweroff', ''),
('shutdown', ' -h now'),
('systemctl', ' poweroff'),
('init', ' 0'),
]
)
_reboot_cmd_sequence = OrderedDict(
[
('reboot', ''),
('shutdown', ' -r now'),
('systemctl', ' reboot'),
('init', ' 6'),
]
)
@staticmethod
def _find_prog(prog: str) -> str:
return utils.call_subprocess(['which', prog])
@classmethod
def _exec_prog(cls, prog: str, args: str = '') -> bool:
p = cls._find_prog(prog)
logging.info('executing "%s"' % p)
return os.system(p + args) == 0
@classmethod
def _run_procedure(cls, prog_sequence: Dict[str, str], log_msg: str) -> bool:
logging.info(log_msg)
for prog, args in prog_sequence.items():
try:
return cls._exec_prog(prog, args)
except subprocess.CalledProcessError: # program not found
continue
else:
return False
@classmethod
def shut_down(cls) -> bool:
return cls._run_procedure(cls._shut_down_cmd_sequence, 'shutting down')
@classmethod
def reboot(cls) -> bool:
return cls._run_procedure(cls._reboot_cmd_sequence, 'rebooting')
================================================
FILE: motioneye/controls/smbctl.py
================================================
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
import logging
import os
import re
import subprocess
import time
from tornado.ioloop import IOLoop
from motioneye import config, settings, utils
def start():
io_loop = IOLoop.current()
io_loop.add_timeout(
datetime.timedelta(seconds=settings.MOUNT_CHECK_INTERVAL), _check_mounts
)
def stop():
_umount_all()
def find_mount_cifs():
try:
return utils.call_subprocess(['which', 'mount.cifs'])
except subprocess.CalledProcessError: # not found
return None
def make_mount_point(server, share, username):
server = re.sub('[^a-zA-Z0-9]', '_', server).lower()
share = re.sub('[^a-zA-Z0-9]', '_', share).lower()
if username:
username = re.sub('[^a-zA-Z0-9]', '_', username).lower()
mount_point = os.path.join(
settings.SMB_MOUNT_ROOT, f'motioneye_{server}_{share}_{username}'
)
else:
mount_point = os.path.join(
settings.SMB_MOUNT_ROOT, f'motioneye_{server}_{share}'
)
return mount_point
def list_mounts():
logging.debug('listing smb mounts...')
mounts = []
with open('/proc/mounts') as f:
for line in f:
line = line.strip()
if not line:
continue
parts = line.split()
if len(parts) < 4:
continue
target = parts[0]
mount_point = parts[1]
fstype = parts[2]
opts = ' '.join(parts[3:])
if fstype != 'cifs':
continue
if not _is_motioneye_mount(mount_point):
continue
match = re.match('//([^/]+)/(.+)', target)
if not match:
continue
if len(match.groups()) != 2:
continue
server, share = match.groups()
share = share.replace(
'\\040', ' '
) # spaces are reported oddly by /proc/mounts
match = re.search(r'username=([a-z][-\w]*)', opts)
if match:
username = match.group(1)
else:
username = ''
match = re.search(r'vers=([\w.]+)', opts)
if match:
smb_ver = match.group(1)
else:
smb_ver = '1.0'
logging.debug(f'found smb mount "//{server}/{share}" at "{mount_point}"')
mounts.append(
{
'server': server.lower(),
'share': share.lower(),
'smb_ver': smb_ver,
'username': username,
'mount_point': mount_point,
}
)
return mounts
def update_mounts():
network_shares = config.get_network_shares()
mounts = list_mounts()
mounts = {
(m['server'], m['share'], m['smb_ver'], m['username'] or ''): False
for m in mounts
}
should_stop = False # indicates that motion should be stopped immediately
should_start = True # indicates that motion can be started afterwards
for network_share in network_shares:
key = (
network_share['server'].lower(),
network_share['share'].lower(),
network_share['smb_ver'],
network_share['username'].lower() or '',
)
if key in mounts: # found
mounts[key] = True
else: # needs to be mounted
should_stop = True
if not _mount(
network_share['server'],
network_share['share'],
network_share['smb_ver'],
network_share['username'],
network_share['password'],
):
should_start = False
# unmount the no longer necessary mounts
for (server, share, smb_ver, username), required in list(mounts.items()):
if not required:
_umount(server, share, username)
should_stop = True
return should_stop, should_start
def test_share(server, share, smb_ver, username, password, root_directory):
mounts = list_mounts()
mounts = {
(m['server'], m['share'], m['smb_ver'], m['username'] or ''): m['mount_point']
for m in mounts
}
key = (server, share, smb_ver, username or '')
mounted = False
mount_point = mounts.get(key)
if not mount_point:
mount_point = _mount(server, share, smb_ver, username, password)
if not mount_point:
raise Exception('cannot mount network share')
mounted = True
def maybe_umount():
if mounted:
time.sleep(1)
_umount(server, share, username)
path = os.path.join(mount_point, root_directory)
if os.path.exists(path):
return maybe_umount()
try:
os.makedirs(path)
except:
raise Exception('cannot create root directory')
finally:
maybe_umount()
def _mount(server, share, smb_ver, username, password):
mount_point = make_mount_point(server, share, username)
logging.debug('making sure mount point "%s" exists' % mount_point)
if not os.path.exists(mount_point):
os.makedirs(mount_point)
if username:
opts = f'username={username},password={password}'
sec_types = [None, 'ntlm', 'ntlmv2', 'ntlmv2i', 'ntlmsspi', 'none']
else:
opts = 'guest'
sec_types = [None, 'none', 'ntlm', 'ntlmv2', 'ntlmv2i', 'ntlmsspi']
opts += ',vers=%s' % smb_ver
for sec in sec_types:
if sec:
actual_opts = opts + ',sec=' + sec
else:
actual_opts = opts
try:
logging.debug(
f'mounting "//{server}/{share}" at "{mount_point}" (sec={sec})'
)
subprocess.run(
['mount.cifs', f'//{server}/{share}', mount_point, '-o', actual_opts],
check=True,
)
break
except subprocess.CalledProcessError:
pass
else:
logging.error(
f'failed to mount smb share "//{server}/{share}" at "{mount_point}"'
)
return None
# test to see if mount point is writable
try:
path = os.path.join(mount_point, '.motioneye_' + str(int(time.time())))
os.mkdir(path)
os.rmdir(path)
logging.debug('directory at "%s" is writable' % mount_point)
except:
logging.error('directory at "%s" is not writable' % mount_point)
return None
return mount_point
def _umount(server, share, username):
mount_point = make_mount_point(server, share, username)
logging.debug(f'unmounting "//{server}/{share}" from "{mount_point}"')
try:
subprocess.run(['umount', mount_point], check=True)
except subprocess.CalledProcessError:
logging.error(
f'failed to unmount smb share "//{server}/{share}" from "{mount_point}"'
)
return False
try:
os.rmdir(mount_point)
except Exception as e:
logging.error(f'failed to remove smb mount point "{mount_point}": {e}')
return False
return True
def _is_motioneye_mount(mount_point):
mount_point_root = os.path.join(settings.SMB_MOUNT_ROOT, 'motioneye_')
return bool(re.match('^' + mount_point_root + r'\w+$', mount_point))
def _umount_all():
for mount in list_mounts():
_umount(mount['server'], mount['share'], mount['username'])
def _check_mounts():
from motioneye import motionctl
logging.debug('checking SMB mounts...')
stop, start = update_mounts()
if stop:
motionctl.stop()
if start:
motionctl.start()
io_loop = IOLoop.current()
io_loop.add_timeout(
datetime.timedelta(seconds=settings.MOUNT_CHECK_INTERVAL), _check_mounts
)
================================================
FILE: motioneye/controls/tzctl.py
================================================
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import hashlib
import logging
import os
from motioneye import settings, utils
from motioneye.config import additional_config
LOCAL_TIME_FILE = settings.LOCAL_TIME_FILE # @UndefinedVariable
def get_time_zone():
return _get_time_zone_symlink() or _get_time_zone_md5() or 'UTC'
def _get_time_zone_symlink():
f = settings.LOCAL_TIME_FILE
if not f:
return None
for i in range(8): # recursively follow the symlinks @UnusedVariable
try:
f = os.readlink(f)
except OSError:
break
if f and f.startswith('/usr/share/zoneinfo/'):
f = f[20:]
else:
f = None
time_zone = f or None
if time_zone:
logging.debug('found time zone by symlink method: %s' % time_zone)
return time_zone
def _get_time_zone_md5():
if settings.LOCAL_TIME_FILE:
return None
try:
output = utils.call_subprocess(
'find * -type f | xargs md5sum', shell=True, cwd='/usr/share/zoneinfo'
)
except Exception as e:
logging.error('getting md5 of zoneinfo files failed: %s' % e)
return None
lines = [l for l in output.split('\n') if l]
lines = [l.split(None, 1) for l in lines]
time_zone_by_md5 = dict(lines)
try:
with open(settings.LOCAL_TIME_FILE, 'rb') as f:
data = f.read()
except Exception as e:
logging.error('failed to read local time file: %s' % e)
return None
md5 = hashlib.md5(data).hexdigest()
time_zone = time_zone_by_md5.get(md5)
if time_zone:
logging.debug('found time zone by md5 method: %s' % time_zone)
return time_zone
def _set_time_zone(time_zone):
time_zone = time_zone or 'UTC'
zoneinfo_file = '/usr/share/zoneinfo/' + time_zone
if not os.path.exists(zoneinfo_file):
logging.error('%s file does not exist' % zoneinfo_file)
return False
logging.debug(f'linking "{settings.LOCAL_TIME_FILE}" to "{zoneinfo_file}"')
try:
os.remove(settings.LOCAL_TIME_FILE)
except:
pass # nevermind
try:
os.symlink(zoneinfo_file, settings.LOCAL_TIME_FILE)
return True
except Exception as e:
logging.error(
f'failed to link "{settings.LOCAL_TIME_FILE}" to "{zoneinfo_file}": {e}'
)
return False
@additional_config
def timeZone():
if not LOCAL_TIME_FILE:
return
import pytz
timezones = pytz.common_timezones
return {
'label': 'Time Zone',
'description': 'selecting the right timezone assures a correct timestamp displayed on pictures and movies',
'type': 'choices',
'choices': [(t, t) for t in timezones],
'section': 'general',
'reboot': True,
'get': get_time_zone,
'set': _set_time_zone,
}
================================================
FILE: motioneye/controls/v4l2ctl.py
================================================
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import fcntl
import logging
import os.path
import re
import stat
import subprocess
import time
from shlex import quote
from motioneye import utils
_resolutions_cache = {}
_ctrls_cache = {}
_ctrl_values_cache = {}
_DEV_V4L_BY_ID = '/dev/v4l/by-id/'
_V4L2_TIMEOUT = 10
def find_v4l2_ctl():
try:
return utils.call_subprocess(['which', 'v4l2-ctl'])
except subprocess.CalledProcessError: # not found
return None
def list_devices():
global _resolutions_cache, _ctrls_cache, _ctrl_values_cache
logging.debug('listing V4L2 devices')
output = b''
try:
output = utils.call_subprocess(
['v4l2-ctl', '--list-devices'], stderr=subprocess.STDOUT
)
except:
logging.debug(f'v4l2-ctl error: {output}')
name = None
devices = []
output = utils.make_str(output)
for line in output.split('\n'):
if line.startswith('\t'):
device = line.strip()
persistent_device = find_persistent_device(device)
devices.append((device, persistent_device, name))
logging.debug(f'found device {name}: {device}, {persistent_device}')
else:
name = line.split('(')[0].strip()
# clear the cache
_resolutions_cache = {}
_ctrls_cache = {}
_ctrl_values_cache = {}
return devices
def list_resolutions(device):
from motioneye import motionctl
device = utils.make_str(device)
if device in _resolutions_cache:
return _resolutions_cache[device]
logging.debug(f'listing resolutions of device {device}...')
resolutions = set()
output = b''
started = time.time()
cmd = f"v4l2-ctl -d {quote(device)} --list-formats-ext | grep -vi stepwise | grep -oE '[0-9]+x[0-9]+' || true"
logging.debug(f'running command "{cmd}"')
try:
output = utils.call_subprocess(cmd, shell=True, stderr=utils.DEV_NULL)
except:
logging.error(f'failed to list resolutions of device "{device}"')
output = utils.make_str(output)
for pair in output.split('\n'):
pair = pair.strip()
if not pair:
continue
width, height = pair.split('x')
width = int(width)
height = int(height)
if (width, height) in resolutions:
continue # duplicate resolution
if width < 96 or height < 96: # some reasonable minimal values
continue
if not motionctl.resolution_is_valid(width, height):
continue
resolutions.add((width, height))
logging.debug(f'found resolution {width}x{height} for device {device}')
if not resolutions:
logging.debug(f'no resolutions found for device {device}, using common values')
# no resolution returned by v4l2-ctl call, add common default resolutions
resolutions = utils.COMMON_RESOLUTIONS
resolutions = [r for r in resolutions if motionctl.resolution_is_valid(*r)]
resolutions = list(sorted(resolutions, key=lambda r: (r[0], r[1])))
_resolutions_cache[device] = resolutions
return resolutions
def device_present(device):
device = utils.make_str(device)
try:
st = os.stat(device)
return stat.S_ISCHR(st.st_mode)
except:
return False
def find_persistent_device(device):
device = utils.make_str(device)
try:
devs_by_id = os.listdir(_DEV_V4L_BY_ID)
except OSError:
return device
for p in devs_by_id:
p = os.path.join(_DEV_V4L_BY_ID, p)
if os.path.realpath(p) == device:
return p
return device
def list_ctrls(device):
device = utils.make_str(device)
if device in _ctrls_cache:
return _ctrls_cache[device]
output = b''
started = time.time()
cmd = ['v4l2-ctl', '-d', device, '--list-ctrls']
logging.debug(f'running command "{" ".join(cmd)}"')
try:
output = utils.call_subprocess(cmd, stderr=subprocess.STDOUT)
except:
logging.error(f'failed to list controls of device "{device}"')
controls = {}
logging.debug(f'command output: "{output}"')
output = utils.make_str(output)
for line in output.split('\n'):
if not line:
continue
match = re.match(r'^\s*(\w+)\s+([a-f0-9x\s]+)?\(\w+\)\s*:\s*(.+)\s*', line)
if not match:
continue
(control, _, properties) = match.groups()
properties = dict(
[v.split('=', 1) for v in properties.split(' ') if v.count('=')]
)
controls[control] = properties
_ctrls_cache[device] = controls
return controls
================================================
FILE: motioneye/controls/wifictl.py
================================================
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import re
from motioneye import settings
from motioneye.config import additional_config, additional_section
WPA_SUPPLICANT_CONF = settings.WPA_SUPPLICANT_CONF # @UndefinedVariable
def _get_wifi_settings():
# will return the first configured network
logging.debug('reading wifi settings from %s' % WPA_SUPPLICANT_CONF)
try:
conf_file = open(WPA_SUPPLICANT_CONF)
except Exception as e:
logging.error(f'could open wifi settings file {WPA_SUPPLICANT_CONF}: {str(e)}')
return {'wifiEnabled': False, 'wifiNetworkName': '', 'wifiNetworkKey': ''}
lines = conf_file.readlines()
conf_file.close()
ssid = psk = ''
in_section = False
for line in lines:
line = line.strip()
if line.startswith('#'):
continue
if line.endswith('{'):
in_section = True
elif line.startswith('}'):
in_section = False
break
elif in_section:
m = re.search(r'ssid\s*=\s*"(.*?)"', line)
if m:
ssid = m.group(1)
m = re.search(r'psk\s*=\s*"?([^"]*)"?', line)
if m:
psk = m.group(1)
if ssid:
logging.debug('wifi is enabled (ssid = "%s")' % ssid)
return {'wifiEnabled': True, 'wifiNetworkName': ssid, 'wifiNetworkKey': psk}
else:
logging.debug('wifi is disabled')
return {'wifiEnabled': False, 'wifiNetworkName': ssid, 'wifiNetworkKey': psk}
def _set_wifi_settings(s):
s.setdefault('wifiEnabled', False)
s.setdefault('wifiNetworkName', '')
s.setdefault('wifiNetworkKey', '')
logging.debug(
'writing wifi settings to {}: enabled={}, ssid="{}"'.format(
WPA_SUPPLICANT_CONF, s['wifiEnabled'], s['wifiNetworkName']
)
)
enabled = s['wifiEnabled']
ssid = s['wifiNetworkName']
psk = s['wifiNetworkKey']
psk_is_hex = re.match('^[a-f0-9]{64}$', psk, re.I) is not None
key_mgmt = None if psk else 'NONE'
# will update the first configured network
try:
conf_file = open(WPA_SUPPLICANT_CONF)
except Exception as e:
logging.error(
'could open wifi settings file {path}: {msg}'.format(
path=WPA_SUPPLICANT_CONF, msg=str(e)
)
)
return
lines = conf_file.readlines()
conf_file.close()
in_section = False
found_ssid = False
found_psk = False
found_key_mgmt = False
i = 0
while i < len(lines):
line = lines[i].strip()
if line.startswith('#'):
i += 1
continue
if line.endswith('{'):
in_section = True
elif line.startswith('}'):
in_section = False
if enabled and ssid and not found_ssid:
lines.insert(i, ' ssid="' + ssid + '"\n')
if enabled and psk and not found_psk:
if psk_is_hex:
lines.insert(i, ' psk=' + psk + '\n')
else:
lines.insert(i, ' psk="' + psk + '"\n')
if enabled and not found_key_mgmt and key_mgmt:
lines.insert(i, ' key_mgmt=' + key_mgmt + '\n')
found_psk = found_ssid = found_key_mgmt = True
break
elif in_section:
if enabled:
if re.match(r'ssid\s*=\s*".*?"', line):
lines[i] = ' ssid="' + ssid + '"\n'
found_ssid = True
elif re.match(r'psk\s*=.*', line):
if psk:
if psk_is_hex:
lines[i] = ' psk=' + psk + '\n'
else:
lines[i] = ' psk="' + psk + '"\n'
found_psk = True
else:
lines.pop(i)
i -= 1
elif re.match(r'key_mgmt\s*=\s*.*?', line) and key_mgmt:
lines[i] = ' key_mgmt=' + key_mgmt + '\n'
found_key_mgmt = True
else: # wifi disabled
if re.match(r'ssid\s*=\s*".*?"', line) or re.match(
r'psk\s*=\s*".*?"', line
):
lines.pop(i)
i -= 1
i += 1
if enabled and not found_ssid:
lines.append('network={\n')
lines.append(' scan_ssid=1\n')
lines.append(' ssid="' + ssid + '"\n')
if psk_is_hex:
lines.append(' psk=' + psk + '\n')
else:
lines.append(' psk="' + psk + '"\n')
if key_mgmt:
lines.append(' key_mgmt=' + key_mgmt + '\n')
lines.append('}\n\n')
try:
conf_file = open(WPA_SUPPLICANT_CONF, 'w')
except Exception as e:
logging.error(
'could open wifi settings file {path}: {msg}'.format(
path=WPA_SUPPLICANT_CONF, msg=str(e)
)
)
return
for line in lines:
conf_file.write(line)
conf_file.close()
@additional_section
def network():
return {'label': 'Network', 'description': 'configure the network connection'}
@additional_config
def wifi_enabled():
if not WPA_SUPPLICANT_CONF:
return
return {
'label': 'Wireless Network',
'description': 'enable this if you want to connect to a wireless network',
'type': 'bool',
'section': 'network',
'reboot': True,
'get': _get_wifi_settings,
'set': _set_wifi_settings,
'get_set_dict': True,
}
@additional_config
def wifi_network_name():
if not WPA_SUPPLICANT_CONF:
return
return {
'label': 'Wireless Network Name',
'description': 'the name (SSID) of your wireless network',
'type': 'str',
'section': 'network',
'required': True,
'reboot': True,
'depends': ['wifiEnabled'],
'get': _get_wifi_settings,
'set': _set_wifi_settings,
'get_set_dict': True,
}
@additional_config
def wifi_network_key():
if not WPA_SUPPLICANT_CONF:
return
return {
'label': 'Wireless Network Key',
'description': 'the key (PSK) required to connect to your wireless network',
'type': 'pwd',
'section': 'network',
'required': False,
'reboot': True,
'depends': ['wifiEnabled'],
'get': _get_wifi_settings,
'set': _set_wifi_settings,
'get_set_dict': True,
}
================================================
FILE: motioneye/extra/linux_init
================================================
#!/usr/bin/env bash
if (( UID )); then
echo 'ERROR: Root permissions required. Please run this command as root user, via "sudo" or "su". Aborting...'
exit 1
fi
# Process CLI arguments
SKIP_SYSTEMD=0
SKIP_APT_UPDATE=0
while (( $# )); do
case "$1" in
'--skip-systemd') SKIP_SYSTEMD=1;;
'--skip-apt-update') SKIP_APT_UPDATE=1;;
*) echo "ERROR: Invalid command-line argument \"$1\". Aborting..."; exit 1;;
esac
shift
done
# Install dependencies
if command -v apt-get > /dev/null; then
echo 'INFO: APT-based distribution detected, installing motionEye dependencies'
(( SKIP_APT_UPDATE )) || apt-get update
# If matching package can be found, install from motion project GitHub releases
MOTION='motion'
DISTRO=''
[[ -f '/etc/os-release' ]] && DISTRO=$(sed -n '/^VERSION_CODENAME=/{s/^[^=]*=//p;q}' /etc/os-release)
if [[ $DISTRO ]]; then
ARCH=$(dpkg --print-architecture)
# On ARMv6 Raspberry Pi models, download armv6hf package
PI=''
[[ ${ARCH} == 'armhf' && $(uname -m) == 'armv6l' ]] && PI='pi_'
echo "INFO: ${DISTRO^} on ${ARCH} detected, checking for latest motion package from GitHub releases"
command -v curl > /dev/null || DEBIAN_FRONTEND="noninteractive" apt-get -y --no-install-recommends install curl
URL=$(curl -sSfL 'https://api.github.com/repos/Motion-Project/motion/releases' | awk -F\" "/browser_download_url.*${PI}${DISTRO}_motion_.*_${ARCH}.deb/{print \$4}" | head -1)
if [[ ${URL} ]]
then
echo "INFO: Matching package found, downloading: ${URL}"
if curl -fLo /tmp/motion.deb "${URL}"
then
MOTION='/tmp/motion.deb'
else
echo 'WARNING: Download failed, installing (older) motion package from APT repository instead'
fi
else
echo "WARNING: No motion package found for ${DISTRO^} on ${ARCH}, installing from APT repository instead"
fi
else
echo 'WARNING: Distribution version could not be detected, installing motion from APT repository'
fi
DEBIAN_FRONTEND="noninteractive" apt-get -y --no-install-recommends install "${MOTION}" v4l-utils ffmpeg curl
rm -f motion.deb
elif command -v yum > /dev/null; then
echo 'INFO: YUM-based distribution detected, installing motionEye dependencies'
yum -y install motion v4l-utils ffmpeg curl
else
echo 'WARNING: This system uses neither APT nor YUM. Please install these dependencies manually:
motion v4l-utils ffmpeg curl'
fi
# Stop and disable conflicting motion.service
if systemctl -q is-active motion 2> /dev/null || systemctl -q is-enabled motion 2> /dev/null; then
systemctl disable --now motion
fi
# Pre-create config and data dirs and install configuration files
if [[ -f '/etc/motioneye/motioneye.conf' ]]
then
# Update PID file directory if the default from old motionEye is still present: https://github.com/motioneye-project/motioneye/issues/2657
grep -q '^run_path /var/run$' /etc/motioneye/motioneye.conf && sed -i '\|^run_path /var/run$|c\run_path /run/motioneye' /etc/motioneye/motioneye.conf
else
[[ -d '/etc/motioneye' ]] || mkdir /etc/motioneye
cp extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
fi
chown -R motion:motion /etc/motioneye
(( SKIP_SYSTEMD )) && exit 0
# Install service
cp extra/motioneye.systemd /etc/systemd/system/motioneye.service
# - Update meyectl path if expected /usr/local/bin/meyectl does not exist, found on Arch Linux: https://github.com/motioneye-project/motioneye/issues/3005
if [[ ! -f '/usr/local/bin/meyectl' ]]
then
meyectl_path=$(command -v meyectl)
if [[ $meyectl_path ]]
then
echo "Using $meyectl_path for systemd service"
sed -i "s|^ExecStart=/usr/local/bin/meyectl|ExecStart=$meyectl_path|" /etc/systemd/system/motioneye.service
else
echo 'ERROR: meyectl executable has not been found. systemd service will fail to start. Please check your motionEye installation.'
fi
fi
systemctl daemon-reload
systemctl enable --now motioneye
================================================
FILE: motioneye/extra/motioneye.conf.sample
================================================
# path to the configuration directory (must be writable by motionEye)
conf_path /etc/motioneye
# path to the directory where pid files go (must be writable by motionEye)
run_path /run/motioneye
# path to the directory where log files go (must be writable by motionEye)
log_path /var/log/motioneye
# default output path for media files (must be writable by motionEye)
media_path /var/lib/motioneye
# the log level (use quiet, error, warning, info or debug)
log_level info
# the IP address to listen on
# (0.0.0.0 for all interfaces, 127.0.0.1 for localhost)
listen 0.0.0.0
# the TCP port to listen on
port 8765
# path to the motion binary to use (automatically detected if commented)
#motion_binary /usr/bin/motion
# whether motion HTTP control interface listens on
# localhost or on all interfaces
motion_control_localhost true
# the TCP port that motion HTTP control interface listens on
motion_control_port 7999
# interval in seconds at which motionEye checks if motion is running
motion_check_interval 10
# whether to restart the motion daemon when an error occurs while communicating with it
motion_restart_on_errors false
# interval in seconds at which motionEye checks the SMB mounts
mount_check_interval 300
# interval in seconds at which the janitor is called
# to remove old pictures and movies
cleanup_interval 43200
# timeout in seconds to wait for response from a remote motionEye server
remote_request_timeout 10
# timeout in seconds to wait for mjpg data from the motion daemon
mjpg_client_timeout 10
# timeout in seconds after which an idle mjpg client is removed
# (set to 0 to disable)
mjpg_client_idle_timeout 10
# enab
gitextract_q2e7vtjm/
├── .github/
│ ├── dependabot.yaml
│ └── workflows/
│ ├── docker.yml
│ ├── pre-commit-autoupdate.yml
│ ├── pre-commit.yml
│ ├── pypi_release.yml
│ ├── python_safety.yml
│ ├── shellcheck.yml
│ ├── test_python.yml
│ ├── ubuntu_build.yml
│ └── update_locales.yml
├── .gitignore
├── .pre-commit-config.yaml
├── AUTHORS
├── LICENSE
├── Makefile
├── README.md
├── docker/
│ ├── Dockerfile
│ ├── README.md
│ ├── docker-compose.override.yml
│ ├── docker-compose.yml
│ ├── entrypoint.sh
│ └── motioneye-docker.conf
├── l10n/
│ ├── babel.cfg
│ ├── po2json
│ ├── traduki_js.txt
│ ├── traduki_po.sh
│ ├── traduki_python.txt
│ ├── traduko.sh
│ └── v4l2.js
├── motioneye/
│ ├── .gitignore
│ ├── __init__.py
│ ├── cleanup.py
│ ├── config.py
│ ├── controls/
│ │ ├── __init__.py
│ │ ├── diskctl.py
│ │ ├── mmalctl.py
│ │ ├── powerctl.py
│ │ ├── smbctl.py
│ │ ├── tzctl.py
│ │ ├── v4l2ctl.py
│ │ └── wifictl.py
│ ├── extra/
│ │ ├── linux_init
│ │ ├── motioneye.conf.sample
│ │ ├── motioneye.systemd
│ │ └── motioneye.sysv
│ ├── handlers/
│ │ ├── __init__.py
│ │ ├── action.py
│ │ ├── base.py
│ │ ├── config.py
│ │ ├── log.py
│ │ ├── login.py
│ │ ├── main.py
│ │ ├── movie.py
│ │ ├── movie_playback.py
│ │ ├── picture.py
│ │ ├── power.py
│ │ ├── prefs.py
│ │ ├── relay_event.py
│ │ ├── update.py
│ │ └── version.py
│ ├── locale/
│ │ ├── ar/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── bn/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ca/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── cs/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── da/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── de/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── el/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── en/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── es/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── fi/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── fr/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── hi/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── hu/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── it/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ja/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ko/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ms/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── nb_NO/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ne/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── nl/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── pa/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── pl/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── pt/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ro/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ru/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── sk/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── sv/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── ta/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── tr/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ ├── uk/
│ │ │ └── LC_MESSAGES/
│ │ │ ├── motioneye.js.po
│ │ │ ├── motioneye.mo
│ │ │ └── motioneye.po
│ │ └── zh/
│ │ └── LC_MESSAGES/
│ │ ├── motioneye.js.po
│ │ ├── motioneye.mo
│ │ └── motioneye.po
│ ├── mediafiles.py
│ ├── meyectl.py
│ ├── mjpgclient.py
│ ├── monitor.py
│ ├── motionctl.py
│ ├── motioneye_init.py
│ ├── prefs.py
│ ├── remote.py
│ ├── scripts/
│ │ ├── migrateconf.sh
│ │ └── relayevent.sh
│ ├── sendmail.py
│ ├── sendtelegram.py
│ ├── server.py
│ ├── settings.py
│ ├── shell.py
│ ├── static/
│ │ ├── css/
│ │ │ ├── frame.css
│ │ │ ├── main.css
│ │ │ └── ui.css
│ │ └── js/
│ │ ├── frame.js
│ │ ├── main.js
│ │ ├── motioneye.ar.json
│ │ ├── motioneye.bn.json
│ │ ├── motioneye.ca.json
│ │ ├── motioneye.cs.json
│ │ ├── motioneye.da.json
│ │ ├── motioneye.de.json
│ │ ├── motioneye.el.json
│ │ ├── motioneye.en.json
│ │ ├── motioneye.es.json
│ │ ├── motioneye.fi.json
│ │ ├── motioneye.fr.json
│ │ ├── motioneye.hi.json
│ │ ├── motioneye.hu.json
│ │ ├── motioneye.it.json
│ │ ├── motioneye.ja.json
│ │ ├── motioneye.ko.json
│ │ ├── motioneye.ms.json
│ │ ├── motioneye.nb_NO.json
│ │ ├── motioneye.ne.json
│ │ ├── motioneye.nl.json
│ │ ├── motioneye.pa.json
│ │ ├── motioneye.pl.json
│ │ ├── motioneye.pt.json
│ │ ├── motioneye.ro.json
│ │ ├── motioneye.ru.json
│ │ ├── motioneye.sk.json
│ │ ├── motioneye.sv.json
│ │ ├── motioneye.ta.json
│ │ ├── motioneye.tr.json
│ │ ├── motioneye.uk.json
│ │ ├── motioneye.zh.json
│ │ ├── ui.js
│ │ └── version.js
│ ├── tasks.py
│ ├── template.py
│ ├── templates/
│ │ ├── base.html
│ │ ├── main.html
│ │ ├── manifest.json
│ │ └── version.html
│ ├── update.py
│ ├── uploadservices.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── dtconv.py
│ │ ├── http.py
│ │ ├── mjpeg.py
│ │ ├── rtmp.py
│ │ └── rtsp.py
│ ├── webhook.py
│ └── wsswitch.py
├── pyproject.toml
└── tests/
├── __init__.py
├── test_handlers/
│ ├── __init__.py
│ ├── test_base.py
│ └── test_login.py
├── test_mediafiles.py
└── test_utils/
├── __init__.py
├── test_http.py
├── test_mjpeg.py
└── test_rtmp.py
SYMBOL INDEX (655 symbols across 58 files)
FILE: motioneye/cleanup.py
function start (line 30) | def start():
function stop (line 41) | def stop():
function running (line 58) | def running():
function _run_process (line 62) | def _run_process():
function _do_cleanup (line 79) | def _do_cleanup():
FILE: motioneye/config.py
function text_double (line 137) | def text_double(v, data):
function webcontrol_html_output (line 141) | def webcontrol_html_output(v, data):
function text_scale (line 145) | def text_scale(v, data):
function webcontrol_interface (line 149) | def webcontrol_interface(v, data):
function netcam_keepalive_params (line 187) | def netcam_keepalive_params(v, data):
function netcam_tolerant_check_params (line 197) | def netcam_tolerant_check_params(v, data):
function netcam_use_tcp_params (line 206) | def netcam_use_tcp_params(v, data):
function netcam_params (line 215) | def netcam_params(v, data):
function adapt_config_directives (line 251) | def adapt_config_directives(data, mapping):
function additional_section (line 266) | def additional_section(func):
function additional_config (line 270) | def additional_config(func):
function get_main (line 274) | def get_main(as_lines=False):
function set_main (line 340) | def set_main(main_config):
function get_camera_ids (line 390) | def get_camera_ids(filter_valid=True):
function get_enabled_local_motion_cameras (line 434) | def get_enabled_local_motion_cameras():
function get_network_shares (line 443) | def get_network_shares():
function get_camera (line 468) | def get_camera(camera_id, as_lines=False):
function set_camera (line 557) | def set_camera(camera_id, camera_config):
function add_camera (line 632) | def add_camera(device_details):
function rem_camera (line 730) | def rem_camera(camera_id):
function main_ui_to_dict (line 761) | def main_ui_to_dict(ui):
function main_dict_to_ui (line 809) | def main_dict_to_ui(data):
function input_sanity_check (line 842) | def input_sanity_check(regex, value, key, msg):
function motion_camera_ui_to_dict (line 852) | def motion_camera_ui_to_dict(ui, prev_config=None):
function motion_camera_dict_to_ui (line 1390) | def motion_camera_dict_to_ui(data):
function simple_mjpeg_camera_ui_to_dict (line 1897) | def simple_mjpeg_camera_ui_to_dict(ui, prev_config=None):
function simple_mjpeg_camera_dict_to_ui (line 1918) | def simple_mjpeg_camera_dict_to_ui(data):
function get_action_commands (line 1941) | def get_action_commands(camera_config):
function get_monitor_command (line 1961) | def get_monitor_command(camera_id):
function invalidate_monitor_commands (line 1973) | def invalidate_monitor_commands():
function backup (line 1977) | def backup():
function restore (line 2022) | def restore(content):
function invalidate (line 2057) | def invalidate():
function _value_to_python (line 2070) | def _value_to_python(value):
function _python_to_value (line 2089) | def _python_to_value(value):
function _conf_to_dict (line 2103) | def _conf_to_dict(lines, list_names=None, no_convert=None):
function _dict_to_conf (line 2145) | def _dict_to_conf(lines, data, list_names=None):
function _set_default_motion (line 2245) | def _set_default_motion(data):
function _set_default_motion_camera (line 2262) | def _set_default_motion_camera(camera_id, data):
function _set_default_simple_mjpeg_camera (line 2377) | def _set_default_simple_mjpeg_camera(camera_id, data):
function get_additional_structure (line 2382) | def get_additional_structure(camera, separators=False):
function _get_additional_config (line 2436) | def _get_additional_config(data, camera_id=None):
function _set_additional_config (line 2464) | def _set_additional_config(data, camera_id=None):
FILE: motioneye/controls/diskctl.py
function _list_mounts (line 24) | def _list_mounts():
function _list_disks (line 69) | def _list_disks():
function _list_disks_dev_by_id (line 77) | def _list_disks_dev_by_id():
function _list_disks_fdisk (line 157) | def _list_disks_fdisk():
function list_mounted_disks (line 233) | def list_mounted_disks():
function list_mounted_partitions (line 258) | def list_mounted_partitions():
FILE: motioneye/controls/mmalctl.py
function list_devices (line 23) | def list_devices():
FILE: motioneye/controls/powerctl.py
class PowerControl (line 28) | class PowerControl:
method _find_prog (line 48) | def _find_prog(prog: str) -> str:
method _exec_prog (line 52) | def _exec_prog(cls, prog: str, args: str = '') -> bool:
method _run_procedure (line 58) | def _run_procedure(cls, prog_sequence: Dict[str, str], log_msg: str) -...
method shut_down (line 70) | def shut_down(cls) -> bool:
method reboot (line 74) | def reboot(cls) -> bool:
FILE: motioneye/controls/smbctl.py
function start (line 29) | def start():
function stop (line 36) | def stop():
function find_mount_cifs (line 40) | def find_mount_cifs():
function make_mount_point (line 48) | def make_mount_point(server, share, username):
function list_mounts (line 66) | def list_mounts():
function update_mounts (line 131) | def update_mounts():
function test_share (line 173) | def test_share(server, share, smb_ver, username, password, root_directory):
function _mount (line 209) | def _mount(server, share, smb_ver, username, password):
function _umount (line 268) | def _umount(server, share, username):
function _is_motioneye_mount (line 293) | def _is_motioneye_mount(mount_point):
function _umount_all (line 298) | def _umount_all():
function _check_mounts (line 303) | def _check_mounts():
FILE: motioneye/controls/tzctl.py
function get_time_zone (line 27) | def get_time_zone():
function _get_time_zone_symlink (line 31) | def _get_time_zone_symlink():
function _get_time_zone_md5 (line 56) | def _get_time_zone_md5():
function _set_time_zone (line 92) | def _set_time_zone(time_zone):
function timeZone (line 123) | def timeZone():
FILE: motioneye/controls/v4l2ctl.py
function find_v4l2_ctl (line 36) | def find_v4l2_ctl():
function list_devices (line 44) | def list_devices():
function list_resolutions (line 80) | def list_resolutions(device):
function device_present (line 138) | def device_present(device):
function find_persistent_device (line 149) | def find_persistent_device(device):
function list_ctrls (line 166) | def list_ctrls(device):
FILE: motioneye/controls/wifictl.py
function _get_wifi_settings (line 26) | def _get_wifi_settings():
function _set_wifi_settings (line 76) | def _set_wifi_settings(s):
function network (line 205) | def network():
function wifi_enabled (line 210) | def wifi_enabled():
function wifi_network_name (line 227) | def wifi_network_name():
function wifi_network_key (line 246) | def wifi_network_key():
FILE: motioneye/handlers/action.py
class ActionHandler (line 32) | class ActionHandler(BaseHandler):
method post (line 33) | async def post(self, camera_id, action):
method run_command_bg (line 79) | def run_command_bg(self, command):
method check_command (line 90) | def check_command(self):
method snapshot (line 117) | async def snapshot(self, camera_id):
method record_start (line 121) | def record_start(self, camera_id):
method record_stop (line 124) | def record_stop(self, camera_id):
FILE: motioneye/handlers/base.py
class BaseHandler (line 29) | class BaseHandler(RequestHandler):
method get_all_arguments (line 30) | def get_all_arguments(self) -> dict:
method get_json (line 52) | def get_json(self):
method get_argument (line 62) | def get_argument(self, name, default=None, strip=True):
method finish (line 76) | def finish(self, chunk=None):
method render (line 86) | def render(self, template_name, content_type='text/html', **context):
method finish_json (line 96) | def finish_json(self, data=None):
method get_current_user (line 102) | def get_current_user(self):
method get_pref (line 173) | def get_pref(self, key):
method set_pref (line 176) | def set_pref(self, key, value):
method _handle_request_exception (line 179) | def _handle_request_exception(self, exception):
method auth (line 201) | def auth(admin=False, prompt=True):
method get (line 219) | def get(self, *args, **kwargs):
method post (line 222) | def post(self, *args, **kwargs):
method head (line 225) | def head(self, *args, **kwargs):
class NotFoundHandler (line 229) | class NotFoundHandler(BaseHandler):
method get (line 230) | def get(self, *args, **kwargs):
class ManifestHandler (line 236) | class ManifestHandler(BaseHandler):
method get (line 237) | def get(self):
FILE: motioneye/handlers/config.py
class ConfigHandler (line 48) | class ConfigHandler(BaseHandler):
method get (line 49) | async def get(self, camera_id=None, op=None):
method post (line 72) | async def post(self, camera_id=None, op=None):
method get_config (line 97) | async def get_config(self, camera_id):
method set_config (line 139) | async def set_config(self, camera_id):
method _handle_list_cameras_response (line 358) | def _handle_list_cameras_response(self, resp: utils.GetCamerasResponse):
method finish_json_with_error (line 364) | def finish_json_with_error(self, error_msg: str):
method check_finished (line 367) | def check_finished(self, cameras: list, length: list) -> bool:
method _handle_get_config_response (line 375) | def _handle_get_config_response(
method list (line 414) | async def list(self):
method add_camera (line 530) | async def add_camera(self):
method rem_camera (line 575) | def rem_camera(self, camera_id):
method backup (line 588) | def backup(self):
method restore (line 601) | def restore(self):
method _on_test_result (line 616) | def _on_test_result(cls, result):
method test (line 634) | async def test(self, camera_id):
method authorize (line 794) | def authorize(self, camera_id):
FILE: motioneye/handlers/log.py
class LogHandler (line 29) | class LogHandler(BaseHandler):
method get (line 35) | def get(self, name):
FILE: motioneye/handlers/login.py
class LoginHandler (line 24) | class LoginHandler(BaseHandler):
method get (line 26) | def get(self):
method post (line 29) | def post(self):
FILE: motioneye/handlers/main.py
class MainHandler (line 24) | class MainHandler(BaseHandler):
method get (line 25) | def get(self):
FILE: motioneye/handlers/movie.py
class MovieHandler (line 29) | class MovieHandler(BaseHandler):
method get (line 30) | async def get(self, camera_id, op, filename=None):
method post (line 47) | async def post(self, camera_id, op, filename=None, group=None):
method list (line 68) | async def list(self, camera_id):
method preview (line 111) | async def preview(self, camera_id, filename):
method delete (line 164) | async def delete(self, camera_id, filename):
method delete_all (line 199) | async def delete_all(self, camera_id, group):
FILE: motioneye/handlers/movie_playback.py
class MoviePlaybackHandler (line 32) | class MoviePlaybackHandler(StaticFileHandler, BaseHandler):
method get (line 38) | async def get(self, camera_id, filename=None, include_body=True):
method on_finish (line 99) | def on_finish(self):
method get_absolute_path (line 111) | def get_absolute_path(self, root, path):
method validate_absolute_path (line 114) | def validate_absolute_path(self, root, absolute_path):
class MovieDownloadHandler (line 118) | class MovieDownloadHandler(MoviePlaybackHandler):
method set_extra_headers (line 119) | def set_extra_headers(self, filename):
FILE: motioneye/handlers/picture.py
class PictureHandler (line 41) | class PictureHandler(BaseHandler):
method compute_etag (line 42) | def compute_etag(self):
method get (line 45) | async def get(self, camera_id, op, filename=None, group=None):
method post (line 75) | async def post(self, camera_id, op, filename=None, group=None):
method current (line 94) | async def current(self, camera_id, retry=0):
method list (line 157) | async def list(self, camera_id):
method frame (line 199) | async def frame(self, camera_id):
method download (line 242) | async def download(self, camera_id, filename):
method preview (line 290) | async def preview(self, camera_id, filename):
method delete (line 342) | async def delete(self, camera_id, filename):
method zipped (line 377) | async def zipped(self, camera_id, group):
method timelapse (line 472) | async def timelapse(self, camera_id, group):
method delete_all (line 635) | async def delete_all(self, camera_id, group):
method try_finish (line 669) | def try_finish(self, content):
FILE: motioneye/handlers/power.py
class PowerHandler (line 28) | class PowerHandler(BaseHandler):
method post (line 30) | def post(self, op):
method shut_down (line 37) | def shut_down(self):
method reboot (line 41) | def reboot(self):
FILE: motioneye/handlers/prefs.py
class PrefsHandler (line 26) | class PrefsHandler(BaseHandler):
method get (line 27) | def get(self, key=None):
method post (line 30) | def post(self, key=None):
FILE: motioneye/handlers/relay_event.py
class RelayEventHandler (line 26) | class RelayEventHandler(BaseHandler):
method post (line 28) | def post(self):
method upload_media_file (line 94) | def upload_media_file(self, filename, camera_id, camera_config):
FILE: motioneye/handlers/update.py
class UpdateHandler (line 32) | class UpdateHandler(BaseHandler):
method get (line 34) | def get(self):
method post (line 52) | def post(self):
FILE: motioneye/handlers/version.py
class VersionHandler (line 27) | class VersionHandler(BaseHandler):
method get (line 28) | def get(self):
FILE: motioneye/mediafiles.py
function _list_media_files (line 107) | def _list_media_files(
function _remove_older_files (line 152) | def _remove_older_files(
function find_ffmpeg (line 206) | def find_ffmpeg() -> tuple:
function cleanup_media (line 268) | def cleanup_media(media_type: str) -> None:
function make_movie_preview (line 329) | def make_movie_preview(camera_config: dict, full_path: str) -> typing.Un...
function list_media (line 398) | def list_media(
function get_media_path (line 497) | def get_media_path(camera_config, path, media_type):
function get_media_content (line 503) | def get_media_content(camera_config, path, media_type):
function get_zipped_content (line 521) | def get_zipped_content(
function make_timelapse_movie (line 625) | def make_timelapse_movie(camera_config, framerate, interval, group):
function check_timelapse_movie (line 849) | def check_timelapse_movie():
function get_media_preview (line 865) | def get_media_preview(camera_config, path, media_type, width, height):
function del_media_content (line 910) | def del_media_content(camera_config, path, media_type):
function del_media_group (line 948) | def del_media_group(camera_config, group, media_type):
function get_current_picture (line 983) | def get_current_picture(camera_config, width, height):
function get_prepared_cache (line 1028) | def get_prepared_cache(key):
function set_prepared_cache (line 1032) | def set_prepared_cache(data):
FILE: motioneye/meyectl.py
function load_l10n (line 36) | def load_l10n():
function find_command (line 83) | def find_command(command):
function load_settings (line 99) | def load_settings():
function configure_logging (line 206) | def configure_logging(cmd, log_to_file=False):
function configure_tornado (line 240) | def configure_tornado():
function make_arg_parser (line 248) | def make_arg_parser(command=None):
function print_usage_and_exit (line 305) | def print_usage_and_exit(code):
function print_version_and_exit (line 312) | def print_version_and_exit():
function main (line 319) | def main():
FILE: motioneye/mjpgclient.py
class MjpgClient (line 32) | class MjpgClient(IOStream):
method __init__ (line 40) | def __init__(self, camera_id, port, username, password, auth_mode):
method do_connect (line 57) | def do_connect(self) -> 'Future[MjpgClient]':
method get_port (line 62) | def get_port(self):
method on_close (line 65) | def on_close(self):
method get_last_jpg (line 93) | def get_last_jpg(self):
method get_last_access (line 97) | def get_last_access(self):
method get_last_jpg_time (line 100) | def get_last_jpg_time(self):
method get_fps (line 106) | def get_fps(self):
method _check_error (line 117) | def _check_error(self) -> bool:
method _error (line 137) | def _error(self, error) -> None:
method _get_future_result (line 149) | def _get_future_result(self, future: Future) -> Tuple[bool, Any]:
method _on_connect (line 161) | def _on_connect(self, future: Future) -> None:
method _seek_http (line 189) | def _seek_http(self, future: Future = False) -> None:
method _on_http (line 198) | def _on_http(self, future: Future) -> None:
method _seek_www_authenticate (line 209) | def _seek_www_authenticate(self) -> None:
method _on_before_www_authenticate (line 213) | def _on_before_www_authenticate(self, future: Future) -> None:
method _on_www_authenticate (line 221) | def _on_www_authenticate(self, future: Future) -> None:
method _seek_content_length (line 261) | def _seek_content_length(self):
method _on_before_content_length (line 268) | def _on_before_content_length(self, future: Future):
method _on_content_length (line 276) | def _on_content_length(self, future: Future):
method _on_jpg (line 292) | def _on_jpg(self, future: Future):
function start (line 305) | def start():
function get_jpg (line 313) | def get_jpg(camera_id):
function get_fps (line 350) | def get_fps(camera_id):
function close_all (line 358) | def close_all(invalidate=False):
function _garbage_collector (line 367) | def _garbage_collector():
FILE: motioneye/monitor.py
function get_monitor_info (line 33) | def get_monitor_info(camera_id):
function _exec_monitor_command (line 52) | def _exec_monitor_command(command):
FILE: motioneye/motionctl.py
function find_motion (line 39) | def find_motion():
function start (line 77) | def start(deferred=False):
function stop (line 146) | def stop(invalidate=False):
function running (line 192) | def running():
function started (line 211) | def started():
function get_motion_detection (line 215) | async def get_motion_detection(camera_id) -> utils.GetMotionDetectionRes...
function set_motion_detection (line 243) | async def set_motion_detection(camera_id, enabled):
function take_snapshot (line 280) | async def take_snapshot(camera_id):
function is_motion_detected (line 306) | def is_motion_detected(camera_id):
function set_motion_detected (line 310) | def set_motion_detected(camera_id, motion_detected):
function camera_id_to_motion_camera_id (line 320) | def camera_id_to_motion_camera_id(camera_id):
function motion_camera_id_to_camera_id (line 339) | def motion_camera_id_to_camera_id(motion_camera_id):
function is_motion_pre42 (line 354) | def is_motion_pre42():
function is_motion_post43 (line 362) | def is_motion_post43():
function has_h264_omx_support (line 370) | def has_h264_omx_support():
function has_h264_v4l2m2m_support (line 380) | def has_h264_v4l2m2m_support():
function has_h264_nvenc_support (line 390) | def has_h264_nvenc_support():
function has_h264_nvmpi_support (line 400) | def has_h264_nvmpi_support():
function has_hevc_nvmpi_support (line 410) | def has_hevc_nvmpi_support():
function has_hevc_nvenc_support (line 420) | def has_hevc_nvenc_support():
function has_h264_qsv_support (line 430) | def has_h264_qsv_support():
function has_hevc_qsv_support (line 440) | def has_hevc_qsv_support():
function has_h264_nvenc_support (line 450) | def has_h264_nvenc_support():
function has_h264_nvmpi_support (line 460) | def has_h264_nvmpi_support():
function has_hevc_nvmpi_support (line 470) | def has_hevc_nvmpi_support():
function has_hevc_nvenc_support (line 480) | def has_hevc_nvenc_support():
function has_h264_qsv_support (line 490) | def has_h264_qsv_support():
function has_hevc_qsv_support (line 500) | def has_hevc_qsv_support():
function resolution_is_valid (line 510) | def resolution_is_valid(width, height):
function _disable_initial_motion_detection (line 522) | async def _disable_initial_motion_detection():
function _get_pid (line 537) | def _get_pid():
FILE: motioneye/motioneye_init.py
function main (line 25) | def main():
FILE: motioneye/prefs.py
function _load (line 35) | def _load():
function _save (line 69) | def _save():
function get (line 92) | def get(username, key=None):
function set (line 106) | def set(username, key, value):
FILE: motioneye/remote.py
function _make_request (line 29) | def _make_request(
function _send_request (line 78) | async def _send_request(request: HTTPRequest) -> HTTPResponse:
function pretty_camera_url (line 96) | def pretty_camera_url(local_config, camera=True):
function _remote_params (line 126) | def _remote_params(local_config):
function make_camera_response (line 146) | def make_camera_response(c):
function list_cameras (line 150) | async def list_cameras(local_config) -> utils.GetCamerasResponse:
function get_config (line 200) | async def get_config(local_config) -> utils.GetConfigResponse:
function set_config (line 246) | async def set_config(local_config, ui_config) -> Union[str, None]:
function test (line 295) | async def test(local_config, data) -> utils.CommonExternalResponse:
function get_current_picture (line 340) | async def get_current_picture(
function list_media (line 391) | async def list_media(local_config, media_type, prefix) -> utils.ListMedi...
function get_media_content (line 445) | async def get_media_content(
function make_zipped_content (line 488) | async def make_zipped_content(
function get_zipped_content (line 549) | async def get_zipped_content(
function make_timelapse_movie (line 596) | async def make_timelapse_movie(
function check_timelapse_movie (line 667) | async def check_timelapse_movie(local_config, group) -> utils.CommonExte...
function get_timelapse_movie (line 711) | async def get_timelapse_movie(local_config, key, group) -> utils.CommonE...
function get_media_preview (line 756) | async def get_media_preview(
function del_media_content (line 798) | async def del_media_content(
function del_media_group (line 843) | async def del_media_group(
function exec_action (line 890) | async def exec_action(local_config, action) -> utils.CommonExternalRespo...
FILE: motioneye/sendmail.py
function send_mail (line 43) | def send_mail(server, port, account, password, tls, _from, to, subject, ...
function make_message (line 78) | def make_message(subject, message, camera_id, moment, timespan, callback):
function parse_options (line 157) | def parse_options(parser, args):
function main (line 173) | def main(parser, args):
FILE: motioneye/sendtelegram.py
function send_message (line 32) | def send_message(api_key, chat_id, message, files):
function make_message (line 60) | def make_message(message, camera_id, moment, timespan, callback):
function parse_options (line 129) | def parse_options(parser, args):
function main (line 143) | def main(parser, args):
FILE: motioneye/server.py
class Daemon (line 51) | class Daemon:
method __init__ (line 52) | def __init__(self, pid_file, run_callback=None):
method daemonize (line 56) | def daemonize(self):
method del_pid (line 94) | def del_pid(self):
method running (line 101) | def running(self):
method start (line 116) | def start(self):
method stop (line 125) | def stop(self):
function _log_request (line 161) | def _log_request(handler):
function configure_signals (line 230) | def configure_signals():
function test_requirements (line 247) | def test_requirements():
function make_media_folders (line 339) | def make_media_folders():
function start_motion (line 360) | def start_motion():
function parse_options (line 394) | def parse_options(parser, args):
function make_app (line 406) | def make_app(debug: bool = False) -> Application:
function run (line 416) | def run():
function main (line 488) | def main(parser, args, command):
FILE: motioneye/shell.py
function parse_options (line 21) | def parse_options(parser, args):
function main (line 25) | def main(parser, args):
FILE: motioneye/static/js/frame.js
function setupCameraFrame (line 7) | function setupCameraFrame() {
function refreshCameraFrame (line 77) | function refreshCameraFrame() {
FILE: motioneye/static/js/main.js
function hash (line 240) | function hash(msg) {
function f (line 291) | function f(s, x, y, z) {
function ROTL (line 300) | function ROTL(x, n) {
function toHexStr (line 304) | function toHexStr(n) {
function splitUrl (line 316) | function splitUrl(url) {
function qualifyUrl (line 340) | function qualifyUrl(url) {
function qualifyPath (line 345) | function qualifyPath(path) {
function computeSignature (line 361) | function computeSignature(method, path, body) {
function addAuthParams (line 381) | function addAuthParams(method, url, body) {
function isAdmin (line 404) | function isAdmin() {
function ajax (line 408) | function ajax(method, url, data, callback, error, timeout) {
function getCookie (line 490) | function getCookie(name) {
function setCookie (line 511) | function setCookie(name, value, days) {
function showErrorMessage (line 525) | function showErrorMessage(message) {
function doLogout (line 533) | function doLogout() {
function isAuthCookiesSet (line 539) | function isAuthCookiesSet() {
function authorizeUpload (line 554) | function authorizeUpload() {
function initUI (line 566) | function initUI() {
function addVideoControl (line 1013) | function addVideoControl(name, min, max, step) {
function getPageContainer (line 1055) | function getPageContainer() {
function getCameraFrames (line 1063) | function getCameraFrames() {
function getCameraFrame (line 1073) | function getCameraFrame(cameraId) {
function getCameraProgresses (line 1083) | function getCameraProgresses() {
function getCameraProgress (line 1087) | function getCameraProgress(cameraId) {
function setLayoutColumns (line 1091) | function setLayoutColumns(columns) {
function updateLayout (line 1106) | function updateLayout() {
function showCameraOverlay (line 1170) | function showCameraOverlay() {
function hideCameraOverlay (line 1180) | function hideCameraOverlay() {
function enableMaskEdit (line 1191) | function enableMaskEdit(cameraId, maskClass, width, height) {
function disableMaskEdit (line 1396) | function disableMaskEdit(maskClass) {
function disableMaskOverlay (line 1412) | function disableMaskOverlay() {
function clearMask (line 1426) | function clearMask(cameraId) {
function openSettings (line 1437) | function openSettings(cameraId) {
function closeSettings (line 1457) | function closeSettings() {
function isSettingsOpen (line 1478) | function isSettingsOpen() {
function updateConfigUI (line 1482) | function updateConfigUI() {
function configUiValid (line 1738) | function configUiValid() {
function prefsUi2Dict (line 1755) | function prefsUi2Dict() {
function dict2PrefsUi (line 1767) | function dict2PrefsUi(dict) {
function applyPrefs (line 1777) | function applyPrefs(dict) {
function savePrefs (line 1792) | function savePrefs() {
function mainUi2Dict (line 1797) | function mainUi2Dict() {
function dict2MainUi (line 1853) | function dict2MainUi(dict) {
function cameraUi2Dict (line 1921) | function cameraUi2Dict() {
function dict2CameraUi (line 2172) | function dict2CameraUi(dict) {
function beginProgress (line 2565) | function beginProgress(cameraIds) {
function endProgress (line 2592) | function endProgress() {
function downloadFile (line 2618) | function downloadFile(path) {
function deleteFile (line 2632) | function deleteFile(path, callback) {
function uploadFile (line 2637) | function uploadFile(path, input, callback) {
function showApply (line 2653) | function showApply() {
function hideApply (line 2663) | function hideApply() {
function isApplyVisible (line 2674) | function isApplyVisible() {
function doApply (line 2680) | function doApply() {
function doShutDown (line 2793) | function doShutDown() {
function doReboot (line 2820) | function doReboot() {
function doRemCamera (line 2853) | function doRemCamera() {
function doUpdate (line 2886) | function doUpdate() {
function doBackup (line 2937) | function doBackup() {
function doRestore (line 2941) | function doRestore() {
function doTestUpload (line 3032) | function doTestUpload() {
function doTestEmail (line 3087) | function doTestEmail() {
function doTestTelegram (line 3127) | function doTestTelegram() {
function doTestNetworkShare (line 3162) | function doTestNetworkShare() {
function doDownloadZipped (line 3201) | function doDownloadZipped(cameraId, groupKey) {
function doDeleteFile (line 3215) | function doDeleteFile(path, callback) {
function doDeleteAllFiles (line 3240) | function doDeleteAllFiles(mediaType, cameraId, groupKey, callback) {
function doAction (line 3282) | function doAction(cameraId, action, callback) {
function showUrl (line 3294) | function showUrl(url) {
function showSnapshotUrl (line 3315) | function showSnapshotUrl() {
function showMjpgUrl (line 3321) | function showMjpgUrl() {
function showEmbedUrl (line 3327) | function showEmbedUrl() {
function fetchCurrentConfig (line 3335) | function fetchCurrentConfig(onFetch) {
function fetchCurrentCameraConfig (line 3452) | function fetchCurrentCameraConfig(onFetch) {
function pushMainConfig (line 3480) | function pushMainConfig(reboot) {
function pushCameraConfig (line 3494) | function pushCameraConfig(reboot) {
function getCameraIdsByInstance (line 3519) | function getCameraIdsByInstance() {
function getCameraIds (line 3545) | function getCameraIds() {
function runAlertDialog (line 3554) | function runAlertDialog(message, onOk, options) {
function runConfirmDialog (line 3568) | function runConfirmDialog(message, onYes, options) {
function runLoginDialog (line 3582) | function runLoginDialog(retry) {
function runPictureDialog (line 3654) | function runPictureDialog(entries, pos, mediaType, onDelete) {
function runAddCameraDialog (line 3869) | function runAddCameraDialog() {
function runTimelapseDialog (line 4199) | function runTimelapseDialog(cameraId, groupKey, group) {
function runMediaDialog (line 4329) | function runMediaDialog(cameraId, mediaType) {
function addCameraFrameUi (line 4726) | function addCameraFrameUi(cameraConfig) {
function recreateCameraFrames (line 5141) | function recreateCameraFrames(cameras) {
function doConfigureCamera (line 5191) | function doConfigureCamera(cameraId) {
function isBrowserFullScreen (line 5203) | function isBrowserFullScreen() {
function doFullScreenCamera (line 5212) | function doFullScreenCamera(cameraId) {
function doSingleViewCamera (line 5244) | function doSingleViewCamera(cameraId) {
function doExitSingleViewCamera (line 5285) | function doExitSingleViewCamera() {
function doExitFullScreenCamera (line 5316) | function doExitFullScreenCamera(remainInSingleView = true) {
function updateCameraTopButtonState (line 5348) | function updateCameraTopButtonState() {
function isSingleView (line 5364) | function isSingleView() {
function refreshCameraFrames (line 5368) | function refreshCameraFrames() {
function checkCameraErrors (line 5467) | function checkCameraErrors() {
function doAuth (line 5487) | function doAuth() {
FILE: motioneye/static/js/ui.js
function makeCheckBox (line 7) | function makeCheckBox($input) {
function makeSlider (line 68) | function makeSlider($input, minVal, maxVal, snapMode, ticks, ticksNumber...
function makeProgressBar (line 317) | function makeProgressBar($div) {
function makeTextValidator (line 342) | function makeTextValidator($input, required) {
function makeComboValidator (line 399) | function makeComboValidator($select, required) {
function makeNumberValidator (line 456) | function makeNumberValidator($input, minVal, maxVal, floating, sign, req...
function makeTimeValidator (line 561) | function makeTimeValidator($input) {
function makeUrlValidator (line 618) | function makeUrlValidator($input) {
function makeFileValidator (line 667) | function makeFileValidator($input, required) {
function makeCustomValidator (line 724) | function makeCustomValidator($input, isValidFunc) {
function makeStrippedInput (line 776) | function makeStrippedInput($input) {
function makeCharReplacer (line 782) | function makeCharReplacer($input, oldChars, newStr) {
function showModalDialog (line 791) | function showModalDialog(content, onClose, onShow, stack) {
function hideModalDialog (line 840) | function hideModalDialog() {
function updateModalDialogPosition (line 880) | function updateModalDialogPosition() {
function makeModalDialogButtons (line 900) | function makeModalDialogButtons(buttonsInfo) {
function makeModalDialogTitleBar (line 954) | function makeModalDialogTitleBar(options) {
function runModalDialog (line 979) | function runModalDialog(options) {
function showPopupMessage (line 1115) | function showPopupMessage(message, type) {
FILE: motioneye/tasks.py
function start (line 41) | def start():
function stop (line 57) | def stop():
function add (line 63) | def add(when, func, tag=None, callback=None, **params):
function _check_tasks (line 90) | def _check_tasks():
function _load (line 110) | def _load():
function _save (line 138) | def _save():
FILE: motioneye/template.py
function _init_jinja (line 33) | def _init_jinja():
function _reload_lang (line 53) | def _reload_lang():
function add_template_path (line 58) | def add_template_path(path):
function add_context (line 65) | def add_context(name, value):
function render (line 72) | def render(template_name, **context):
FILE: motioneye/update.py
function get_os_version (line 26) | def get_os_version():
function _get_os_version_lsb_release (line 36) | def _get_os_version_lsb_release():
function _get_os_version_uname (line 50) | def _get_os_version_uname():
function compare_versions (line 62) | def compare_versions(version1, version2):
function get_all_versions (line 99) | def get_all_versions():
function perform_update (line 109) | def perform_update(version):
FILE: motioneye/uploadservices.py
class UploadService (line 40) | class UploadService:
method __init__ (line 45) | def __init__(self, camera_id, **kwargs):
method __str__ (line 48) | def __str__(self):
method get_authorize_url (line 52) | def get_authorize_url(cls):
method test_access (line 55) | def test_access(self):
method upload_file (line 58) | def upload_file(self, target_dir, filename, camera_name):
method upload_data (line 112) | def upload_data(self, filename, mime_type, data, ctime, camera_name):
method dump (line 115) | def dump(self):
method load (line 118) | def load(self, data):
method save (line 121) | def save(self):
method log (line 128) | def log(self, level, message, **kwargs):
method debug (line 133) | def debug(self, message, **kwargs):
method info (line 136) | def info(self, message, **kwargs):
method error (line 139) | def error(self, message, **kwargs):
method clean_cloud (line 142) | def clean_cloud(self, cloud_dir, local_folders):
method get_service_classes (line 146) | def get_service_classes():
class GoogleBase (line 150) | class GoogleBase:
method _init (line 159) | def _init(self):
method _get_authorize_url (line 167) | def _get_authorize_url(cls):
method _test_access (line 178) | def _test_access(self):
method _dump (line 187) | def _dump(self):
method _load (line 194) | def _load(self, data):
method _request (line 204) | def _request(self, url, body=None, headers=None, retry_auth=True, meth...
method _request_json (line 265) | def _request_json(self, url, body=None, headers=None, retry_auth=True,...
method _request_credentials (line 275) | def _request_credentials(self, authorization_key):
method _refresh_credentials (line 306) | def _refresh_credentials(self, refresh_token):
class GoogleDrive (line 336) | class GoogleDrive(UploadService, GoogleBase):
method __init__ (line 353) | def __init__(self, camera_id):
method get_authorize_url (line 359) | def get_authorize_url(cls):
method test_access (line 362) | def test_access(self):
method upload_data (line 365) | def upload_data(self, filename, mime_type, data, ctime, camera_name):
method dump (line 394) | def dump(self):
method load (line 397) | def load(self, data):
method _get_folder_id (line 400) | def _get_folder_id(self, path=''):
method _get_folder_id_by_path (line 421) | def _get_folder_id_by_path(self, path):
method _get_folder_id_by_name (line 433) | def _get_folder_id_by_name(self, parent_id, child_name, create=True):
method _create_folder (line 476) | def _create_folder(self, parent_id, child_name):
method clean_cloud (line 489) | def clean_cloud(self, cloud_dir, local_folders):
method _get_children (line 512) | def _get_children(self, file_id):
method _delete_file (line 525) | def _delete_file(self, file_id):
method _get_file_metadata (line 531) | def _get_file_metadata(self, file_id):
method _get_file_title (line 544) | def _get_file_title(self, file_id):
class GooglePhoto (line 548) | class GooglePhoto(UploadService, GoogleBase):
method __init__ (line 554) | def __init__(self, camera_id):
method get_authorize_url (line 560) | def get_authorize_url(cls):
method test_access (line 563) | def test_access(self):
method upload_data (line 566) | def upload_data(self, filename, mime_type, data, ctime, camera_name):
method dump (line 584) | def dump(self):
method load (line 587) | def load(self, data):
method _get_folder_id (line 590) | def _get_folder_id(self, path=''):
method _get_folder_id_by_name (line 605) | def _get_folder_id_by_name(self, name, create=True):
method _create_folder (line 629) | def _create_folder(self, parent_id, child_name):
method _create_media (line 639) | def _create_media(self, uploadToken, camera_name):
method _get_albums (line 663) | def _get_albums(self):
method _filter_albums (line 670) | def _filter_albums(self, albums, title):
class Dropbox (line 674) | class Dropbox(UploadService):
method __init__ (line 686) | def __init__(self, camera_id):
method get_authorize_url (line 694) | def get_authorize_url(cls):
method test_access (line 703) | def test_access(self):
method upload_data (line 727) | def upload_data(self, filename, mime_type, data, ctime, camera_name):
method dump (line 742) | def dump(self):
method load (line 749) | def load(self, data):
method _clean_location (line 758) | def _clean_location(self):
method _request (line 768) | def _request(self, url, body=None, headers=None, retry_auth=True):
method _request_credentials (line 825) | def _request_credentials(self, authorization_key):
method _refresh_credentials (line 854) | def _refresh_credentials(self, refresh_token):
class Webdav (line 884) | class Webdav(UploadService):
method __init__ (line 887) | def __init__(self, camera_id):
method _request (line 895) | def _request(self, url, method, body=None):
method _make_dirs (line 915) | def _make_dirs(self, path):
method test_access (line 921) | def test_access(self):
method upload_data (line 931) | def upload_data(self, filename, mime_type, data, ctime, camera_name):
method dump (line 943) | def dump(self):
method load (line 951) | def load(self, data):
class FTP (line 962) | class FTP(UploadService):
method __init__ (line 966) | def __init__(self, camera_id):
method test_access (line 978) | def test_access(self):
method upload_data (line 997) | def upload_data(self, filename, mime_type, data, ctime, camera_name):
method dump (line 1010) | def dump(self):
method load (line 1019) | def load(self, data):
method _get_conn (line 1031) | def _get_conn(self, create=False):
method _make_dirs (line 1047) | def _make_dirs(self, path, conn=None):
class SFTP (line 1066) | class SFTP(UploadService):
method __init__ (line 1069) | def __init__(self, camera_id):
method curl_perform_filetransfer (line 1078) | def curl_perform_filetransfer(self, conn):
method test_access (line 1096) | def test_access(self):
method upload_data (line 1120) | def upload_data(self, filename, mime_type, data, ctime, camera_name):
method dump (line 1126) | def dump(self):
method load (line 1135) | def load(self, data):
method _get_conn (line 1147) | def _get_conn(self, filename, auth_type='password'):
class S3 (line 1187) | class S3(UploadService):
method __init__ (line 1190) | def __init__(self, camera_id):
method dump (line 1197) | def dump(self):
method load (line 1205) | def load(self, data):
method upload_file (line 1215) | def upload_file(self, target_dir, filename, camera_name):
method test_access (line 1229) | def test_access(self):
function get_authorize_url (line 1248) | def get_authorize_url(service_name):
function get (line 1258) | def get(camera_id, service_name):
function test_access (line 1282) | def test_access(camera_id, service_name, data):
function update (line 1293) | def update(camera_id, service_name, settings):
function upload_media_file (line 1299) | def upload_media_file(camera_id, camera_name, target_dir, service_name, ...
function _load (line 1316) | def _load():
function _save (line 1365) | def _save(services):
function clean_cloud (line 1395) | def clean_cloud(local_dir, data, info):
function exist_in_local (line 1410) | def exist_in_local(folder, local_folders):
function get_local_folders (line 1420) | def get_local_folders(dirpath):
FILE: motioneye/utils/__init__.py
class GetCurrentPictureResponse (line 74) | class GetCurrentPictureResponse:
class ListMediaResponse (line 83) | class ListMediaResponse:
class CommonExternalResponse (line 89) | class CommonExternalResponse:
function cast_future (line 94) | def cast_future(obj: typing.Awaitable[typing.Any]) -> Future:
function spawn_callback_timeout_wrapper (line 98) | def spawn_callback_timeout_wrapper(
function pretty_size (line 104) | def pretty_size(size):
function pretty_http_error (line 120) | def pretty_http_error(response):
function make_str (line 140) | def make_str(s):
function split_semicolon (line 155) | def split_semicolon(s):
function get_disk_usage (line 171) | def get_disk_usage(path):
function is_local_motion_camera (line 193) | def is_local_motion_camera(config):
function is_remote_camera (line 203) | def is_remote_camera(config):
function is_v4l2_camera (line 208) | def is_v4l2_camera(config):
function is_mmal_camera (line 213) | def is_mmal_camera(config):
function is_net_camera (line 218) | def is_net_camera(config):
function is_simple_mjpeg_camera (line 223) | def is_simple_mjpeg_camera(config):
function compute_signature (line 228) | def compute_signature(method, path, body: bytes, key):
function parse_cookies (line 264) | def parse_cookies(cookies_headers):
function build_basic_header (line 282) | def build_basic_header(username, password):
function parse_basic_header (line 286) | def parse_basic_header(header):
function build_digest_header (line 309) | def build_digest_header(method, url, username, password, state):
function urlopen (line 409) | def urlopen(*args, **kwargs):
function build_editable_mask_file (line 425) | def build_editable_mask_file(
function build_mask_file_name (line 517) | def build_mask_file_name(camera_id, mask_class):
function parse_editable_mask_file (line 528) | def parse_editable_mask_file(
function call_subprocess (line 641) | def call_subprocess(
FILE: motioneye/utils/dtconv.py
function pretty_date_time (line 24) | def pretty_date_time(date_time, tzinfo=None, short=False):
function pretty_date (line 63) | def pretty_date(d: Union[datetime.date, int]) -> str:
function pretty_time (line 75) | def pretty_time(t: Union[datetime.time, datetime.timedelta]) -> str:
function pretty_duration (line 87) | def pretty_duration(duration):
FILE: motioneye/utils/http.py
class StreamUrl (line 9) | class StreamUrl:
method __str__ (line 19) | def __str__(self):
method _get_dict_field_val (line 30) | def _get_dict_field_val(cls, k: Union[str, Hashable], v: Any) -> Any:
method from_dict (line 37) | def from_dict(cls, d: dict): # -> typing.Self in Python >= v3.11
class RtmpUrl (line 48) | class RtmpUrl(StreamUrl):
class RtspUrl (line 54) | class RtspUrl(StreamUrl):
class MjpegUrl (line 60) | class MjpegUrl(StreamUrl):
FILE: motioneye/utils/mjpeg.py
function test_mjpeg_url (line 32) | def test_mjpeg_url(
FILE: motioneye/utils/rtmp.py
function test_rtmp_url (line 24) | def test_rtmp_url(data: dict) -> GetCamerasResponse:
FILE: motioneye/utils/rtsp.py
function test_rtsp_url (line 35) | def test_rtsp_url(data: dict) -> 'Future[GetCamerasResponse]':
FILE: motioneye/webhook.py
function parse_options (line 26) | def parse_options(parser, args):
function main (line 33) | def main(parser, args):
FILE: motioneye/wsswitch.py
function _start_check_ws (line 26) | def _start_check_ws() -> None:
function start (line 30) | def start() -> None:
function _during_working_schedule (line 35) | def _during_working_schedule(now, working_schedule) -> bool:
function _switch_motion_detection_status (line 75) | async def _switch_motion_detection_status(
function _check_ws (line 107) | async def _check_ws() -> None:
FILE: tests/__init__.py
class AsyncMock (line 9) | class AsyncMock(mock.MagicMock):
method __call__ (line 10) | def __call__(self, *args, **kwargs):
method __await__ (line 18) | def __await__(self):
class WebTestCase (line 22) | class WebTestCase(AsyncHTTPTestCase):
method get_app (line 25) | def get_app(self):
method get_handlers (line 29) | def get_handlers(self):
method get_app_kwargs (line 32) | def get_app_kwargs(self):
FILE: tests/test_handlers/__init__.py
class HandlerTestCase (line 15) | class HandlerTestCase(AsyncHTTPTestCase):
method get_app (line 18) | def get_app(self) -> Application:
method get_handler (line 22) | def get_handler(self, request: MagicMock = None) -> T:
FILE: tests/test_handlers/test_base.py
class BaseHandlerTest (line 10) | class BaseHandlerTest(HandlerTestCase):
method test_get_argument (line 13) | def test_get_argument(self):
method test_get_argument_no_object_in_json (line 18) | def test_get_argument_no_object_in_json(self):
method test_get_argument_empty_json (line 23) | def test_get_argument_empty_json(self):
method test_get_argument_invalid_json (line 28) | def test_get_argument_invalid_json(self):
method test_get_current_user (line 33) | def test_get_current_user(self):
FILE: tests/test_handlers/test_login.py
class LoginHandlerTest (line 9) | class LoginHandlerTest(HandlerTestCase):
method test_get_login_no_params (line 12) | def test_get_login_no_params(self):
method test_get_login_success (line 17) | def test_get_login_success(self):
method test_get_login_fail (line 23) | def test_get_login_fail(self):
method test_post (line 31) | def test_post(self):
FILE: tests/test_mediafiles.py
class TestMediaFiles (line 27) | class TestMediaFiles(unittest.TestCase):
method setUpClass (line 29) | def setUpClass(cls):
method tearDownClass (line 90) | def tearDownClass(cls):
method test_list_media_files_recursive_all_files (line 95) | def test_list_media_files_recursive_all_files(self):
method test_list_media_files_return_structure (line 108) | def test_list_media_files_return_structure(self):
method test_list_media_files_filter_by_movie_extensions (line 132) | def test_list_media_files_filter_by_movie_extensions(self):
method test_list_media_files_filter_by_picture_extensions (line 144) | def test_list_media_files_filter_by_picture_extensions(self):
method test_list_media_files_non_recursive_with_sub_path (line 156) | def test_list_media_files_non_recursive_with_sub_path(self):
method test_list_media_files_ungrouped_sub_path (line 170) | def test_list_media_files_ungrouped_sub_path(self):
method test_list_media_files_nonexistent_sub_path (line 184) | def test_list_media_files_nonexistent_sub_path(self):
method test_list_media_files_empty_directory (line 192) | def test_list_media_files_empty_directory(self):
method test_list_media_files_performance_with_many_files (line 203) | def test_list_media_files_performance_with_many_files(self):
method test_list_media_files_deep_recursion (line 226) | def test_list_media_files_deep_recursion(self):
method test_list_media_files_no_recursion_with_sub_path_filter (line 243) | def test_list_media_files_no_recursion_with_sub_path_filter(self):
FILE: tests/test_utils/test_http.py
class TestRTSP (line 6) | class TestRTSP(unittest.TestCase):
method test_url_construction (line 7) | def test_url_construction(self):
FILE: tests/test_utils/test_mjpeg.py
class UtilsMjpegTest (line 9) | class UtilsMjpegTest(WebTestCase):
method setUp (line 10) | def setUp(self) -> None:
method get_handlers (line 14) | def get_handlers(self):
method test_test_mjpeg_url_invalid_data (line 29) | def test_test_mjpeg_url_invalid_data(self):
method test_test_mjpeg_url_jpeg_cam (line 49) | def test_test_mjpeg_url_jpeg_cam(self):
method test_test_mjpeg_url_mjpeg_cam (line 75) | def test_test_mjpeg_url_mjpeg_cam(self):
FILE: tests/test_utils/test_rtmp.py
class UtilsRtmpTest (line 6) | class UtilsRtmpTest(tornado.testing.AsyncTestCase):
method test_test_rtmp_url (line 7) | def test_test_rtmp_url(self):
Condensed preview — 232 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,028K chars).
[
{
"path": ".github/dependabot.yaml",
"chars": 567,
"preview": "# To get started with Dependabot version updates, you'll need to specify which\n# package ecosystems to update and where "
},
{
"path": ".github/workflows/docker.yml",
"chars": 1978,
"preview": "name: Docker\n\non: [pull_request, push]\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.ref }}\n cancel-in-progr"
},
{
"path": ".github/workflows/pre-commit-autoupdate.yml",
"chars": 1474,
"preview": "name: pre-commit-autoupdate\n\non:\n workflow_dispatch:\n schedule:\n - cron: 42 15 * * *\n\nconcurrency:\n group: ${{ git"
},
{
"path": ".github/workflows/pre-commit.yml",
"chars": 752,
"preview": "# https://pre-commit.com\n# This GitHub Action assumes that the repo contains a valid .pre-commit-config.yaml file.\nname:"
},
{
"path": ".github/workflows/pypi_release.yml",
"chars": 689,
"preview": "name: PyPI release\n\non: workflow_dispatch\n\npermissions:\n contents: read\n\njobs:\n release:\n runs-on: ubuntu-24.04\n "
},
{
"path": ".github/workflows/python_safety.yml",
"chars": 1234,
"preview": "name: python_safety\n\non: [pull_request, push]\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.ref }}\n cancel-i"
},
{
"path": ".github/workflows/shellcheck.yml",
"chars": 1581,
"preview": "name: shellcheck\n\non: [pull_request, push]\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.ref }}\n cancel-in-p"
},
{
"path": ".github/workflows/test_python.yml",
"chars": 2270,
"preview": "name: test_python\n\non: [pull_request, push]\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.ref }}\n cancel-in-"
},
{
"path": ".github/workflows/ubuntu_build.yml",
"chars": 1944,
"preview": "name: ubuntu_build\n\non: [pull_request, push]\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.ref }}\n cancel-in"
},
{
"path": ".github/workflows/update_locales.yml",
"chars": 2294,
"preview": "name: update_locales\n\non: pull_request\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.ref }}\n cancel-in-progr"
},
{
"path": ".gitignore",
"chars": 171,
"preview": "*.log\n*.py[cod]\n__pycache__\n*.bak\n*.pid\n*.pot\n*.po~\n*.old\ntoto*\n.project\n.pydevproject\n.settings\n.idea\nrun\nbuild\ndist\ndr"
},
{
"path": ".pre-commit-config.yaml",
"chars": 1966,
"preview": "# Learn more about this config here: https://pre-commit.com/\n\n# To enable these pre-commit hook run:\n# `brew install pre"
},
{
"path": "AUTHORS",
"chars": 111,
"preview": "A list with contributors can be found here: https://github.com/motioneye-project/motioneye/graphs/contributors\n"
},
{
"path": "LICENSE",
"chars": 35147,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "Makefile",
"chars": 2236,
"preview": "\nall: motioneye/locale/*/LC_MESSAGES/motioneye.mo motioneye/static/js/motioneye.*.json\n\n%.mo: %.po\n\tmsgfmt -f $*.po -o $"
},
{
"path": "README.md",
"chars": 4318,
"preview": "# What is motionEye?\n\n**motionEye** is an online interface for the software [_motion_](https://motion-project.github.io/"
},
{
"path": "docker/Dockerfile",
"chars": 2087,
"preview": "FROM debian:trixie-slim\nLABEL maintainer=\"Marcus Klein <himself@kleini.org>\"\n\n# By default, run as root\nARG RUN_UID=0\nAR"
},
{
"path": "docker/README.md",
"chars": 2606,
"preview": "# Docker instructions\n\n## Running from the official images\n\nThe easiest way to run motionEye under docker is to use the "
},
{
"path": "docker/docker-compose.override.yml",
"chars": 328,
"preview": "version: \"3.5\"\nservices:\n motioneye:\n restart: unless-stopped\n image: ghcr.io/motioneye-project/motioneye:edge #"
},
{
"path": "docker/docker-compose.yml",
"chars": 483,
"preview": "---\nversion: \"3.5\"\nservices:\n motioneye:\n # ToDo: Change from unstable dev/edge to stable GitHub registry release an"
},
{
"path": "docker/entrypoint.sh",
"chars": 395,
"preview": "#!/usr/bin/env sh\n# We need to chown at startup time since volumes are mounted as root. This is fugly.\nmkdir -p /run/mot"
},
{
"path": "docker/motioneye-docker.conf",
"chars": 643,
"preview": "description \"motionEye Server in Docker container\"\nauthor \"Marcus Klein <himself@kleini.org>\"\n\nstart on filesystem and s"
},
{
"path": "l10n/babel.cfg",
"chars": 47,
"preview": "[python: **.py]\n[jinja2: **/templates/**.html]\n"
},
{
"path": "l10n/po2json",
"chars": 907,
"preview": "#!/usr/bin/env sh\n\nFICIN=$1\nFICOUT=$2\n\nawk '{\n if (CONTMSG==1 && substr($1,1,1) != \"\\\"\")\n {\n CONTMSG=0;\n }\n if (C"
},
{
"path": "l10n/traduki_js.txt",
"chars": 1618,
"preview": "\n\nNi uzas por ĉiu lingvo json-dosieron, kiu enhavas la tradukojn.\nNi ŝarĝas ĉi tiun dosieron en \"templates/main.html\":\n\n"
},
{
"path": "l10n/traduki_po.sh",
"chars": 1287,
"preview": "#!/usr/bin/env sh\n#################################################################\n# skripto por aŭtomate traduki frazo"
},
{
"path": "l10n/traduki_python.txt",
"chars": 364,
"preview": "\nObjektivo: havi python-fonton en utf-8 kun multlingva gettext-administrado.\n\nla unua aŭ dua linio de .py devas enhavi: "
},
{
"path": "l10n/traduko.sh",
"chars": 1749,
"preview": "#!/usr/bin/env sh\n################################################################\n# skripto por aŭtomate traduki frazon"
},
{
"path": "l10n/v4l2.js",
"chars": 836,
"preview": "/* fake file to allow translation of v4l2-ctl output */\n/* non exhaustive list of possible controls */\n\ni18n.gettext(\"Au"
},
{
"path": "motioneye/.gitignore",
"chars": 12,
"preview": "traduko.jar\n"
},
{
"path": "motioneye/__init__.py",
"chars": 19,
"preview": "VERSION = \"0.43.1\"\n"
},
{
"path": "motioneye/cleanup.py",
"chars": 2483,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/config.py",
"chars": 78038,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/controls/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "motioneye/controls/diskctl.py",
"chars": 7687,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/controls/mmalctl.py",
"chars": 1576,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/controls/powerctl.py",
"chars": 2224,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/controls/smbctl.py",
"chars": 8531,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/controls/tzctl.py",
"chars": 3541,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/controls/v4l2ctl.py",
"chars": 5319,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/controls/wifictl.py",
"chars": 7281,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/extra/linux_init",
"chars": 3933,
"preview": "#!/usr/bin/env bash\n\nif (( UID )); then\n echo 'ERROR: Root permissions required. Please run this command as root user, "
},
{
"path": "motioneye/extra/motioneye.conf.sample",
"chars": 3010,
"preview": "# path to the configuration directory (must be writable by motionEye)\nconf_path /etc/motioneye\n\n# path to the directory "
},
{
"path": "motioneye/extra/motioneye.systemd",
"chars": 322,
"preview": "[Unit]\nDescription=motionEye Server\nAfter=network.target local-fs.target remote-fs.target\n\n[Service]\nUser=motion\nRuntime"
},
{
"path": "motioneye/extra/motioneye.sysv",
"chars": 1616,
"preview": "#!/bin/sh -e\n#\n# /etc/init.d/motioneye: Start the motionEye server\n#\n### BEGIN INIT INFO\n# Provides: motioneye\n# Require"
},
{
"path": "motioneye/handlers/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "motioneye/handlers/action.py",
"chars": 4272,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/base.py",
"chars": 7822,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/config.py",
"chars": 28440,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/log.py",
"chars": 1909,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/login.py",
"chars": 1086,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/main.py",
"chars": 2537,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/movie.py",
"chars": 7977,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/movie_playback.py",
"chars": 4667,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/picture.py",
"chars": 25282,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/power.py",
"chars": 1402,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/prefs.py",
"chars": 1184,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/relay_event.py",
"chars": 3858,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/update.py",
"chars": 1879,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/handlers/version.py",
"chars": 1273,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/locale/ar/LC_MESSAGES/motioneye.js.po",
"chars": 20258,
"preview": "# Arabic translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribute"
},
{
"path": "motioneye/locale/ar/LC_MESSAGES/motioneye.po",
"chars": 61829,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/bn/LC_MESSAGES/motioneye.js.po",
"chars": 21128,
"preview": "# Bengali translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribut"
},
{
"path": "motioneye/locale/bn/LC_MESSAGES/motioneye.po",
"chars": 64609,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/ca/LC_MESSAGES/motioneye.js.po",
"chars": 20488,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/ca/LC_MESSAGES/motioneye.po",
"chars": 64334,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2023 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/cs/LC_MESSAGES/motioneye.js.po",
"chars": 19625,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/cs/LC_MESSAGES/motioneye.po",
"chars": 60534,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2022 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/da/LC_MESSAGES/motioneye.js.po",
"chars": 20587,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/da/LC_MESSAGES/motioneye.po",
"chars": 64305,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2025 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/de/LC_MESSAGES/motioneye.js.po",
"chars": 20338,
"preview": "# German translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribute"
},
{
"path": "motioneye/locale/de/LC_MESSAGES/motioneye.po",
"chars": 64037,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/el/LC_MESSAGES/motioneye.js.po",
"chars": 20602,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/el/LC_MESSAGES/motioneye.po",
"chars": 64981,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2022 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/en/LC_MESSAGES/motioneye.js.po",
"chars": 19529,
"preview": "# English translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribut"
},
{
"path": "motioneye/locale/en/LC_MESSAGES/motioneye.po",
"chars": 60644,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/es/LC_MESSAGES/motioneye.js.po",
"chars": 20681,
"preview": "# Spanish translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribut"
},
{
"path": "motioneye/locale/es/LC_MESSAGES/motioneye.po",
"chars": 64270,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/fi/LC_MESSAGES/motioneye.js.po",
"chars": 19874,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/fi/LC_MESSAGES/motioneye.po",
"chars": 63379,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2023 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/fr/LC_MESSAGES/motioneye.js.po",
"chars": 20474,
"preview": "# French translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribute"
},
{
"path": "motioneye/locale/fr/LC_MESSAGES/motioneye.po",
"chars": 64313,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/hi/LC_MESSAGES/motioneye.js.po",
"chars": 20901,
"preview": "# Hindi translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed"
},
{
"path": "motioneye/locale/hi/LC_MESSAGES/motioneye.po",
"chars": 64474,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/hu/LC_MESSAGES/motioneye.js.po",
"chars": 21258,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/hu/LC_MESSAGES/motioneye.po",
"chars": 64446,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2023 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/it/LC_MESSAGES/motioneye.js.po",
"chars": 20392,
"preview": "# Italian translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribut"
},
{
"path": "motioneye/locale/it/LC_MESSAGES/motioneye.po",
"chars": 64324,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/ja/LC_MESSAGES/motioneye.js.po",
"chars": 18781,
"preview": "# Japanese translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribu"
},
{
"path": "motioneye/locale/ja/LC_MESSAGES/motioneye.po",
"chars": 52486,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/ko/LC_MESSAGES/motioneye.js.po",
"chars": 17247,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/ko/LC_MESSAGES/motioneye.po",
"chars": 51891,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2022 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/ms/LC_MESSAGES/motioneye.js.po",
"chars": 21232,
"preview": "# Malay translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed"
},
{
"path": "motioneye/locale/ms/LC_MESSAGES/motioneye.po",
"chars": 65117,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/nb_NO/LC_MESSAGES/motioneye.js.po",
"chars": 19836,
"preview": "# Norwegian Bokmal translations for PACKAGE package.\n# Copyright (C) 2022 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is "
},
{
"path": "motioneye/locale/nb_NO/LC_MESSAGES/motioneye.po",
"chars": 61246,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2022 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/ne/LC_MESSAGES/motioneye.js.po",
"chars": 15901,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/ne/LC_MESSAGES/motioneye.po",
"chars": 42841,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2025 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/nl/LC_MESSAGES/motioneye.js.po",
"chars": 20109,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/nl/LC_MESSAGES/motioneye.po",
"chars": 63289,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2022 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/pa/LC_MESSAGES/motioneye.js.po",
"chars": 20805,
"preview": "# Punjabi translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribut"
},
{
"path": "motioneye/locale/pa/LC_MESSAGES/motioneye.po",
"chars": 63696,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/pl/LC_MESSAGES/motioneye.js.po",
"chars": 20176,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/pl/LC_MESSAGES/motioneye.po",
"chars": 62250,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2022 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/pt/LC_MESSAGES/motioneye.js.po",
"chars": 20202,
"preview": "# Portuguese translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distri"
},
{
"path": "motioneye/locale/pt/LC_MESSAGES/motioneye.po",
"chars": 65325,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/ro/LC_MESSAGES/motioneye.js.po",
"chars": 20256,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/ro/LC_MESSAGES/motioneye.po",
"chars": 63640,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2022 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/ru/LC_MESSAGES/motioneye.js.po",
"chars": 19877,
"preview": "# Russian translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribut"
},
{
"path": "motioneye/locale/ru/LC_MESSAGES/motioneye.po",
"chars": 62121,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/sk/LC_MESSAGES/motioneye.js.po",
"chars": 20047,
"preview": "# Slovak translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribute"
},
{
"path": "motioneye/locale/sk/LC_MESSAGES/motioneye.po",
"chars": 61993,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/sv/LC_MESSAGES/motioneye.js.po",
"chars": 20039,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/sv/LC_MESSAGES/motioneye.po",
"chars": 62415,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2022 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/ta/LC_MESSAGES/motioneye.js.po",
"chars": 20202,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/ta/LC_MESSAGES/motioneye.po",
"chars": 63410,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2025 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/tr/LC_MESSAGES/motioneye.js.po",
"chars": 19785,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/tr/LC_MESSAGES/motioneye.po",
"chars": 61785,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2024 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/uk/LC_MESSAGES/motioneye.js.po",
"chars": 19949,
"preview": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same "
},
{
"path": "motioneye/locale/uk/LC_MESSAGES/motioneye.po",
"chars": 62565,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2022 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/locale/zh/LC_MESSAGES/motioneye.js.po",
"chars": 16518,
"preview": "# Chinese translations for PACKAGE package.\n# Copyright (C) 2020 THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distribut"
},
{
"path": "motioneye/locale/zh/LC_MESSAGES/motioneye.po",
"chars": 48468,
"preview": "# Translations template for PROJECT.\n# Copyright (C) 2020 ORGANIZATION\n# This file is distributed under the same license"
},
{
"path": "motioneye/mediafiles.py",
"chars": 31914,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/meyectl.py",
"chars": 10026,
"preview": "#!/usr/bin/env python3\n\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free softwa"
},
{
"path": "motioneye/mjpgclient.py",
"chars": 13375,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/monitor.py",
"chars": 2108,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/motionctl.py",
"chars": 15013,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/motioneye_init.py",
"chars": 983,
"preview": "#!/usr/bin/env python3\n\n# Copyright (c) 2022 Jean Michault\n# This file is part of motionEye.\n#\n# motionEye is free softw"
},
{
"path": "motioneye/prefs.py",
"chars": 2717,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/remote.py",
"chars": 27303,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/scripts/migrateconf.sh",
"chars": 3289,
"preview": "#!/usr/bin/env bash\n\nif [[ -z \"$1\" ]]; then\n echo \"Usage: $0 <motion.conf|thread-*.conf>\"\n exit 1\nfi\n\nfile=$1\ntmp_"
},
{
"path": "motioneye/scripts/relayevent.sh",
"chars": 1120,
"preview": "#!/usr/bin/env sh\n\nif [ -z \"$3\" ]; then\n echo \"Usage: $0 <motioneye.conf> <event> <motion_camera_id> [filename]\"\n "
},
{
"path": "motioneye/sendmail.py",
"chars": 8551,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/sendtelegram.py",
"chars": 5801,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/server.py",
"chars": 14480,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/settings.py",
"chars": 4121,
"preview": "import logging\nimport os.path\nimport socket\nimport sys\n\nimport motioneye\n\nconfig_file = None\n\n# interface language\nlingv"
},
{
"path": "motioneye/shell.py",
"chars": 1086,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/static/css/frame.css",
"chars": 540,
"preview": "\n\n /* basic */\n\nbody {\n color: #dddddd;\n background-color: #212121;\n}\n\n\n /* camera frame */\n\ndiv.camera-fram"
},
{
"path": "motioneye/static/css/main.css",
"chars": 26405,
"preview": "\n\n /* basic */\n\n* {\n padding: 0;\n border: 0 solid black;\n margin: 0;\n outline: 0;\n border-spacing: 0;\n"
},
{
"path": "motioneye/static/css/ui.css",
"chars": 8218,
"preview": "\n /* general */\n\n::selection,\n::-moz-selection,\n::-webkit-selection {\n background: #3498db;\n}\n\noption::selection,\n"
},
{
"path": "motioneye/static/js/frame.js",
"chars": 4730,
"preview": "\nvar refreshDisabled = false;\n\n\n /* camera frame */\n\nfunction setupCameraFrame() {\n var cameraFrameDiv = $('div.ca"
},
{
"path": "motioneye/static/js/main.js",
"chars": 203163,
"preview": "\nvar USERNAME_COOKIE = 'meye_username';\nvar PASSWORD_COOKIE = 'meye_password_hash';\nvar CAMERA_FRAMES_CACHE_LIFETIME = 1"
},
{
"path": "motioneye/static/js/motioneye.ar.json",
"chars": 9970,
"preview": "{\"\":{\"language\":\"ar\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"الأحرف ال"
},
{
"path": "motioneye/static/js/motioneye.bn.json",
"chars": 10899,
"preview": "{\"\":{\"language\":\"bn\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"পাসওয়ার্"
},
{
"path": "motioneye/static/js/motioneye.ca.json",
"chars": 11663,
"preview": "{\"\":{\"language\":\"ca\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"no es per"
},
{
"path": "motioneye/static/js/motioneye.cs.json",
"chars": 10786,
"preview": "{\"\":{\"language\":\"cs\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"V heslech"
},
{
"path": "motioneye/static/js/motioneye.da.json",
"chars": 10873,
"preview": "{\"\":{\"language\":\"da\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"Specialte"
},
{
"path": "motioneye/static/js/motioneye.de.json",
"chars": 11526,
"preview": "{\"\":{\"language\":\"de\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"Das Passw"
},
{
"path": "motioneye/static/js/motioneye.el.json",
"chars": 11794,
"preview": "{\"\":{\"language\":\"el\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"δεν επιτρ"
},
{
"path": "motioneye/static/js/motioneye.en.json",
"chars": 10605,
"preview": "{\"\":{\"language\":\"en\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"special c"
},
{
"path": "motioneye/static/js/motioneye.es.json",
"chars": 11540,
"preview": "{\"\":{\"language\":\"es\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"no se per"
},
{
"path": "motioneye/static/js/motioneye.fi.json",
"chars": 10980,
"preview": "{\"\":{\"language\":\"fi\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"erikoisme"
},
{
"path": "motioneye/static/js/motioneye.fr.json",
"chars": 11629,
"preview": "{\"\":{\"language\":\"fr\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"les carac"
},
{
"path": "motioneye/static/js/motioneye.hi.json",
"chars": 10612,
"preview": "{\"\":{\"language\":\"hi\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"पासवर्ड म"
},
{
"path": "motioneye/static/js/motioneye.hu.json",
"chars": 11196,
"preview": "{\"\":{\"language\":\"hu\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"speciális"
},
{
"path": "motioneye/static/js/motioneye.it.json",
"chars": 11546,
"preview": "{\"\":{\"language\":\"it\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"i caratte"
},
{
"path": "motioneye/static/js/motioneye.ja.json",
"chars": 8478,
"preview": "{\"\":{\"language\":\"ja\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"特別署名はパスワー"
},
{
"path": "motioneye/static/js/motioneye.ko.json",
"chars": 8443,
"preview": "{\"\":{\"language\":\"ko\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"암호에 특수문자는"
},
{
"path": "motioneye/static/js/motioneye.ms.json",
"chars": 11011,
"preview": "{\"\":{\"language\":\"ms\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"watak kha"
},
{
"path": "motioneye/static/js/motioneye.nb_NO.json",
"chars": 11031,
"preview": "{\"\":{\"language\":\"nb\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"spesielle"
},
{
"path": "motioneye/static/js/motioneye.ne.json",
"chars": 7069,
"preview": "{\"\":{\"language\":\"ne\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"पासवर्डमा"
},
{
"path": "motioneye/static/js/motioneye.nl.json",
"chars": 11316,
"preview": "{\"\":{\"language\":\"nl\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"het wacht"
},
{
"path": "motioneye/static/js/motioneye.pa.json",
"chars": 10680,
"preview": "{\"\":{\"language\":\"pa\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"ਪਾਸਵਰਡ ਵਿ"
},
{
"path": "motioneye/static/js/motioneye.pl.json",
"chars": 11311,
"preview": "{\"\":{\"language\":\"pl\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"znaki spe"
},
{
"path": "motioneye/static/js/motioneye.pt.json",
"chars": 11306,
"preview": "{\"\":{\"language\":\"pt\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"caractere"
},
{
"path": "motioneye/static/js/motioneye.ro.json",
"chars": 11488,
"preview": "{\"\":{\"language\":\"ro\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"nu sunt p"
},
{
"path": "motioneye/static/js/motioneye.ru.json",
"chars": 10938,
"preview": "{\"\":{\"language\":\"ru\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"спецсимво"
},
{
"path": "motioneye/static/js/motioneye.sk.json",
"chars": 11120,
"preview": "{\"\":{\"language\":\"sk\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"špeciálne"
},
{
"path": "motioneye/static/js/motioneye.sv.json",
"chars": 10869,
"preview": "{\"\":{\"language\":\"sv\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"Särskilda"
},
{
"path": "motioneye/static/js/motioneye.ta.json",
"chars": 11440,
"preview": "{\"\":{\"language\":\"ta\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"கடவுச்சொல"
},
{
"path": "motioneye/static/js/motioneye.tr.json",
"chars": 10892,
"preview": "{\"\":{\"language\":\"tr\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"parola öz"
},
{
"path": "motioneye/static/js/motioneye.uk.json",
"chars": 10992,
"preview": "{\"\":{\"language\":\"uk\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"Спеціальн"
},
{
"path": "motioneye/static/js/motioneye.zh.json",
"chars": 7631,
"preview": "{\"\":{\"language\":\"zh\",\"plural-forms\":\"nplurals=2; plural=(n > 1);\"}\n,\"specialaj signoj ne rajtas en pasvorto\": \"密码中不允许使用特"
},
{
"path": "motioneye/static/js/ui.js",
"chars": 31584,
"preview": "\nvar _modalDialogContexts = [];\n\n\n /* UI widgets */\n\nfunction makeCheckBox($input) {\n $input.each(function () {\n "
},
{
"path": "motioneye/static/js/version.js",
"chars": 237,
"preview": "\n$(window).on('load', function () {\n if (window.parent && window.parent.postMessage) {\n window.parent.postMess"
},
{
"path": "motioneye/tasks.py",
"chars": 3975,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/template.py",
"chars": 2146,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/templates/base.html",
"chars": 1561,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n {% block meta %}\n <meta charset=\"utf-8\">\n <meta name=\"vi"
},
{
"path": "motioneye/templates/main.html",
"chars": 126867,
"preview": "{% extends \"base.html\" %}\n\n{% macro config_item(config, depends=\"\") -%}\n <tr class=\"settings-item additional-config\"\n"
},
{
"path": "motioneye/templates/manifest.json",
"chars": 393,
"preview": "{\n \"lang\": \"en-US\",\n \"short_name\": \"motionEye\",\n \"name\": \"motionEye\",\n \"description\": \"A free video surveill"
},
{
"path": "motioneye/templates/version.html",
"chars": 420,
"preview": "{% extends \"base.html\" %}\n\n{% block script %}\n {{super()}}\n <script>\n var hostname = '{{hostname}}';\n "
},
{
"path": "motioneye/update.py",
"chars": 2983,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/uploadservices.py",
"chars": 42854,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/utils/__init__.py",
"chars": 17283,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/utils/dtconv.py",
"chars": 4737,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/utils/http.py",
"chars": 1408,
"preview": "import inspect\nfrom dataclasses import dataclass\nfrom typing import Any, Hashable, Union\n\n__all__ = ('RtmpUrl', 'RtspUrl"
},
{
"path": "motioneye/utils/mjpeg.py",
"chars": 4465,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/utils/rtmp.py",
"chars": 1254,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/utils/rtsp.py",
"chars": 7957,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "motioneye/webhook.py",
"chars": 2385,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "motioneye/wsswitch.py",
"chars": 4441,
"preview": "# Copyright (c) 2020 Vlsarro\n# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free s"
},
{
"path": "pyproject.toml",
"chars": 1552,
"preview": "[build-system]\nrequires = [\"setuptools>=77.0.3\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"motioneye\"\nd"
},
{
"path": "tests/__init__.py",
"chars": 711,
"preview": "from unittest import mock\n\nfrom tornado.testing import AsyncHTTPTestCase\nfrom tornado.web import Application\n\n__all__ = "
},
{
"path": "tests/test_handlers/__init__.py",
"chars": 611,
"preview": "from typing import Type, TypeVar\nfrom unittest.mock import MagicMock\n\nfrom tornado.testing import AsyncHTTPTestCase\nfrom"
},
{
"path": "tests/test_handlers/test_base.py",
"chars": 1257,
"preview": "import json\nfrom unittest.mock import MagicMock\n\nimport tornado.testing\n\nfrom motioneye.handlers.base import BaseHandler"
},
{
"path": "tests/test_handlers/test_login.py",
"chars": 1289,
"preview": "import json\n\nimport tornado.testing\n\nfrom motioneye.handlers.login import LoginHandler\nfrom tests.test_handlers import H"
},
{
"path": "tests/test_mediafiles.py",
"chars": 11444,
"preview": "# Copyright (c) 2013 Calin Crisan\n# This file is part of motionEye.\n#\n# motionEye is free software: you can redistribute"
},
{
"path": "tests/test_utils/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "tests/test_utils/test_http.py",
"chars": 955,
"preview": "import unittest\n\nfrom motioneye.utils.http import RtspUrl\n\n\nclass TestRTSP(unittest.TestCase):\n def test_url_construc"
},
{
"path": "tests/test_utils/test_mjpeg.py",
"chars": 3109,
"preview": "import tornado.testing\nfrom tornado.concurrent import Future\nfrom tornado.web import RequestHandler\n\nfrom motioneye.util"
}
]
// ... and 32 more files (download for full content)
About this extraction
This page contains the full source code of the motioneye-project/motioneye GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 232 files (3.6 MB), approximately 962.6k tokens, and a symbol index with 655 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.