generated from pavel.muhortov/template-bash
secuences.sh absorbed ssv-scheduler.py
This commit is contained in:
parent
b67822eb57
commit
f70139ed17
24
.vscode/launch.json
vendored
Normal file
24
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"version": "0.2",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Python: cctv-scheduler",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${file}",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"justMyCode": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Python: cctv-scheduler -s",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${file}",
|
||||||
|
"args": [
|
||||||
|
"-s"
|
||||||
|
],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"justMyCode": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
68
README.md
68
README.md
|
@ -1,8 +1,16 @@
|
||||||
# cctv-scheduler
|
# cctv-scheduler
|
||||||
|
|
||||||
PTZ IP-Camera management
|
PTZ IP-Camera management
|
||||||
|
____
|
||||||
|
|
||||||
![cctv-scheduler](info/images/cctv-scheduler-0.1.png)
|
- [`cctv-scheduler.py`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#cctv-scheduler-py)
|
||||||
|
- [`converter.sh`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#converter-sh)
|
||||||
|
- [`publisher.sh`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#publisher-sh)
|
||||||
|
- [`streaming.py`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#streaming-py)
|
||||||
|
|
||||||
|
____
|
||||||
|
|
||||||
|
![cctv-scheduler](info/images/cctv-scheduler-0.2.png)
|
||||||
|
|
||||||
## `Installation`
|
## `Installation`
|
||||||
|
|
||||||
|
@ -22,8 +30,8 @@ Look at the description of dependencies and install the necessary.
|
||||||
Download scripts and configs.
|
Download scripts and configs.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/sequences.sh -O /home/user/cctv-scheduler/sequences.sh
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/cctv-scheduler.py -O /home/user/cctv-scheduler/cctv-scheduler.py
|
||||||
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/sequences.conf -O /home/user/cctv-scheduler/sequences.conf
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/cctv-scheduler.conf -O /home/user/cctv-scheduler/cctv-scheduler.conf
|
||||||
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/converter.sh -O /home/user/cctv-scheduler/converter.sh
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/converter.sh -O /home/user/cctv-scheduler/converter.sh
|
||||||
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/converter.conf -O /home/user/cctv-scheduler/converter.conf
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/converter.conf -O /home/user/cctv-scheduler/converter.conf
|
||||||
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/publisher.sh -O /home/user/cctv-scheduler/publisher.sh
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/publisher.sh -O /home/user/cctv-scheduler/publisher.sh
|
||||||
|
@ -37,7 +45,7 @@ wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/strea
|
||||||
Edit configs.
|
Edit configs.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nano /home/user/cctv-scheduler/sequences.conf
|
nano /home/user/cctv-scheduler/cctv-scheduler.conf
|
||||||
nano /home/user/cctv-scheduler/converter.conf
|
nano /home/user/cctv-scheduler/converter.conf
|
||||||
nano /home/user/cctv-scheduler/publisher.conf
|
nano /home/user/cctv-scheduler/publisher.conf
|
||||||
```
|
```
|
||||||
|
@ -50,19 +58,10 @@ Look at examples and edit scheduler tasks:
|
||||||
crontab -e
|
crontab -e
|
||||||
```
|
```
|
||||||
|
|
||||||
____
|
## `cctv-scheduler`.py
|
||||||
|
|
||||||
- [`sequences.sh`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#sequences-sh)
|
|
||||||
- [`converter.sh`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#converter-sh)
|
|
||||||
- [`publisher.sh`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#publisher-sh)
|
|
||||||
- [`streaming.py`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#streaming-py)
|
|
||||||
|
|
||||||
____
|
|
||||||
|
|
||||||
## `sequences`.sh
|
|
||||||
|
|
||||||
**Description:**
|
**Description:**
|
||||||
> [Hikvision](https://git.hmp.today/pavel.muhortov/cctv-scheduler/src/branch/master/info/hikvision/manual/isapi.pdf) PTZ-camera sequences.
|
> [Hikvision](https://git.hmp.today/pavel.muhortov/cctv-scheduler/src/branch/master/info/hikvision/manual/isapi.pdf) PTZ IP-Camera management.
|
||||||
> Additionally:
|
> Additionally:
|
||||||
>
|
>
|
||||||
> - getting temperature from DS18B20 over SSH,
|
> - getting temperature from DS18B20 over SSH,
|
||||||
|
@ -72,26 +71,27 @@ ____
|
||||||
|
|
||||||
**Dependencies:**
|
**Dependencies:**
|
||||||
>
|
>
|
||||||
> - [bash](https://www.gnu.org/software/bash/) (tested version 5.1.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
> - [Python 3](https://www.python.org/downloads/) (tested version 3.9.5 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
> - [curl](https://curl.se/download.html) (tested version 7.74 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
> - [paramiko](https://www.paramiko.org/) Python 3 module (tested version 3.1.0)
|
||||||
> - [sshpass](https://www.cyberciti.biz/faq/noninteractive-shell-script-ssh-password-provider/) (tested version 1.09 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
|
||||||
|
|
||||||
| POSITION | PARAMETERS | DESCRIPTION | DEFAULT |
|
| PARAMETERS | DESCRIPTION | DEFAULT|
|
||||||
|-----------|--------------|------------------------|---------------|
|
|-------------|-------------|--------|
|
||||||
| 1 | **[qn]** |execution without pauses||
|
|**[-h]**|print help and exit||
|
||||||
| 2 | **[/path/to/conf]** |path to config| ./sequences.conf |
|
|**[-s, --sequences]**|run sequences from config file|`None`|
|
||||||
|
|**[--config]**|custom configuration file path|`./cctv-scheduler.conf`|
|
||||||
|
|
||||||
Example usage in terminal with bash:
|
Example usage in terminal with make the script executable:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash ./sequences.sh - ./sequences.conf
|
chmod u+x ./cctv-scheduler.py
|
||||||
|
./cctv-scheduler.py -s --config /home/user/cctv-scheduler/cctv-scheduler.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
Example usage with cron:
|
Example usage with cron:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# crontab -e
|
# crontab -e
|
||||||
0 * * * * bash /home/user/cctv-scheduler/sequences.sh qn
|
0 * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -s
|
||||||
```
|
```
|
||||||
|
|
||||||
____
|
____
|
||||||
|
@ -132,8 +132,8 @@ ____
|
||||||
| POSITION | PARAMETERS | DESCRIPTION | DEFAULT |
|
| POSITION | PARAMETERS | DESCRIPTION | DEFAULT |
|
||||||
|-----------|--------------|------------------------|---------------|
|
|-----------|--------------|------------------------|---------------|
|
||||||
| 1 | **[qn]** |execution without pauses||
|
| 1 | **[qn]** |execution without pauses||
|
||||||
| 2 | **[/path/to/conf]** |path to config| ./converter.conf |
|
| 2 | **[/path/to/conf]** |path to config| `./converter.conf` |
|
||||||
| 3 | **[-d\|-w\|-m\|-y]** |periods: '' - today \| '-d' - yesterday \| '-w' - last week \| '-m' - last month \| '-y' - last year||
|
| 3 | **[-d\|-w\|-m\|-y]** |periods: '' - today \| '-d' - yesterday \| '-w' - last week \| '-m' - last month \| '-y' - last year|`''`|
|
||||||
|
|
||||||
Example usage in terminal with bash for today's MP4 making:
|
Example usage in terminal with bash for today's MP4 making:
|
||||||
|
|
||||||
|
@ -176,9 +176,9 @@ ____
|
||||||
| POSITION | PARAMETERS | DESCRIPTION | DEFAULT |
|
| POSITION | PARAMETERS | DESCRIPTION | DEFAULT |
|
||||||
|-----------|--------------|------------------------|---------------|
|
|-----------|--------------|------------------------|---------------|
|
||||||
| 1 | **[qn]** |execution without pauses||
|
| 1 | **[qn]** |execution without pauses||
|
||||||
| 2 | **[/path/to/conf]** |path to config| ./converter.conf |
|
| 2 | **[/path/to/conf]** |path to config| `./publisher.conf` |
|
||||||
| 3 | **[-d\|-w\|-m\|-y]** |periods: '' - 0 day \| '-d' - -X day \| '-w' - -X week \| '-m' - -X month \| '-y' - -X year||
|
| 3 | **[-d\|-w\|-m\|-y]** |periods: '' - 0 day \| '-d' - -X day \| '-w' - -X week \| '-m' - -X month \| '-y' - -X year|`''`|
|
||||||
| 4 | **[1\|2\|3..XXX]** |multiplier for period: '' - 1 day\|week\|month\|year|1|
|
| 4 | **[1\|2\|3..XXX]** |multiplier for period: '' - 1 day\|week\|month\|year|`1`|
|
||||||
| 5 | **[--onlytg\|--onlywp]** |'--onlytg' - only publish to Telegram \|'--onlywp' - only publish to Wordpress||
|
| 5 | **[--onlytg\|--onlywp]** |'--onlytg' - only publish to Telegram \|'--onlywp' - only publish to Wordpress||
|
||||||
|
|
||||||
Example usage in terminal with bash for publish to Telegram today's MP4:
|
Example usage in terminal with bash for publish to Telegram today's MP4:
|
||||||
|
@ -235,11 +235,3 @@ Example usage with cron:
|
||||||
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/streaming.py -s rtsp://user:pass@host:554/Streaming/Channels/video,http://Streaming/Channels/audio --dst rtmp://a.rtmp.youtube.com/live2/YOUKEY --mono --watchdog --sec 30 >> /dev/null 2>&1
|
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/streaming.py -s rtsp://user:pass@host:554/Streaming/Channels/video,http://Streaming/Channels/audio --dst rtmp://a.rtmp.youtube.com/live2/YOUKEY --mono --watchdog --sec 30 >> /dev/null 2>&1
|
||||||
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/streaming.py -s ~/media.mp4 --dst rtmp://b.rtmp.youtube.com/live2?backup=1/YOUKEY --mono >> /dev/null 2>&1
|
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/streaming.py -s ~/media.mp4 --dst rtmp://b.rtmp.youtube.com/live2?backup=1/YOUKEY --mono >> /dev/null 2>&1
|
||||||
```
|
```
|
||||||
|
|
||||||
Example usage in Python:
|
|
||||||
|
|
||||||
```Python
|
|
||||||
from streaming import FFmpeg
|
|
||||||
|
|
||||||
FFmpeg.run(src='null, anull', preset='240p', fps=10)
|
|
||||||
```
|
|
||||||
|
|
245
archive/0.1/README.md
Normal file
245
archive/0.1/README.md
Normal file
|
@ -0,0 +1,245 @@
|
||||||
|
# cctv-scheduler
|
||||||
|
|
||||||
|
PTZ IP-Camera management
|
||||||
|
|
||||||
|
![cctv-scheduler](info/images/cctv-scheduler-0.1.png)
|
||||||
|
|
||||||
|
## `Installation`
|
||||||
|
|
||||||
|
### `Requirements`
|
||||||
|
|
||||||
|
Cameras settings:
|
||||||
|
>
|
||||||
|
> - Configuration -> System -> Security -> Authentication -> RTSP Authentication: digest/basic
|
||||||
|
> - Configuration -> System -> Security -> Authentication -> WEB Authentication: digest/basic
|
||||||
|
> - Configuration -> Network -> Advanced Settings -> Integration Protocol -> Enable Hikvision-CGI: Enabled
|
||||||
|
> - Configuration -> Network -> Advanced Settings -> Integration Protocol -> Hikvision-CGI Authentication: digest/basic
|
||||||
|
|
||||||
|
Look at the description of dependencies and install the necessary.
|
||||||
|
|
||||||
|
### `Downloading`
|
||||||
|
|
||||||
|
Download scripts and configs.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/sequences.sh -O /home/user/cctv-scheduler/sequences.sh
|
||||||
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/sequences.conf -O /home/user/cctv-scheduler/sequences.conf
|
||||||
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/converter.sh -O /home/user/cctv-scheduler/converter.sh
|
||||||
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/converter.conf -O /home/user/cctv-scheduler/converter.conf
|
||||||
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/publisher.sh -O /home/user/cctv-scheduler/publisher.sh
|
||||||
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/publisher.conf -O /home/user/cctv-scheduler/publisher.conf
|
||||||
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/publisher-template-page-1007.xml -O /home/user/cctv-scheduler/publisher-template-page-1007.xml
|
||||||
|
wget https://git.hmp.today/pavel.muhortov/cctv-scheduler/raw/branch/master/streaming.py -O /home/user/cctv-scheduler/streaming.py
|
||||||
|
```
|
||||||
|
|
||||||
|
### `Configuration`
|
||||||
|
|
||||||
|
Edit configs.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nano /home/user/cctv-scheduler/sequences.conf
|
||||||
|
nano /home/user/cctv-scheduler/converter.conf
|
||||||
|
nano /home/user/cctv-scheduler/publisher.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
### `Scheduler`
|
||||||
|
|
||||||
|
Look at examples and edit scheduler tasks:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
crontab -e
|
||||||
|
```
|
||||||
|
|
||||||
|
____
|
||||||
|
|
||||||
|
- [`sequences.sh`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#sequences-sh)
|
||||||
|
- [`converter.sh`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#converter-sh)
|
||||||
|
- [`publisher.sh`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#publisher-sh)
|
||||||
|
- [`streaming.py`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#streaming-py)
|
||||||
|
|
||||||
|
____
|
||||||
|
|
||||||
|
## `sequences`.sh
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
> [Hikvision](https://git.hmp.today/pavel.muhortov/cctv-scheduler/src/branch/master/info/hikvision/manual/isapi.pdf) PTZ-camera sequences.
|
||||||
|
> Additionally:
|
||||||
|
>
|
||||||
|
> - getting temperature from DS18B20 over SSH,
|
||||||
|
> - saving pictures to FTP.
|
||||||
|
>
|
||||||
|
> This is only a local "proof of conept" for testing and debugging.
|
||||||
|
|
||||||
|
**Dependencies:**
|
||||||
|
>
|
||||||
|
> - [bash](https://www.gnu.org/software/bash/) (tested version 5.1.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
> - [curl](https://curl.se/download.html) (tested version 7.74 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
> - [sshpass](https://www.cyberciti.biz/faq/noninteractive-shell-script-ssh-password-provider/) (tested version 1.09 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
|
||||||
|
| POSITION | PARAMETERS | DESCRIPTION | DEFAULT |
|
||||||
|
|-----------|--------------|------------------------|---------------|
|
||||||
|
| 1 | **[qn]** |execution without pauses||
|
||||||
|
| 2 | **[/path/to/conf]** |path to config| ./sequences.conf |
|
||||||
|
|
||||||
|
Example usage in terminal with bash:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash ./sequences.sh - ./sequences.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
Example usage with cron:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# crontab -e
|
||||||
|
0 * * * * bash /home/user/cctv-scheduler/sequences.sh qn
|
||||||
|
```
|
||||||
|
|
||||||
|
____
|
||||||
|
|
||||||
|
## `converter`.sh
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
> JPEG to MP4 converter.
|
||||||
|
>
|
||||||
|
> This is only a local "proof of conept" for testing and debugging.
|
||||||
|
|
||||||
|
**Dependencies:**
|
||||||
|
>
|
||||||
|
> - [bash](https://www.gnu.org/software/bash/) (tested version 5.1.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
> - [ffmpeg](https://ffmpeg.org/download.html) (tested version 4.3.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
> - filesystem organization:
|
||||||
|
>
|
||||||
|
>```bash
|
||||||
|
> # filesystem organisation example
|
||||||
|
>/root/
|
||||||
|
> /2022/
|
||||||
|
> /12/
|
||||||
|
> /52/
|
||||||
|
> /31/
|
||||||
|
> /image-01_2022.12.31_time.jpeg
|
||||||
|
> /image-02_2022.12.31_time.jpeg
|
||||||
|
> /2023/
|
||||||
|
> /01/
|
||||||
|
> /01/
|
||||||
|
> /02/
|
||||||
|
> /image-01_2023.01.02_time.jpeg
|
||||||
|
> /image-02_2023.01.02_time.jpeg
|
||||||
|
> /03/
|
||||||
|
> /image-01_2023.01.03_time.jpeg
|
||||||
|
> /image-02_2023.01.03_time.jpeg
|
||||||
|
>```
|
||||||
|
|
||||||
|
| POSITION | PARAMETERS | DESCRIPTION | DEFAULT |
|
||||||
|
|-----------|--------------|------------------------|---------------|
|
||||||
|
| 1 | **[qn]** |execution without pauses||
|
||||||
|
| 2 | **[/path/to/conf]** |path to config| ./converter.conf |
|
||||||
|
| 3 | **[-d\|-w\|-m\|-y]** |periods: '' - today \| '-d' - yesterday \| '-w' - last week \| '-m' - last month \| '-y' - last year||
|
||||||
|
|
||||||
|
Example usage in terminal with bash for today's MP4 making:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash ./converter.sh - ./converter.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
Example usage with cron:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# crontab -e
|
||||||
|
1 0 * * * bash /home/user/cctv-scheduler/converter.sh qn - -d
|
||||||
|
7 0 * * 1 bash /home/user/cctv-scheduler/converter.sh qn - -w
|
||||||
|
30 0 1 * * bash /home/user/cctv-scheduler/converter.sh qn - -m
|
||||||
|
36 0 1 1 * bash /home/user/cctv-scheduler/converter.sh qn - -y
|
||||||
|
```
|
||||||
|
|
||||||
|
____
|
||||||
|
|
||||||
|
## `publisher`.sh
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
> Uploading MP4 to [Wordpress](https://wordpress.com/) and [Telegram](https://web.telegram.org/).
|
||||||
|
> Additionally:
|
||||||
|
>
|
||||||
|
> - editing [Wordpress](https://codex.wordpress.org/XML-RPC_WordPress_API) page from template
|
||||||
|
> - recompressing video if size [over 50MB](https://core.telegram.org/bots/api#sendvideo)
|
||||||
|
>
|
||||||
|
> This is only a local "proof of conept" for testing and debugging.
|
||||||
|
|
||||||
|
**Dependencies:**
|
||||||
|
>
|
||||||
|
> - [bash](https://www.gnu.org/software/bash/) (tested version 5.1.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
> - [curl](https://curl.se/download.html) (tested version 7.74 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
> - [ffmpeg](https://ffmpeg.org/download.html) (tested version 4.3.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
> - [libxml2-utils](https://gitlab.gnome.org/GNOME/libxml2) (tested version 2.9.10 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
> - [jq](https://stedolan.github.io/jq/download/) (tested version 1.6 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
>
|
||||||
|
|
||||||
|
| POSITION | PARAMETERS | DESCRIPTION | DEFAULT |
|
||||||
|
|-----------|--------------|------------------------|---------------|
|
||||||
|
| 1 | **[qn]** |execution without pauses||
|
||||||
|
| 2 | **[/path/to/conf]** |path to config| ./converter.conf |
|
||||||
|
| 3 | **[-d\|-w\|-m\|-y]** |periods: '' - 0 day \| '-d' - -X day \| '-w' - -X week \| '-m' - -X month \| '-y' - -X year||
|
||||||
|
| 4 | **[1\|2\|3..XXX]** |multiplier for period: '' - 1 day\|week\|month\|year|1|
|
||||||
|
| 5 | **[--onlytg\|--onlywp]** |'--onlytg' - only publish to Telegram \|'--onlywp' - only publish to Wordpress||
|
||||||
|
|
||||||
|
Example usage in terminal with bash for publish to Telegram today's MP4:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash ./publisher.sh - ./publisher.conf - - - - --onlytg
|
||||||
|
```
|
||||||
|
|
||||||
|
Example usage with cron:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# crontab -e
|
||||||
|
1 1 * * * bash /home/user/cctv-scheduler/publisher.sh qn - -d
|
||||||
|
7 1 * * 1 bash /home/user/cctv-scheduler/publisher.sh qn - -w
|
||||||
|
30 1 1 * * bash /home/user/cctv-scheduler/publisher.sh qn - -m
|
||||||
|
36 1 1 1 * bash /home/user/cctv-scheduler/publisher.sh qn - -y
|
||||||
|
```
|
||||||
|
|
||||||
|
____
|
||||||
|
|
||||||
|
## `streaming`.py
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
> FFmpeg management from Python
|
||||||
|
|
||||||
|
**Dependencies:**
|
||||||
|
>
|
||||||
|
> - [Python 3](https://www.python.org/downloads/) (tested version 3.9.5 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
> - [ffmpeg](https://ffmpeg.org/download.html) (tested version 4.3.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
|
||||||
|
|
||||||
|
| PARAMETERS | DESCRIPTION | DEFAULT|
|
||||||
|
|-------------|-------------|--------|
|
||||||
|
|**-s**, **--src**|sources urls|**REQUIRED**|
|
||||||
|
|**[-h]**|print help and exit||
|
||||||
|
|**[--preset]**|240p, 360p, 480p, 720p, 1080p, 1440p, 2160p|`None`|
|
||||||
|
|**[--fps]**|frame per second encoding output|`None`|
|
||||||
|
|**[--dst]**|destination url|`None`|
|
||||||
|
|**[--ffpath]**|alternative path to bin|`None`|
|
||||||
|
|**[--watchdog]**|detect ffmpeg freeze and terminate||
|
||||||
|
|**[--sec]**|seconds to wait before the watchdog terminates|15|
|
||||||
|
|**[--mono]**|detect ffmpeg running copy and terminate||
|
||||||
|
|
||||||
|
Example usage in terminal with make the script executable:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod u+x ./streaming.py
|
||||||
|
./streaming.py -s rtsp://user:pass@host:554/Streaming/Channels/101 --dst rtp://239.0.0.1:5554
|
||||||
|
```
|
||||||
|
|
||||||
|
Example usage with cron:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# crontab -e
|
||||||
|
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/streaming.py -s rtsp://user:pass@host:554/Streaming/Channels/video,http://Streaming/Channels/audio --dst rtmp://a.rtmp.youtube.com/live2/YOUKEY --mono --watchdog --sec 30 >> /dev/null 2>&1
|
||||||
|
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/streaming.py -s ~/media.mp4 --dst rtmp://b.rtmp.youtube.com/live2?backup=1/YOUKEY --mono >> /dev/null 2>&1
|
||||||
|
```
|
||||||
|
|
||||||
|
Example usage in Python:
|
||||||
|
|
||||||
|
```Python
|
||||||
|
from streaming import FFmpeg
|
||||||
|
|
||||||
|
FFmpeg.run(src='null, anull', preset='240p', fps=10)
|
||||||
|
```
|
81
cctv-scheduler.conf
Normal file
81
cctv-scheduler.conf
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
[common]
|
||||||
|
# By default, a temporary files directory is created in the same path where the script is located.
|
||||||
|
# If you need change it, uncomment the parameter and set the path you want.
|
||||||
|
#temp_path = /tmp/cctv-scheduler
|
||||||
|
#
|
||||||
|
# By default, logs use the same directory where the script is located.
|
||||||
|
# If you need change it, uncomment the parameter and set the path you want.
|
||||||
|
#log_root = /var/log/cctv-scheduler
|
||||||
|
#
|
||||||
|
# The default log level is "INFO".
|
||||||
|
# If you get errors or want to change the logging level, uncomment the parameter and set the level you want:
|
||||||
|
# DEBUG, INFO, WARNING, ERROR, CRITICAL.
|
||||||
|
#log_level = DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
[enable-sensors]
|
||||||
|
# List the sensor block names. Only blocks with the TRUE value will be used.
|
||||||
|
sensor.test.local = true
|
||||||
|
|
||||||
|
|
||||||
|
[sensor-config:sensor.test.local]
|
||||||
|
# Remote host's sensor parameter description block always starts with "sensor-config:".
|
||||||
|
hostname = 192.168.254.252
|
||||||
|
username = user
|
||||||
|
userpass = pass
|
||||||
|
# To recognize options for polling a sensor, you must specify the type of sensor.
|
||||||
|
# Supported types:
|
||||||
|
# ds18b20
|
||||||
|
nodetype = ds18b20
|
||||||
|
nodename = 28-1a2b3c4d5e6f
|
||||||
|
|
||||||
|
|
||||||
|
[enable-sequences]
|
||||||
|
# List the sequence/camera block names. Only blocks with the TRUE value will be used.
|
||||||
|
camera.test.local = true
|
||||||
|
|
||||||
|
|
||||||
|
[camera-config:camera.test.local]
|
||||||
|
# Camera parameter description block always starts with "camera-config:".
|
||||||
|
hostname = 192.168.254.253
|
||||||
|
username = user
|
||||||
|
userpass = pass
|
||||||
|
# If a record directory on a remote host is used, a username and password must be specified.
|
||||||
|
# Supported protocols:
|
||||||
|
# FTP, SFTP.
|
||||||
|
records_root_path = ftp://192.168.254.254/Records/camera.test.local
|
||||||
|
records_root_user = user
|
||||||
|
records_root_pass = pass
|
||||||
|
|
||||||
|
|
||||||
|
[camera-sequences:camera.test.local]
|
||||||
|
# Camera sequence description block always starts with "camera-sequences:".
|
||||||
|
# Place only the sequence of PTZ-actions in this block!
|
||||||
|
# Variable name can be anything. Only 'downloadjpeg' is using this for filename prefix.
|
||||||
|
# Available actions:
|
||||||
|
# setcamerapos, setcameramov, settextonosd, downloadjpeg, capabilities, getcamerapos,
|
||||||
|
# setptzmovyyu, setptzmovyyd, setptzmovxxl, setptzmovxxr, setptzmovzzi, setptzmovzzo,
|
||||||
|
# setptzpreset, setptztostop, setmovtohome, setposashome, rebootcamera.
|
||||||
|
#
|
||||||
|
# Format (spaces are used for readability only):
|
||||||
|
# name = action, x, y, zoom, preset, speed, d(ms), w(s), text, notes or anything
|
||||||
|
step001 = capabilities, -, -, -, -, -, -, 3, ,
|
||||||
|
step002 = getcamerapos, -, -, -, -, -, -, 3, ,
|
||||||
|
step011 = setmovtohome, -, -, -, -, -, -, 15, ,
|
||||||
|
step021 = setptzmovyyd, -, -, -, -, 2, -, 5, , 'speed: 1..7'
|
||||||
|
step022 = setptzmovyyu, -, -, -, -, 4, -, 3, , 'speed: 1..7'
|
||||||
|
step023 = setptzmovxxl, -, -, -, -, 4, -, 3, , 'speed: 1..7'
|
||||||
|
step024 = setptzmovxxr, -, -, -, -, 2, -, 5, , 'speed: 1..7'
|
||||||
|
step025 = setptzmovzzi, -, -, -, -, 7, -, 3, , 'speed: 1..7'
|
||||||
|
step026 = setptzmovzzo, -, -, -, -, 7, -, 3, , 'speed: 1..7'
|
||||||
|
step027 = setptztostop, -, -, -, -, -, -, 3, ,
|
||||||
|
step031 = setptzpreset, -, -, -, 2, 1, -, 15, , 'speed: 1..7'
|
||||||
|
step041 = setcameramov, 33, 33, 66, -, -, -, 5, , 'x: -100..100, y: -100..100, z: -100..100, duration: 0..180000'
|
||||||
|
step042 = setcameramov, -66, -66, -99, -, -, 5000, 0, , 'x: -100..100, y: -100..100, z: -100..100, duration: 0..180000'
|
||||||
|
step043 = setcamerapos, 0, 0, 0, -, -, -, 15, , 'x: 0..3600, y: -900..2700, z: 0..1000'
|
||||||
|
step051 = setposashome, -, -, -, -, -, -, 3.5, ,
|
||||||
|
step061 = settextonosd, 0, 0, -, -, -, -, 3, hello, 'x|y: osd text position, text: text for osd without quotes or commas'
|
||||||
|
step062 = settextonosd, 0, 0, -, -, -, -, 3, sensor-config:sensor.test.local, 'if a sensor configuration is specified, the sensor value is used instead of text'
|
||||||
|
step063 = settextonosd, 0, 0, -, -, -, -, 3, , 'an empty text value is used to clear the osd'
|
||||||
|
step071 = downloadjpeg, 1280, 720, -, -, -, -, 5, , 'name: filename prefix, x|y: camera width|height resolution'
|
||||||
|
step999 = rebootcamera, -, -, -, -, -, -, 120, ,
|
1240
cctv-scheduler.py
Normal file
1240
cctv-scheduler.py
Normal file
File diff suppressed because it is too large
Load Diff
BIN
info/images/cctv-scheduler-0.2.png
Normal file
BIN
info/images/cctv-scheduler-0.2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 279 KiB |
Loading…
Reference in New Issue
Block a user