diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-15 04:51:53 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-15 04:51:53 +0000 |
commit | 1cd7d30faaa96d53bcb01cd066e8f3c662f6f364 (patch) | |
tree | 4c2867600fe3115b9d4832bc5e0c431bb6f3d004 | |
parent | 18c56082510809eb3850b73d565eff7cb704a468 (diff) |
automatic import of python-libpyvivotek
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-libpyvivotek.spec | 402 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 404 insertions, 0 deletions
@@ -0,0 +1 @@ +/libpyvivotek-0.4.0.tar.gz diff --git a/python-libpyvivotek.spec b/python-libpyvivotek.spec new file mode 100644 index 0000000..318a69e --- /dev/null +++ b/python-libpyvivotek.spec @@ -0,0 +1,402 @@ +%global _empty_manifest_terminate_build 0 +Name: python-libpyvivotek +Version: 0.4.0 +Release: 1 +Summary: Python Library for Vivotek IP Cameras +License: LGPLv3+ +URL: https://github.com/HarlemSquirrel/python-vivotek +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/d9/0d/0fa80b1b3cb707eed1a52da6f6e2fcdefeb108d0ef8219d94291af587895/libpyvivotek-0.4.0.tar.gz +BuildArch: noarch + + +%description +# python-vivotek + +[](https://travis-ci.org/HarlemSquirrel/python-vivotek) [](https://codeclimate.com/github/HarlemSquirrel/python-vivotek/maintainability) + +A Python library for Vivotek IP cameras. + +## Getting Started + +### Install + +This library currently supports Python 3.4 and up. + +```sh +pip3 install libpyvivotek + +# Or for only the current user +pip3 install --user libpyvivotek +``` + +### Usage + +```py +from libpyvivotek import VivotekCamera + +cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', pwd='passw0rd', + digest_auth=True, ssl=True, verify_ssl=True, sec_lvl='admin') +print("Camera model is %s" % cam.model_name) +# Camera model is IB8369A +``` + +#### Security Level + +Four security levels are currently supported: +- anonymous +- viewer +- operator +- admin + +Using the `anonymous` security level does not require a user or password. The `operator` or `admin` security level is required to set parameters. + +### Load password from Keyring + +We can use [Python Keyring](https://pypi.org/project/keyring/) to load the password rather than from a string. + +```sh +# Install the package +pip install --user keyring + +# Set the password using the command-line interface. +python -m keyring set camera user passw0rd +``` + +```py +import keyring +from libpyvivotek import VivotekCamera + +cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', + pwd=keyring.get_password('camera', 'user')) +print("Camera model is %s" % cam.model_name) +# Camera model is IB8369A +``` + +### View a snapshot image + +We can optionally specify the image quality to `snapshot()` from 1 to 5 with a default of 3. + +```py +from libpyvivotek import VivotekCamera +from PIL import Image +from io import BytesIO +import keyring + +cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', + pwd=keyring.get_password('camera', 'user')) + +snapshot = Image.open(BytesIO(cam.snapshot(quality=3))) + +snapshot.show() +``` + +### Getting parameters + +```py +cam.get_param('capability_api_httpversion') +# "0311b_1" + +cam.get_param('capability_naudioin') +# "0" + +cam.get_param('capability_protocol_https') +# "1" + +cam.get_param('event_i0_enable') +# "1" + +cam.get_param('motion_c0_enable') +# "1" +``` + +### Setting parameters + +```py +cam.set_param('event_i0_enable', 1) +# "1" + +cam.set_param('event_i0_enable', 0) +# "0" +``` + + + + +%package -n python3-libpyvivotek +Summary: Python Library for Vivotek IP Cameras +Provides: python-libpyvivotek +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-libpyvivotek +# python-vivotek + +[](https://travis-ci.org/HarlemSquirrel/python-vivotek) [](https://codeclimate.com/github/HarlemSquirrel/python-vivotek/maintainability) + +A Python library for Vivotek IP cameras. + +## Getting Started + +### Install + +This library currently supports Python 3.4 and up. + +```sh +pip3 install libpyvivotek + +# Or for only the current user +pip3 install --user libpyvivotek +``` + +### Usage + +```py +from libpyvivotek import VivotekCamera + +cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', pwd='passw0rd', + digest_auth=True, ssl=True, verify_ssl=True, sec_lvl='admin') +print("Camera model is %s" % cam.model_name) +# Camera model is IB8369A +``` + +#### Security Level + +Four security levels are currently supported: +- anonymous +- viewer +- operator +- admin + +Using the `anonymous` security level does not require a user or password. The `operator` or `admin` security level is required to set parameters. + +### Load password from Keyring + +We can use [Python Keyring](https://pypi.org/project/keyring/) to load the password rather than from a string. + +```sh +# Install the package +pip install --user keyring + +# Set the password using the command-line interface. +python -m keyring set camera user passw0rd +``` + +```py +import keyring +from libpyvivotek import VivotekCamera + +cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', + pwd=keyring.get_password('camera', 'user')) +print("Camera model is %s" % cam.model_name) +# Camera model is IB8369A +``` + +### View a snapshot image + +We can optionally specify the image quality to `snapshot()` from 1 to 5 with a default of 3. + +```py +from libpyvivotek import VivotekCamera +from PIL import Image +from io import BytesIO +import keyring + +cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', + pwd=keyring.get_password('camera', 'user')) + +snapshot = Image.open(BytesIO(cam.snapshot(quality=3))) + +snapshot.show() +``` + +### Getting parameters + +```py +cam.get_param('capability_api_httpversion') +# "0311b_1" + +cam.get_param('capability_naudioin') +# "0" + +cam.get_param('capability_protocol_https') +# "1" + +cam.get_param('event_i0_enable') +# "1" + +cam.get_param('motion_c0_enable') +# "1" +``` + +### Setting parameters + +```py +cam.set_param('event_i0_enable', 1) +# "1" + +cam.set_param('event_i0_enable', 0) +# "0" +``` + + + + +%package help +Summary: Development documents and examples for libpyvivotek +Provides: python3-libpyvivotek-doc +%description help +# python-vivotek + +[](https://travis-ci.org/HarlemSquirrel/python-vivotek) [](https://codeclimate.com/github/HarlemSquirrel/python-vivotek/maintainability) + +A Python library for Vivotek IP cameras. + +## Getting Started + +### Install + +This library currently supports Python 3.4 and up. + +```sh +pip3 install libpyvivotek + +# Or for only the current user +pip3 install --user libpyvivotek +``` + +### Usage + +```py +from libpyvivotek import VivotekCamera + +cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', pwd='passw0rd', + digest_auth=True, ssl=True, verify_ssl=True, sec_lvl='admin') +print("Camera model is %s" % cam.model_name) +# Camera model is IB8369A +``` + +#### Security Level + +Four security levels are currently supported: +- anonymous +- viewer +- operator +- admin + +Using the `anonymous` security level does not require a user or password. The `operator` or `admin` security level is required to set parameters. + +### Load password from Keyring + +We can use [Python Keyring](https://pypi.org/project/keyring/) to load the password rather than from a string. + +```sh +# Install the package +pip install --user keyring + +# Set the password using the command-line interface. +python -m keyring set camera user passw0rd +``` + +```py +import keyring +from libpyvivotek import VivotekCamera + +cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', + pwd=keyring.get_password('camera', 'user')) +print("Camera model is %s" % cam.model_name) +# Camera model is IB8369A +``` + +### View a snapshot image + +We can optionally specify the image quality to `snapshot()` from 1 to 5 with a default of 3. + +```py +from libpyvivotek import VivotekCamera +from PIL import Image +from io import BytesIO +import keyring + +cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', + pwd=keyring.get_password('camera', 'user')) + +snapshot = Image.open(BytesIO(cam.snapshot(quality=3))) + +snapshot.show() +``` + +### Getting parameters + +```py +cam.get_param('capability_api_httpversion') +# "0311b_1" + +cam.get_param('capability_naudioin') +# "0" + +cam.get_param('capability_protocol_https') +# "1" + +cam.get_param('event_i0_enable') +# "1" + +cam.get_param('motion_c0_enable') +# "1" +``` + +### Setting parameters + +```py +cam.set_param('event_i0_enable', 1) +# "1" + +cam.set_param('event_i0_enable', 0) +# "0" +``` + + + + +%prep +%autosetup -n libpyvivotek-0.4.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-libpyvivotek -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.4.0-1 +- Package Spec generated @@ -0,0 +1 @@ +39abf2a8863b5a91805f481ef7558b62 libpyvivotek-0.4.0.tar.gz |