Compare commits

...

17 Commits

21 changed files with 10925 additions and 1172 deletions

1
.gitignore vendored
View File

@ -22,6 +22,7 @@ dist/
downloads/ downloads/
test/ test/
tmp/ tmp/
temp/
var/ var/
*.log *.log
*.list *.list

40
.vscode/launch.json vendored
View File

@ -30,6 +30,46 @@
], ],
"console": "integratedTerminal", "console": "integratedTerminal",
"justMyCode": true "justMyCode": true
},
{
"name": "Python: cctv-scheduler -c -w -3",
"type": "python",
"request": "launch",
"program": "${file}",
"args": [
"-c",
"-w",
"-3"
],
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Python: cctv-scheduler -p -w -3",
"type": "python",
"request": "launch",
"program": "${file}",
"args": [
"-p",
"-w",
"-3"
],
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Python: cctv-scheduler -w -3 -c -p",
"type": "python",
"request": "launch",
"program": "${file}",
"args": [
"-w",
"-3",
"-c",
"-p"
],
"console": "integratedTerminal",
"justMyCode": true
} }
] ]
} }

136
README.md
View File

@ -4,12 +4,10 @@ PTZ IP-Camera management
____ ____
- [`cctv-scheduler.py`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#cctv-scheduler-py) - [`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)
____ ____
![cctv-scheduler](info/images/cctv-scheduler-0.3.png) ![cctv-scheduler](info/images/cctv-scheduler-0.5.png)
## `Installation` ## `Installation`
@ -31,11 +29,6 @@ Download scripts and configs.
```bash ```bash
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/cctv-scheduler.py -O /home/user/cctv-scheduler/cctv-scheduler.py
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/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.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
``` ```
### `Configuration` ### `Configuration`
@ -44,8 +37,6 @@ Edit configs.
```bash ```bash
nano /home/user/cctv-scheduler/cctv-scheduler.conf nano /home/user/cctv-scheduler/cctv-scheduler.conf
nano /home/user/cctv-scheduler/converter.conf
nano /home/user/cctv-scheduler/publisher.conf
``` ```
### `Scheduler` ### `Scheduler`
@ -59,59 +50,26 @@ crontab -e
## `cctv-scheduler`.py ## `cctv-scheduler`.py
**Description:** **Description:**
> [Hikvision](https://git.hmp.today/pavel.muhortov/cctv-scheduler/src/branch/master/info/hikvision/manual/isapi.pdf) PTZ IP-Camera management. Media streaming. > [Hikvision](https://git.hmp.today/pavel.muhortov/cctv-scheduler/src/branch/master/info/hikvision/manual/isapi.pdf) PTZ IP-Camera management. Media streaming. Images to video converting.
> Additionally: > Additionally:
> >
> - getting temperature from DS18B20 over SSH, > - getting temperature from DS18B20 over SSH,
> - saving pictures to FTP. > - saving pictures to FTP.
> - converting picture collection to video.
> - publishing video to Telegram chat and Wordpress site.
> >
> This is only a local "proof of conept" for testing and debugging. > This is only a local "proof of concept" for testing and debugging.
**Dependencies:** **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/)) > - [Python 3](https://www.python.org/downloads/) (tested version 3.9.5 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) > - [paramiko](https://www.paramiko.org/) Python 3 module (tested version 3.1.0)
> - [smbprotocol](https://github.com/jborean93/smbprotocol) Python 3 module (tested version 1.10.1)
> - [ffmpeg](https://ffmpeg.org) (tested version 4.3.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/)) > - [ffmpeg](https://ffmpeg.org) (tested version 4.3.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
> - specified record pictures filesystem organization
| PARAMETERS | DESCRIPTION | DEFAULT|
|-------------|-------------|--------|
|**[-h]**|print help and exit||
|**[-b, --broadcast]**|streaming media to destination|`None`|
|**[-s, --sequences]**|run sequences from config file|`None`|
|**[--config]**|custom configuration file path|`./cctv-scheduler.conf`|
Example usage in terminal with make the script executable:
```bash
chmod u+x ./cctv-scheduler.py
./cctv-scheduler.py -s --config /home/user/cctv-scheduler/cctv-scheduler.conf
```
Example usage with cron:
```bash
# crontab -e
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -b
0 * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -s
```
____
## `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 >```bash
> # filesystem organisation example > # record pictures filesystem organization example
>/root/ >/root/
> /2022/ > /2022/
> /12/ > /12/
@ -130,70 +88,34 @@ ____
> /image-02_2023.01.03_time.jpeg > /image-02_2023.01.03_time.jpeg
>``` >```
| POSITION | PARAMETERS | DESCRIPTION | DEFAULT | | PARAMETERS | DESCRIPTION | DEFAULT|
|-----------|--------------|------------------------|---------------| |-------------|-------------|--------|
| 1 | **[qn]** |execution without pauses|| |**[-h]**|print help and exit||
| 2 | **[/path/to/conf]** |path to config| `./converter.conf` | |**[-b, --broadcast]**|streaming media to destination|`None`|
| 3 | **[-d\|-w\|-m\|-y]** |periods: '' - today \| '-d' - yesterday \| '-w' - last week \| '-m' - last month \| '-y' - last year|`''`| |**[-s, --sequences]**|run sequences from config file|`None`|
|**[--config]**|custom configuration file path|`./cctv-scheduler.conf`|
|**[-c, --converter]**|convert JPEG collection to MP4|`None`|
|**[-p, --publisher]**|publish content from templates|`None`|
|**[-d, --day]**|day in amount of days from today, for which the publication or conversion is made|`0`|
|**[-w, --week]**|week in amount of weeks from today, for which the publication or conversion is made|`0`|
|**[-m, --month]**|month in amount of months from today, for which the publication or conversion is made|`0`|
|**[-y, --year]**|year in amount of years from today, for which the publication or conversion is made|`0`|
Example usage in terminal with bash for today's MP4 making: Example usage in terminal with make the script executable:
```bash ```bash
bash ./converter.sh - ./converter.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
1 0 * * * bash /home/user/cctv-scheduler/converter.sh qn - -d * * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -b
7 0 * * 1 bash /home/user/cctv-scheduler/converter.sh qn - -w 0 * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -s
30 0 1 * * bash /home/user/cctv-scheduler/converter.sh qn - -m 1 0 * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -d -1 -c -p
36 0 1 1 * bash /home/user/cctv-scheduler/converter.sh qn - -y 7 0 * * 1 /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -w -1 -c -p
``` 30 0 1 * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -m -1 -c -p
36 0 1 1 * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -y -1 -c -p
____
## `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| `./publisher.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
``` ```

199
archive/0.3/README.md Normal file
View File

@ -0,0 +1,199 @@
# cctv-scheduler
PTZ IP-Camera management
____
- [`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)
____
![cctv-scheduler](info/images/cctv-scheduler-0.3.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/cctv-scheduler.py -O /home/user/cctv-scheduler/cctv-scheduler.py
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.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
```
### `Configuration`
Edit configs.
```bash
nano /home/user/cctv-scheduler/cctv-scheduler.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
```
## `cctv-scheduler`.py
**Description:**
> [Hikvision](https://git.hmp.today/pavel.muhortov/cctv-scheduler/src/branch/master/info/hikvision/manual/isapi.pdf) PTZ IP-Camera management. Media streaming.
> Additionally:
>
> - getting temperature from DS18B20 over SSH,
> - saving pictures to FTP.
>
> This is only a local "proof of conept" for testing and debugging.
**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/))
> - [paramiko](https://www.paramiko.org/) Python 3 module (tested version 3.1.0)
> - [ffmpeg](https://ffmpeg.org) (tested version 4.3.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
| PARAMETERS | DESCRIPTION | DEFAULT|
|-------------|-------------|--------|
|**[-h]**|print help and exit||
|**[-b, --broadcast]**|streaming media to destination|`None`|
|**[-s, --sequences]**|run sequences from config file|`None`|
|**[--config]**|custom configuration file path|`./cctv-scheduler.conf`|
Example usage in terminal with make the script executable:
```bash
chmod u+x ./cctv-scheduler.py
./cctv-scheduler.py -s --config /home/user/cctv-scheduler/cctv-scheduler.conf
```
Example usage with cron:
```bash
# crontab -e
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -b
0 * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -s
```
____
## `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| `./publisher.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
```

112
archive/0.3/cctv-scheduler.conf Executable file
View File

@ -0,0 +1,112 @@
[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-broadcast]
# List the broadcast block names. Only blocks with the TRUE value will be used.
camera.test.local = true
[enable-sequences]
# List the sequence/camera block names. Only blocks with the TRUE value will be used.
camera.test.local = true
[enable-sensors]
# List the sensor block names. Only blocks with the TRUE value will be used.
sensor.test.local = true
[broadcast-config:camera.test.local]
# Broadcast parameter description block always starts with "broadcast-config:".
src = rtsp://user:pass@192.168.254.253:554/Streaming/Channels/101,http://radio.fm:8000/stream.mp3
dst = rtp://239.0.0.1:5554
# Optionality you can change video stream framerate.
#fps = 25
#
# Optionality you can set YouTube recommended preset:
# 240p, 360p, 480p, 720p, 1080p, 1440p, 2160p.
#preset = 1080p
#
# By default ffmpeg expected in /usr/bin/ffmpeg or C:\Program Files\ffmpeg\bin\ffmpeg.exe.
# If you need change it, uncomment the parameter and set the path you want.
#ffpath = /usr/bin/ffmpeg
#
# If you get program freezes because your network unstable, uncomment the parameter.
#watchdog = true
#
# By default, watchdog waits 5 seconds before terminating the program.
# If you need change it, uncomment the parameter and set the path you want.
#watchsec = 15
#
# If you use crontab or other scheduler to run, uncomment the parameter to prevent process overlap.
#onlyonce = 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
[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, ,

1632
archive/0.3/cctv-scheduler.py Executable file

File diff suppressed because it is too large Load Diff

169
archive/0.4/README.md Normal file
View File

@ -0,0 +1,169 @@
# cctv-scheduler
PTZ IP-Camera management
____
- [`cctv-scheduler.py`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#cctv-scheduler-py)
- [`publisher.sh`](https://git.hmp.today/pavel.muhortov/cctv-scheduler#publisher-sh)
____
![cctv-scheduler](info/images/cctv-scheduler-0.4.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/cctv-scheduler.py -O /home/user/cctv-scheduler/cctv-scheduler.py
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/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
```
### `Configuration`
Edit configs.
```bash
nano /home/user/cctv-scheduler/cctv-scheduler.conf
nano /home/user/cctv-scheduler/publisher.conf
```
### `Scheduler`
Look at examples and edit scheduler tasks:
```bash
crontab -e
```
## `cctv-scheduler`.py
**Description:**
> [Hikvision](https://git.hmp.today/pavel.muhortov/cctv-scheduler/src/branch/master/info/hikvision/manual/isapi.pdf) PTZ IP-Camera management. Media streaming. Images to video converting.
> Additionally:
>
> - getting temperature from DS18B20 over SSH,
> - saving pictures to FTP.
> - converting picture collection to video.
>
> This is only a local "proof of concept" for testing and debugging.
**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/))
> - [paramiko](https://www.paramiko.org/) Python 3 module (tested version 3.1.0)
> - [ffmpeg](https://ffmpeg.org) (tested version 4.3.4 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
> - specified record pictures filesystem organization
>
>```bash
> # record pictures filesystem organization 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
>```
| PARAMETERS | DESCRIPTION | DEFAULT|
|-------------|-------------|--------|
|**[-h]**|print help and exit||
|**[-b, --broadcast]**|streaming media to destination|`None`|
|**[-s, --sequences]**|run sequences from config file|`None`|
|**[--config]**|custom configuration file path|`./cctv-scheduler.conf`|
|**[-c, --converter]**|convert JPEG collection to MP4|`None`|
|**[-d, --day]**|day in amount of days from today, for which the publication or conversion is made|`0`|
|**[-w, --week]**|week in amount of weeks from today, for which the publication or conversion is made|`0`|
|**[-m, --month]**|month in amount of months from today, for which the publication or conversion is made|`0`|
|**[-y, --year]**|year in amount of years from today, for which the publication or conversion is made|`0`|
Example usage in terminal with make the script executable:
```bash
chmod u+x ./cctv-scheduler.py
./cctv-scheduler.py -s --config /home/user/cctv-scheduler/cctv-scheduler.conf
```
Example usage with cron:
```bash
# crontab -e
* * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -b
0 * * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -s
1 0 * * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -c -d -1
7 0 * * 1 /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -c -w -1
30 0 1 * * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -c -m -1
36 0 1 1 * /usr/bin/python3 /home/user/cctv-scheduler/cctv-scheduler.py -c -y -1
```
____
## `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| `./publisher.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
```

View File

@ -0,0 +1,136 @@
[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-broadcast]
# List the broadcast block names. Only blocks with the TRUE value will be used.
camera.test.local = true
[enable-sequences]
# List the sequence/camera block names. Only blocks with the TRUE value will be used.
camera.test.local = true
[enable-sensors]
# List the sensor block names. Only blocks with the TRUE value will be used.
sensor.test.local = true
[enable-convert]
# List the convert block names. Only blocks with the TRUE value will be used.
camera.test.local = true
[broadcast-config:camera.test.local]
# Broadcast parameter description block always starts with "broadcast-config:".
src = rtsp://user:pass@192.168.254.253:554/Streaming/Channels/101,http://radio.fm:8000/stream.mp3
dst = rtp://239.0.0.1:5554
# Optionality you can change video stream framerate.
#fps = 25
#
# Optionality you can set YouTube recommended preset:
# 240p, 360p, 480p, 720p, 1080p, 1440p, 2160p.
#preset = 1080p
#
# By default ffmpeg expected in /usr/bin/ffmpeg or C:\Program Files\ffmpeg\bin\ffmpeg.exe.
# If you need change it, uncomment the parameter and set the path you want.
#ffpath = /usr/bin/ffmpeg
#
# If you get program freezes because your network unstable, uncomment the parameter.
#watchdog = true
#
# By default, watchdog waits 5 seconds before terminating the program.
# If you need change it, uncomment the parameter and set the path you want.
#watchsec = 15
#
# If you use crontab or other scheduler to run, uncomment the parameter to prevent process overlap.
#onlyonce = 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
[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, 1920, 1080, -, -, -, -, 5, , 'name: filename prefix, x|y: camera width|height resolution'
step999 = rebootcamera, -, -, -, -, -, -, 120, ,
[convert-config:camera.test.local]
# Converter parameter description block always starts with "convert-config:".
image_find_names = step071, image-01, image-02
# If a image root or destination video directories on a remote host is used, a username and password must be specified.
# Supported protocols:
# FTP.
image_root_path = ftp://192.168.254.254/Records/camera.test.local
image_root_user = user
image_root_pass = pass
video_dest_path = ftp://192.168.254.254/Downloads
video_dest_user = user
video_dest_pass = pass
video_scale_x = 1920
video_scale_y = 1080
video_framerate = 25

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,525 @@
<?xml version="1.0" encoding="UTF-8"?>
<methodCall><methodName>wp.editPage</methodName>
<params>
<param><value>1</value></param>
<param><value>wpeditpageid</value></param>
<param><value>wpxmlrpcuser</value></param>
<param><value>wpxmlrpcpass</value></param>
<param><value><struct>
<member><name>dateCreated</name><value><dateTime.iso8601>wpeditdateis</dateTime.iso8601></value></member>
<member><name>userid</name><value><string>wpedituserid</string></value></member>
<member><name>page_id</name><value><int>wpeditpageid</int></value></member>
<member><name>page_status</name><value><string>publish</string></value></member>
<member><name>description</name><value><string>
&lt;!-- wp:heading {&quot;level&quot;:3} --&gt;&lt;h3&gt;Now&lt;/h3&gt;&lt;!-- /wp:heading --&gt;
&lt;!-- wp:embed {&quot;url&quot;:&quot;youtubelink&quot;,&quot;type&quot;:&quot;video&quot;,&quot;providerNameSlug&quot;:&quot;youtube&quot;,
&quot;responsive&quot;:true,&quot;className&quot;:&quot;wp-embed-aspect-4-3 wp-has-aspect-ratio&quot;} --&gt;
&lt;figure class=&quot;wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio&quot;&gt;
&lt;div class=&quot;wp-block-embed__wrapper&quot;&gt;
youtubelink
&lt;/div&gt;&lt;/figure&gt;&lt;!-- /wp:embed --&gt;
&lt;!-- wp:heading {&quot;level&quot;:3} --&gt;&lt;h3&gt;Yesterday&lt;/h3&gt;&lt;!-- /wp:heading --&gt;
&lt;!-- wp:uagb/tabs {&quot;block_id&quot;:&quot;yesterday&quot;,
&quot;tabHeaders&quot;:[&quot;currentdp01[0]&quot;,
&quot;currentdp02[0]&quot;,
&quot;currentdp04[0]&quot;,
&quot;currentdp05[0]&quot;,
&quot;currentdp11[0]&quot;,
&quot;currentdp12[0]&quot;],&quot;tabActive&quot;:5,&quot;activeTabBgColor&quot;:&quot;#4b4b4b&quot;,
&quot;tabTitleLeftMargin&quot;:1,&quot;tabTitleRightMargin&quot;:1,&quot;tabTitleTopMargin&quot;:1,&quot;tabTitleBottomMargin&quot;:1} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs uagb-block-yesterday uagb-tabs__wrap uagb-tabs__hstyle1-desktop uagb-tabs__vstyle6-tablet uagb-tabs__vstyle6-mobile&quot; data-tab-active=&quot;0&quot;&gt;
&lt;ul class=&quot;uagb-tabs__panel uagb-tabs__align-left&quot;&gt;&lt;li class=&quot;uagb-tab uagb-tabs__active&quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab0&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;0&quot;&gt;
&lt;span&gt;currentdp01[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab1&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;1&quot;&gt;
&lt;span&gt;currentdp02[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab2&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;2&quot;&gt;
&lt;span&gt;currentdp04[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab3&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;3&quot;&gt;
&lt;span&gt;currentdp05[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab4&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;4&quot;&gt;
&lt;span&gt;currentdp11[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab5&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;5&quot;&gt;
&lt;span&gt;currentdp12[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;div class=&quot;uagb-tabs__body-wrap&quot;&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;daypoint01&quot;,
&quot;header&quot;:&quot;currentdp01[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentdp01[0]&quot;,
&quot;currentdp02[0]&quot;,
&quot;currentdp04[0]&quot;,
&quot;currentdp05[0]&quot;,
&quot;currentdp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-0&quot;&gt;
&lt;div class=&quot;uagb-blocks__daypoint01 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab0&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1036} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentdp01[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;daypoint02&quot;,&quot;id&quot;:1,
&quot;header&quot;:&quot;currentdp02[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentdp01[0]&quot;,
&quot;currentdp02[0]&quot;,
&quot;currentdp04[0]&quot;,
&quot;currentdp05[0]&quot;,
&quot;currentdp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-1&quot;&gt;
&lt;div class=&quot;uagb-blocks__daypoint02 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab1&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1041} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentdp02[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;daypoint04&quot;,&quot;id&quot;:2,
&quot;header&quot;:&quot;currentdp04[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentdp01[0]&quot;,
&quot;currentdp02[0]&quot;,
&quot;currentdp04[0]&quot;,
&quot;currentdp05[0]&quot;,
&quot;currentdp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-2&quot;&gt;
&lt;div class=&quot;uagb-blocks__daypoint04 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab2&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1046} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentdp04[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;daypoint05&quot;,&quot;id&quot;:3,
&quot;header&quot;:&quot;currentdp05[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentdp01[0]&quot;,
&quot;currentdp02[0]&quot;,
&quot;currentdp04[0]&quot;,
&quot;currentdp05[0]&quot;,
&quot;currentdp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-3&quot;&gt;
&lt;div class=&quot;uagb-blocks__daypoint05 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab3&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1051} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentdp05[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;daypoint11&quot;,&quot;id&quot;:4,
&quot;header&quot;:&quot;currentdp11[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentdp01[0]&quot;,
&quot;currentdp02[0]&quot;,
&quot;currentdp04[0]&quot;,
&quot;currentdp05[0]&quot;,
&quot;currentdp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-4&quot;&gt;
&lt;div class=&quot;uagb-blocks__daypoint11 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab4&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1056} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentdp11[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;daypoint12&quot;,&quot;id&quot;:5,
&quot;header&quot;:&quot;currentdp12[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentdp01[0]&quot;,
&quot;currentdp02[0]&quot;,
&quot;currentdp04[0]&quot;,
&quot;currentdp05[0]&quot;,
&quot;currentdp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-5&quot;&gt;
&lt;div class=&quot;uagb-blocks__daypoint12 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab5&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1061} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentdp12[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;&lt;/div&gt;&lt;/div&gt;
&lt;!-- /wp:uagb/tabs --&gt;
&lt;!-- wp:heading {&quot;level&quot;:3} --&gt;&lt;h3&gt;Last week&lt;/h3&gt;&lt;!-- /wp:heading --&gt;
&lt;!-- wp:uagb/tabs {&quot;block_id&quot;:&quot;lastweek&quot;,
&quot;tabHeaders&quot;:[&quot;currentwp01[0]&quot;,
&quot;currentwp02[0]&quot;,
&quot;currentwp04[0]&quot;,
&quot;currentwp05[0]&quot;,
&quot;currentwp11[0]&quot;,
&quot;currentwp12[0]&quot;],&quot;tabActive&quot;:5,&quot;activeTabBgColor&quot;:&quot;#4b4b4b&quot;,
&quot;tabTitleLeftMargin&quot;:1,&quot;tabTitleRightMargin&quot;:1,&quot;tabTitleTopMargin&quot;:1,&quot;tabTitleBottomMargin&quot;:1} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs uagb-block-lastweek uagb-tabs__wrap uagb-tabs__hstyle1-desktop uagb-tabs__vstyle6-tablet uagb-tabs__vstyle6-mobile&quot; data-tab-active=&quot;0&quot;&gt;
&lt;ul class=&quot;uagb-tabs__panel uagb-tabs__align-left&quot;&gt;&lt;li class=&quot;uagb-tab uagb-tabs__active&quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab0&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;0&quot;&gt;
&lt;span&gt;currentwp01[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab1&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;1&quot;&gt;
&lt;span&gt;currentwp02[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab2&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;2&quot;&gt;
&lt;span&gt;currentwp04[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab3&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;3&quot;&gt;
&lt;span&gt;currentwp05[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab4&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;4&quot;&gt;
&lt;span&gt;currentwp11[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab5&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;5&quot;&gt;
&lt;span&gt;currentwp12[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;div class=&quot;uagb-tabs__body-wrap&quot;&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;weekpoint01&quot;,
&quot;header&quot;:&quot;currentwp01[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentwp01[0]&quot;,
&quot;currentwp02[0]&quot;,
&quot;currentwp04[0]&quot;,
&quot;currentwp05[0]&quot;,
&quot;currentwp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-0&quot;&gt;
&lt;div class=&quot;uagb-blocks__weekpoint01 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab0&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1036} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentwp01[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;weekpoint02&quot;,&quot;id&quot;:1,
&quot;header&quot;:&quot;currentwp02[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentwp01[0]&quot;,
&quot;currentwp02[0]&quot;,
&quot;currentwp04[0]&quot;,
&quot;currentwp05[0]&quot;,
&quot;currentwp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-1&quot;&gt;
&lt;div class=&quot;uagb-blocks__weekpoint02 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab1&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1041} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentwp02[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;weekpoint04&quot;,&quot;id&quot;:2,
&quot;header&quot;:&quot;currentwp04[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentwp01[0]&quot;,
&quot;currentwp02[0]&quot;,
&quot;currentwp04[0]&quot;,
&quot;currentwp05[0]&quot;,
&quot;currentwp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-2&quot;&gt;
&lt;div class=&quot;uagb-blocks__weekpoint04 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab2&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1046} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentwp04[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;weekpoint05&quot;,&quot;id&quot;:3,
&quot;header&quot;:&quot;currentwp05[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentwp01[0]&quot;,
&quot;currentwp02[0]&quot;,
&quot;currentwp04[0]&quot;,
&quot;currentwp05[0]&quot;,
&quot;currentwp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-3&quot;&gt;
&lt;div class=&quot;uagb-blocks__weekpoint05 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab3&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1051} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentwp05[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;weekpoint11&quot;,&quot;id&quot;:4,
&quot;header&quot;:&quot;currentwp11[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentwp01[0]&quot;,
&quot;currentwp02[0]&quot;,
&quot;currentwp04[0]&quot;,
&quot;currentwp05[0]&quot;,
&quot;currentwp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-4&quot;&gt;
&lt;div class=&quot;uagb-blocks__weekpoint11 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab4&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1056} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentwp11[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;weekpoint12&quot;,&quot;id&quot;:5,
&quot;header&quot;:&quot;currentwp12[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentwp01[0]&quot;,
&quot;currentwp02[0]&quot;,
&quot;currentwp04[0]&quot;,
&quot;currentwp05[0]&quot;,
&quot;currentwp11[0]&quot;,&quot;wp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-5&quot;&gt;
&lt;div class=&quot;uagb-blocks__weekpoint12 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab5&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1061} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentwp12[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;&lt;/div&gt;&lt;/div&gt;
&lt;!-- /wp:uagb/tabs --&gt;
&lt;!-- wp:heading {&quot;level&quot;:3} --&gt;&lt;h3&gt;Last month&lt;/h3&gt;&lt;!-- /wp:heading --&gt;
&lt;!-- wp:uagb/tabs {&quot;block_id&quot;:&quot;lastmonth&quot;,
&quot;tabHeaders&quot;:[&quot;currentmp01[0]&quot;,
&quot;currentmp02[0]&quot;,
&quot;currentmp04[0]&quot;,
&quot;currentmp05[0]&quot;,
&quot;currentmp11[0]&quot;,
&quot;currentmp12[0]&quot;],&quot;tabActive&quot;:5,&quot;activeTabBgColor&quot;:&quot;#4b4b4b&quot;,
&quot;tabTitleLeftMargin&quot;:1,&quot;tabTitleRightMargin&quot;:1,&quot;tabTitleTopMargin&quot;:1,&quot;tabTitleBottomMargin&quot;:1} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs uagb-block-lastmonth uagb-tabs__wrap uagb-tabs__hstyle1-desktop uagb-tabs__vstyle6-tablet uagb-tabs__vstyle6-mobile&quot; data-tab-active=&quot;0&quot;&gt;
&lt;ul class=&quot;uagb-tabs__panel uagb-tabs__align-left&quot;&gt;&lt;li class=&quot;uagb-tab uagb-tabs__active&quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab0&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;0&quot;&gt;
&lt;span&gt;currentmp01[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab1&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;1&quot;&gt;
&lt;span&gt;currentmp02[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab2&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;2&quot;&gt;
&lt;span&gt;currentmp04[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab3&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;3&quot;&gt;
&lt;span&gt;currentmp05[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab4&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;4&quot;&gt;
&lt;span&gt;currentmp11[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab5&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;5&quot;&gt;
&lt;span&gt;currentmp12[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;div class=&quot;uagb-tabs__body-wrap&quot;&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;monthpoint01&quot;,
&quot;header&quot;:&quot;currentmp01[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentmp01[0]&quot;,
&quot;currentmp02[0]&quot;,
&quot;currentmp04[0]&quot;,
&quot;currentmp05[0]&quot;,
&quot;currentmp11[0]&quot;,&quot;mp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-0&quot;&gt;
&lt;div class=&quot;uagb-blocks__monthpoint01 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab0&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1037} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentmp01[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;monthpoint02&quot;,&quot;id&quot;:1,
&quot;header&quot;:&quot;currentmp02[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentmp01[0]&quot;,
&quot;currentmp02[0]&quot;,
&quot;currentmp04[0]&quot;,
&quot;currentmp05[0]&quot;,
&quot;currentmp11[0]&quot;,&quot;mp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-1&quot;&gt;
&lt;div class=&quot;uagb-blocks__monthpoint02 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab1&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1042} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentmp02[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;monthpoint04&quot;,&quot;id&quot;:2,
&quot;header&quot;:&quot;currentmp04[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentmp01[0]&quot;,
&quot;currentmp02[0]&quot;,
&quot;currentmp04[0]&quot;,
&quot;currentmp05[0]&quot;,
&quot;currentmp11[0]&quot;,&quot;mp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-2&quot;&gt;
&lt;div class=&quot;uagb-blocks__monthpoint04 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab2&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1047} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentmp04[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;monthpoint05&quot;,&quot;id&quot;:3,
&quot;header&quot;:&quot;currentmp05[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentmp01[0]&quot;,
&quot;currentmp02[0]&quot;,
&quot;currentmp04[0]&quot;,
&quot;currentmp05[0]&quot;,
&quot;currentmp11[0]&quot;,&quot;mp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-3&quot;&gt;
&lt;div class=&quot;uagb-blocks__monthpoint05 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab3&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1052} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentmp05[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;monthpoint11&quot;,&quot;id&quot;:4,
&quot;header&quot;:&quot;currentmp11[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentmp01[0]&quot;,
&quot;currentmp02[0]&quot;,
&quot;currentmp04[0]&quot;,
&quot;currentmp05[0]&quot;,
&quot;currentmp11[0]&quot;,&quot;mp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-4&quot;&gt;
&lt;div class=&quot;uagb-blocks__monthpoint11 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab4&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1057} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentmp11[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;monthpoint12&quot;,&quot;id&quot;:5,
&quot;header&quot;:&quot;currentmp12[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentmp01[0]&quot;,
&quot;currentmp02[0]&quot;,
&quot;currentmp04[0]&quot;,
&quot;currentmp05[0]&quot;,
&quot;currentmp11[0]&quot;,&quot;mp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-5&quot;&gt;
&lt;div class=&quot;uagb-blocks__monthpoint12 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab5&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1062} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentmp12[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;&lt;/div&gt;&lt;/div&gt;
&lt;!-- /wp:uagb/tabs --&gt;
&lt;!-- wp:heading {&quot;level&quot;:3} --&gt;&lt;h3&gt;Last year&lt;/h3&gt;&lt;!-- /wp:heading --&gt;
&lt;!-- wp:uagb/tabs {&quot;block_id&quot;:&quot;lastyear&quot;,
&quot;tabHeaders&quot;:[&quot;currentyp01[0]&quot;,
&quot;currentyp02[0]&quot;,
&quot;currentyp04[0]&quot;,
&quot;currentyp05[0]&quot;,
&quot;currentyp11[0]&quot;,
&quot;currentyp12[0]&quot;],&quot;tabActive&quot;:5,&quot;activeTabBgColor&quot;:&quot;#4b4b4b&quot;,
&quot;tabTitleLeftMargin&quot;:1,&quot;tabTitleRightMargin&quot;:1,&quot;tabTitleTopMargin&quot;:1,&quot;tabTitleBottomMargin&quot;:1} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs uagb-block-lastyear uagb-tabs__wrap uagb-tabs__hstyle1-desktop uagb-tabs__vstyle6-tablet uagb-tabs__vstyle6-mobile&quot; data-tab-active=&quot;0&quot;&gt;
&lt;ul class=&quot;uagb-tabs__panel uagb-tabs__align-left&quot;&gt;&lt;li class=&quot;uagb-tab uagb-tabs__active&quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab0&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;0&quot;&gt;
&lt;span&gt;currentyp01[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab1&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;1&quot;&gt;
&lt;span&gt;currentyp02[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab2&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;2&quot;&gt;
&lt;span&gt;currentyp04[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab3&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;3&quot;&gt;
&lt;span&gt;currentyp05[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab4&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;4&quot;&gt;
&lt;span&gt;currentyp11[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;uagb-tab &quot;&gt;
&lt;a href=&quot;#uagb-tabs__tab5&quot; class=&quot;uagb-tabs-list uagb-tabs__icon-position-left&quot; data-tab=&quot;5&quot;&gt;
&lt;span&gt;currentyp12[0]&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;div class=&quot;uagb-tabs__body-wrap&quot;&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;yearpoint01&quot;,
&quot;header&quot;:&quot;currentyp01[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentyp01[0]&quot;,
&quot;currentyp02[0]&quot;,
&quot;currentyp04[0]&quot;,
&quot;currentyp05[0]&quot;,
&quot;currentyp11[0]&quot;,&quot;yp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-0&quot;&gt;
&lt;div class=&quot;uagb-blocks__yearpoint01 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab0&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1038} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentyp01[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;yearpoint02&quot;,&quot;id&quot;:1,
&quot;header&quot;:&quot;currentyp02[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentyp01[0]&quot;,
&quot;currentyp02[0]&quot;,
&quot;currentyp04[0]&quot;,
&quot;currentyp05[0]&quot;,
&quot;currentyp11[0]&quot;,&quot;yp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-1&quot;&gt;
&lt;div class=&quot;uagb-blocks__yearpoint02 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab1&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1043} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentyp02[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;yearpoint04&quot;,&quot;id&quot;:2,
&quot;header&quot;:&quot;currentyp04[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentyp01[0]&quot;,
&quot;currentyp02[0]&quot;,
&quot;currentyp04[0]&quot;,
&quot;currentyp05[0]&quot;,
&quot;currentyp11[0]&quot;,&quot;yp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-2&quot;&gt;
&lt;div class=&quot;uagb-blocks__yearpoint04 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab2&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1048} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentyp04[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;yearpoint05&quot;,&quot;id&quot;:3,
&quot;header&quot;:&quot;currentyp05[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentyp01[0]&quot;,
&quot;currentyp02[0]&quot;,
&quot;currentyp04[0]&quot;,
&quot;currentyp05[0]&quot;,
&quot;currentyp11[0]&quot;,&quot;yp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-3&quot;&gt;
&lt;div class=&quot;uagb-blocks__yearpoint05 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab3&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1053} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentyp05[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;yearpoint11&quot;,&quot;id&quot;:4,
&quot;header&quot;:&quot;currentyp11[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentyp01[0]&quot;,
&quot;currentyp02[0]&quot;,
&quot;currentyp04[0]&quot;,
&quot;currentyp05[0]&quot;,
&quot;currentyp11[0]&quot;,&quot;yp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-4&quot;&gt;
&lt;div class=&quot;uagb-blocks__yearpoint11 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab4&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1058} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentyp11[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;
&lt;!-- wp:uagb/tabs-child {&quot;block_id&quot;:&quot;yearpoint12&quot;,&quot;id&quot;:5,
&quot;header&quot;:&quot;currentyp12[0]&quot;,&quot;tabActive&quot;:5,
&quot;tabHeaders&quot;:[&quot;currentyp01[0]&quot;,
&quot;currentyp02[0]&quot;,
&quot;currentyp04[0]&quot;,
&quot;currentyp05[0]&quot;,
&quot;currentyp11[0]&quot;,&quot;yp1tab&quot;]} --&gt;
&lt;div class=&quot;wp-block-uagb-tabs-child uagb-tabs__body-container uagb-tabs__inner-tab uagb-inner-tab-5&quot;&gt;
&lt;div class=&quot;uagb-blocks__yearpoint12 uagb-tabs__body&quot; aria-labelledby=&quot;uagb-tabs__tab5&quot;&gt;
&lt;!-- wp:video {&quot;id&quot;:1063} --&gt;&lt;figure class=&quot;wp-block-video&quot;&gt;
&lt;video controls loop src=&quot;currentyp12[1]&quot;&gt;
&lt;/video&gt;&lt;/figure&gt;&lt;!-- /wp:video --&gt;&lt;/div&gt;&lt;/div&gt;&lt;!-- /wp:uagb/tabs-child --&gt;&lt;/div&gt;&lt;/div&gt;
&lt;!-- /wp:uagb/tabs --&gt;
</string></value></member>
<member><name>title</name><value><string>Media</string></value></member>
<member><name>link</name><value><string>wppagelinkis</string></value></member>
<member><name>permaLink</name><value><string>wppagelinkis</string></value></member>
<member><name>categories</name><value><array><data></data></array></value></member>
<member><name>excerpt</name><value><string></string></value></member>
<member><name>text_more</name><value><string></string></value></member>
<member><name>mt_allow_comments</name><value><int>0</int></value></member>
<member><name>mt_allow_pings</name><value><int>0</int></value></member>
<member><name>wp_slug</name><value><string>media</string></value></member>
<member><name>wp_password</name><value><string></string></value></member>
<member><name>wp_author</name><value><string>wppageauthor</string></value></member>
<member><name>wp_page_parent_id</name><value><int>0</int></value></member>
<member><name>wp_page_parent_title</name><value><string></string></value></member>
<member><name>wp_page_order</name><value><int>0</int></value></member>
<member><name>wp_author_id</name><value><string>wpedituserid</string></value></member>
<member><name>wp_author_display_name</name><value><string>wppageauthor</string></value></member>
<member><name>date_created_gmt</name><value><dateTime.iso8601>wpeditdateis</dateTime.iso8601></value></member>
<member><name>custom_fields</name><value><array><data>
<value><struct>
<member><name>id</name><value><string>4258</string></value></member>
<member><name>key</name><value><string>content_display_featured_image</string></value></member>
<member><name>value</name><value><string>0</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4257</string></value></member>
<member><name>key</name><value><string>content_display_title</string></value></member>
<member><name>value</name><value><string>0</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4259</string></value></member>
<member><name>key</name><value><string>content_width</string></value></member>
<member><name>value</name><value><string>container</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4253</string></value></member>
<member><name>key</name><value><string>disable_space_above_footer</string></value></member>
<member><name>value</name><value><string>0</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4252</string></value></member>
<member><name>key</name><value><string>disable_space_below_header</string></value></member>
<member><name>value</name><value><string>0</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4251</string></value></member>
<member><name>key</name><value><string>hide_footer</string></value></member>
<member><name>value</name><value><string>0</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4250</string></value></member>
<member><name>key</name><value><string>hide_header</string></value></member>
<member><name>value</name><value><string>0</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4254</string></value></member>
<member><name>key</name><value><string>hide_titlebar</string></value></member>
<member><name>value</name><value><string>0</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4255</string></value></member>
<member><name>key</name><value><string>page_overwrite_defaults</string></value></member>
<member><name>value</name><value><string>0</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4260</string></value></member>
<member><name>key</name><value><string>sidebar_layout</string></value></member>
<member><name>value</name><value><string>default-sidebar</string></value></member>
</struct></value>
<value><struct>
<member><name>id</name><value><string>4256</string></value></member>
<member><name>key</name><value><string>titlebar_padding</string></value></member>
<member><name>value</name><value><string>80</string></value></member>
</struct></value>
</data></array></value></member>
<member><name>wp_page_template</name><value><string>default</string></value></member>
</struct></value></param>
</params>
</methodCall>

View File

@ -0,0 +1,86 @@
logs=./publisher.log
pathroot=/home/user/cctv-scheduler/records
vidnamesarray=point-01 point-02 point-04 point-05 point-11 point-12
telegramapiurl=https://api.telegram.org/bot1234567890:YOURAPIKEY
telegramchatid=123456789
tgpreviewlink=https://www.hmp.today/wp-content/uploads/2021/02/site-slider_hmp-qr_bwg-3840x1705-1.png
tgpreviewtext=https://www.hmp.today/media
wpxmlrpclink=https://www.hmp.today/xmlrpc.php
wpxmlrpcuser=user
wpxmlrpcpass=pass
wppageauthor=author
wppagelinkis=https://www.hmp.today/media
wpeditpageid=1007
wpedituserid=0
wpeditdateis=20220707T00:00:00
wptemplateis=./publisher-template-page-1007.xml
youtubelink=https://youtu.be/link
defaultdp01=point-01 https://www.hmp.today/wp-content/uploads/2022/07/point-01_yyyy.mm_.dd_.mp4
defaultwp01=point-01 https://www.hmp.today/wp-content/uploads/2022/07/point-01_w.mp4
defaultmp01=point-01 https://www.hmp.today/wp-content/uploads/2022/07/point-01_yyyy.mm_.mp4
defaultyp01=point-01 https://www.hmp.today/wp-content/uploads/2022/07/point-01_yyyy.mp4
defaultdp02=point-02 https://www.hmp.today/wp-content/uploads/2022/07/point-02_yyyy.mm_.dd_.mp4
defaultwp02=point-02 https://www.hmp.today/wp-content/uploads/2022/07/point-02_w.mp4
defaultmp02=point-02 https://www.hmp.today/wp-content/uploads/2022/07/point-02_yyyy.mm_.mp4
defaultyp02=point-02 https://www.hmp.today/wp-content/uploads/2022/07/point-02_yyyy.mp4
defaultdp04=point-04 https://www.hmp.today/wp-content/uploads/2022/07/point-04_yyyy.mm_.dd_.mp4
defaultwp04=point-04 https://www.hmp.today/wp-content/uploads/2022/07/point-04_w.mp4
defaultmp04=point-04 https://www.hmp.today/wp-content/uploads/2022/07/point-04_yyyy.mm_.mp4
defaultyp04=point-04 https://www.hmp.today/wp-content/uploads/2022/07/point-04_yyyy.mp4
defaultdp05=point-05 https://www.hmp.today/wp-content/uploads/2022/07/point-05_yyyy.mm_.dd_.mp4
defaultwp05=point-05 https://www.hmp.today/wp-content/uploads/2022/07/point-05_w.mp4
defaultmp05=point-05 https://www.hmp.today/wp-content/uploads/2022/07/point-05_yyyy.mm_.mp4
defaultyp05=point-05 https://www.hmp.today/wp-content/uploads/2022/07/point-05_yyyy.mp4
defaultdp11=point-11 https://www.hmp.today/wp-content/uploads/2022/07/point-11_yyyy.mm_.dd_.mp4
defaultwp11=point-11 https://www.hmp.today/wp-content/uploads/2022/07/point-11_w.mp4
defaultmp11=point-11 https://www.hmp.today/wp-content/uploads/2022/07/point-11_yyyy.mm_.mp4
defaultyp11=point-11 https://www.hmp.today/wp-content/uploads/2022/07/point-11_yyyy.mp4
defaultdp12=point-12 https://www.hmp.today/wp-content/uploads/2022/07/point-12_yyyy.mm_.dd_.mp4
defaultwp12=point-12 https://www.hmp.today/wp-content/uploads/2022/07/point-12_w.mp4
defaultmp12=point-12 https://www.hmp.today/wp-content/uploads/2022/07/point-12_yyyy.mm_.mp4
defaultyp12=point-12 https://www.hmp.today/wp-content/uploads/2022/07/point-12_yyyy.mp4
currentdp01=point-01
currentwp01=point-01
currentmp01=point-01
currentyp01=point-01
currentdp02=point-02
currentwp02=point-02
currentmp02=point-02
currentyp02=point-02
currentdp04=point-04
currentwp04=point-04
currentmp04=point-04
currentyp04=point-04
currentdp05=point-05
currentwp05=point-05
currentmp05=point-05
currentyp05=point-05
currentdp11=point-11
currentwp11=point-11
currentmp11=point-11
currentyp11=point-11
currentdp12=point-12
currentwp12=point-12
currentmp12=point-12
currentyp12=point-12

599
archive/0.4/publisher.sh Normal file
View File

@ -0,0 +1,599 @@
#! /bin/bash
# DESCRIPTION:
# Uploading MP4 to Wordpress and Telegram.
# Additionally:
# - editing Wordpress page from template
# - recompressing video if size over 50MB
# This is only a local "proof of conept" for testing and debugging.
#
# DEPENDENCIES:
# - curl
# - ffmpeg
# - libxml2-utils
# - jq
#
# PARAMETERS:
# 1: "qn" - execution without pauses
# 2: custom configuration file path
# 3: periods: '' - today | '-d' - yesterday | '-w' - last week | '-m' - last month | '-y' - last year
# 4: period multiplier: '' - 1 day|week|month|year
# 5: publishing '--onlytg' - only to Telegram | '--onlywp' - only to Wordpress
#
# FUNCTIONS:
#
#######################################
# Print message and add to log.
# Globals:
# logs
# Arguments:
# 1: message to print and logging
#######################################
addtologs() {
echo "$(date +'%Y.%m.%d-%H:%M:%S') $1" | tee -a "${logs}"
}
#######################################
# Waiting for press [ENTER].
# Globals:
# None
# Arguments:
# None
#######################################
execpause() {
read -r -p "Press [ENTER] to continue... "
}
#######################################
# Exit procedure.
# Globals:
# show
# Arguments:
# None
#######################################
execquite() {
addtologs "execution time is $(($(date +%s)-time)) seconds, exit"
if [ "${show}" != "qn" ]; then
execpause
fi
exit
}
#######################################
# Error exit procedure with Telegram notification.
# Globals:
# telegramapiurl
# telegramchatid
# Arguments:
# 1: message to print and logging
#######################################
execerror() {
addtologs "error: $1"
curl -s -X POST "${telegramapiurl}/sendMessage" \
-d "chat_id=${telegramchatid}" \
-d "text=$(basename -s .sh "$0") error: $1" \
>> /dev/null 2>&1
execquite
}
#######################################
# Parsing config file and creating global vars.
# Globals:
# None
# Arguments:
# None
#######################################
getconfig() {
logs=$(grep "logs=" "${conf}" | cut -d= -f2)
pathroot=$(grep "pathroot=" "${conf}" | cut -d= -f2)
IFS=" " read -r -a vidnamesarray <<< "$(grep "vidnamesarray=" "${conf}" | cut -d= -f2)"
telegramapiurl=$(grep "telegramapiurl=" "${conf}" | cut -d= -f2)
telegramchatid=$(grep "telegramchatid=" "${conf}" | cut -d= -f2)
tgpreviewlink=$(grep "tgpreviewlink=" "${conf}" | cut -d= -f2)
tgpreviewtext=$(grep "tgpreviewtext=" "${conf}" | cut -d= -f2)
wpxmlrpclink=$(grep "wpxmlrpclink=" "${conf}" | cut -d= -f2)
wpxmlrpcuser=$(grep "wpxmlrpcuser=" "${conf}" | cut -d= -f2)
wpxmlrpcpass=$(grep "wpxmlrpcpass=" "${conf}" | cut -d= -f2)
wppageauthor=$(grep "wppageauthor=" "${conf}" | cut -d= -f2)
wppagelinkis=$(grep "wppagelinkis=" "${conf}" | cut -d= -f2)
wpeditpageid=$(grep "wpeditpageid=" "${conf}" | cut -d= -f2)
wpedituserid=$(grep "wpedituserid=" "${conf}" | cut -d= -f2)
wpeditdateis=$(grep "wpeditdateis=" "${conf}" | cut -d= -f2)
wptemplateis=$(grep "wptemplateis=" "${conf}" | cut -d= -f2)
youtubelink=$(grep "youtubelink=" "${conf}" | cut -d= -f2)
IFS=" " read -r -a defaultdp01 <<< "$(grep "defaultdp01=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultwp01 <<< "$(grep "defaultwp01=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultmp01 <<< "$(grep "defaultmp01=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultyp01 <<< "$(grep "defaultyp01=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultdp02 <<< "$(grep "defaultdp02=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultwp02 <<< "$(grep "defaultwp02=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultmp02 <<< "$(grep "defaultmp02=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultyp02 <<< "$(grep "defaultyp02=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultdp04 <<< "$(grep "defaultdp04=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultwp04 <<< "$(grep "defaultwp04=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultmp04 <<< "$(grep "defaultmp04=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultyp04 <<< "$(grep "defaultyp04=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultdp05 <<< "$(grep "defaultdp05=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultwp05 <<< "$(grep "defaultwp05=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultmp05 <<< "$(grep "defaultmp05=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultyp05 <<< "$(grep "defaultyp05=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultdp11 <<< "$(grep "defaultdp11=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultwp11 <<< "$(grep "defaultwp11=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultmp11 <<< "$(grep "defaultmp11=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultyp11 <<< "$(grep "defaultyp11=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultdp12 <<< "$(grep "defaultdp12=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultwp12 <<< "$(grep "defaultwp12=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultmp12 <<< "$(grep "defaultmp12=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a defaultyp12 <<< "$(grep "defaultyp12=" "${conf}" | cut -d= -f2)"
IFS=" " read -r -a currentdp01 <<< "$(grep "currentdp01=" "${conf}" | cut -d= -f2)"
if [ -z "${currentdp01[1]}" ]; then
currentdp01=${defaultdp01[*]}
fi
IFS=" " read -r -a currentwp01 <<< "$(grep "currentwp01=" "${conf}" | cut -d= -f2)"
if [ -z "${currentwp01[1]}" ]; then
currentwp01=${defaultwp01[*]}
fi
IFS=" " read -r -a currentmp01 <<< "$(grep "currentmp01=" "${conf}" | cut -d= -f2)"
if [ -z "${currentmp01[1]}" ]; then
currentmp01=${defaultmp01[*]}
fi
IFS=" " read -r -a currentyp01 <<< "$(grep "currentyp01=" "${conf}" | cut -d= -f2)"
if [ -z "${currentyp01[1]}" ]; then
currentyp01=${defaultyp01[*]}
fi
IFS=" " read -r -a currentdp02 <<< "$(grep "currentdp02=" "${conf}" | cut -d= -f2)"
if [ -z "${currentdp02[1]}" ]; then
currentdp02=${defaultdp02[*]}
fi
IFS=" " read -r -a currentwp02 <<< "$(grep "currentwp02=" "${conf}" | cut -d= -f2)"
if [ -z "${currentwp02[1]}" ]; then
currentwp02=${defaultwp02[*]}
fi
IFS=" " read -r -a currentmp02 <<< "$(grep "currentmp02=" "${conf}" | cut -d= -f2)"
if [ -z "${currentmp02[1]}" ]; then
currentmp02=${defaultmp02[*]}
fi
IFS=" " read -r -a currentyp02 <<< "$(grep "currentyp02=" "${conf}" | cut -d= -f2)"
if [ -z "${currentyp02[1]}" ]; then
currentyp02=${defaultyp02[*]}
fi
IFS=" " read -r -a currentdp04 <<< "$(grep "currentdp04=" "${conf}" | cut -d= -f2)"
if [ -z "${currentdp04[1]}" ]; then
currentdp04=${defaultdp04[*]}
fi
IFS=" " read -r -a currentwp04 <<< "$(grep "currentwp04=" "${conf}" | cut -d= -f2)"
if [ -z "${currentwp04[1]}" ]; then
currentwp04=${defaultwp04[*]}
fi
IFS=" " read -r -a currentmp04 <<< "$(grep "currentmp04=" "${conf}" | cut -d= -f2)"
if [ -z "${currentmp04[1]}" ]; then
currentmp04=${defaultmp04[*]}
fi
IFS=" " read -r -a currentyp04 <<< "$(grep "currentyp04=" "${conf}" | cut -d= -f2)"
if [ -z "${currentyp04[1]}" ]; then
currentyp04=${defaultyp04[*]}
fi
IFS=" " read -r -a currentdp05 <<< "$(grep "currentdp05=" "${conf}" | cut -d= -f2)"
if [ -z "${currentdp05[1]}" ]; then
currentdp05=${defaultdp05[*]}
fi
IFS=" " read -r -a currentwp05 <<< "$(grep "currentwp05=" "${conf}" | cut -d= -f2)"
if [ -z "${currentwp05[1]}" ]; then
currentwp05=${defaultwp05[*]}
fi
IFS=" " read -r -a currentmp05 <<< "$(grep "currentmp05=" "${conf}" | cut -d= -f2)"
if [ -z "${currentmp05[1]}" ]; then
currentmp05=${defaultmp05[*]}
fi
IFS=" " read -r -a currentyp05 <<< "$(grep "currentyp05=" "${conf}" | cut -d= -f2)"
if [ -z "${currentyp05[1]}" ]; then
currentyp05=${defaultyp05[*]}
fi
IFS=" " read -r -a currentdp11 <<< "$(grep "currentdp11=" "${conf}" | cut -d= -f2)"
if [ -z "${currentdp11[1]}" ]; then
currentdp11=${defaultdp11[*]}
fi
IFS=" " read -r -a currentwp11 <<< "$(grep "currentwp11=" "${conf}" | cut -d= -f2)"
if [ -z "${currentwp11[1]}" ]; then
currentwp11=${defaultwp11[*]}
fi
IFS=" " read -r -a currentmp11 <<< "$(grep "currentmp11=" "${conf}" | cut -d= -f2)"
if [ -z "${currentmp11[1]}" ]; then
currentmp11=${defaultmp11[*]}
fi
IFS=" " read -r -a currentyp11 <<< "$(grep "currentyp11=" "${conf}" | cut -d= -f2)"
if [ -z "${currentyp11[1]}" ]; then
currentyp11=${defaultyp11[*]}
fi
IFS=" " read -r -a currentdp12 <<< "$(grep "currentdp12=" "${conf}" | cut -d= -f2)"
if [ -z "${currentdp12[1]}" ]; then
currentdp12=${defaultdp12[*]}
fi
IFS=" " read -r -a currentwp12 <<< "$(grep "currentwp12=" "${conf}" | cut -d= -f2)"
if [ -z "${currentwp12[1]}" ]; then
currentwp12=${defaultwp12[*]}
fi
IFS=" " read -r -a currentmp12 <<< "$(grep "currentmp12=" "${conf}" | cut -d= -f2)"
if [ -z "${currentmp12[1]}" ]; then
currentmp12=${defaultmp12[*]}
fi
IFS=" " read -r -a currentyp12 <<< "$(grep "currentyp12=" "${conf}" | cut -d= -f2)"
if [ -z "${currentyp12[1]}" ]; then
currentyp12=${defaultyp12[*]}
fi
}
#######################################
# Writing changes to configuration file.
# Globals:
# conf
# when
# vidnamesarray
# vidlinksarray
# Arguments:
# None
#######################################
setconfig() {
if [ -z "${when}" ] || [ "${when}" == "-d" ]; then
if [ -n "${vidnamesarray[0]}" ] && [ -n "${vidlinksarray[0]}" ]; then
sed -i "s#$(grep 'currentdp01=' "${conf}")#currentdp01=${vidnamesarray[0]} ${vidlinksarray[0]}#" "${conf}"
fi
if [ -n "${vidnamesarray[1]}" ] && [ -n "${vidlinksarray[1]}" ]; then
sed -i "s#$(grep 'currentdp02=' "${conf}")#currentdp02=${vidnamesarray[1]} ${vidlinksarray[1]}#" "${conf}"
fi
if [ -n "${vidnamesarray[2]}" ] && [ -n "${vidlinksarray[2]}" ]; then
sed -i "s#$(grep 'currentdp04=' "${conf}")#currentdp04=${vidnamesarray[2]} ${vidlinksarray[2]}#" "${conf}"
fi
if [ -n "${vidnamesarray[3]}" ] && [ -n "${vidlinksarray[3]}" ]; then
sed -i "s#$(grep 'currentdp05=' "${conf}")#currentdp05=${vidnamesarray[3]} ${vidlinksarray[3]}#" "${conf}"
fi
if [ -n "${vidnamesarray[4]}" ] && [ -n "${vidlinksarray[4]}" ]; then
sed -i "s#$(grep 'currentdp11=' "${conf}")#currentdp11=${vidnamesarray[4]} ${vidlinksarray[4]}#" "${conf}"
fi
if [ -n "${vidnamesarray[5]}" ] && [ -n "${vidlinksarray[5]}" ]; then
sed -i "s#$(grep 'currentdp12=' "${conf}")#currentdp12=${vidnamesarray[5]} ${vidlinksarray[5]}#" "${conf}"
fi
fi
if [ "${when}" == "-w" ]; then
if [ -n "${vidnamesarray[0]}" ] && [ -n "${vidlinksarray[0]}" ]; then
sed -i "s#$(grep 'currentwp01=' "${conf}")#currentwp01=${vidnamesarray[0]} ${vidlinksarray[0]}#" "${conf}"
fi
if [ -n "${vidnamesarray[1]}" ] && [ -n "${vidlinksarray[1]}" ]; then
sed -i "s#$(grep 'currentwp02=' "${conf}")#currentwp02=${vidnamesarray[1]} ${vidlinksarray[1]}#" "${conf}"
fi
if [ -n "${vidnamesarray[2]}" ] && [ -n "${vidlinksarray[2]}" ]; then
sed -i "s#$(grep 'currentwp04=' "${conf}")#currentwp04=${vidnamesarray[2]} ${vidlinksarray[2]}#" "${conf}"
fi
if [ -n "${vidnamesarray[3]}" ] && [ -n "${vidlinksarray[3]}" ]; then
sed -i "s#$(grep 'currentwp05=' "${conf}")#currentwp05=${vidnamesarray[3]} ${vidlinksarray[3]}#" "${conf}"
fi
if [ -n "${vidnamesarray[4]}" ] && [ -n "${vidlinksarray[4]}" ]; then
sed -i "s#$(grep 'currentwp11=' "${conf}")#currentwp11=${vidnamesarray[4]} ${vidlinksarray[4]}#" "${conf}"
fi
if [ -n "${vidnamesarray[5]}" ] && [ -n "${vidlinksarray[5]}" ]; then
sed -i "s#$(grep 'currentwp12=' "${conf}")#currentwp12=${vidnamesarray[5]} ${vidlinksarray[5]}#" "${conf}"
fi
fi
if [ "${when}" == "-m" ]; then
if [ -n "${vidnamesarray[0]}" ] && [ -n "${vidlinksarray[0]}" ]; then
sed -i "s#$(grep 'currentmp01=' "${conf}")#currentmp01=${vidnamesarray[0]} ${vidlinksarray[0]}#" "${conf}"
fi
if [ -n "${vidnamesarray[1]}" ] && [ -n "${vidlinksarray[1]}" ]; then
sed -i "s#$(grep 'currentmp02=' "${conf}")#currentmp02=${vidnamesarray[1]} ${vidlinksarray[1]}#" "${conf}"
fi
if [ -n "${vidnamesarray[2]}" ] && [ -n "${vidlinksarray[2]}" ]; then
sed -i "s#$(grep 'currentmp04=' "${conf}")#currentmp04=${vidnamesarray[2]} ${vidlinksarray[2]}#" "${conf}"
fi
if [ -n "${vidnamesarray[3]}" ] && [ -n "${vidlinksarray[3]}" ]; then
sed -i "s#$(grep 'currentmp05=' "${conf}")#currentmp05=${vidnamesarray[3]} ${vidlinksarray[3]}#" "${conf}"
fi
if [ -n "${vidnamesarray[4]}" ] && [ -n "${vidlinksarray[4]}" ]; then
sed -i "s#$(grep 'currentmp11=' "${conf}")#currentmp11=${vidnamesarray[4]} ${vidlinksarray[4]}#" "${conf}"
fi
if [ -n "${vidnamesarray[5]}" ] && [ -n "${vidlinksarray[5]}" ]; then
sed -i "s#$(grep 'currentmp12=' "${conf}")#currentmp12=${vidnamesarray[5]} ${vidlinksarray[5]}#" "${conf}"
fi
fi
if [ "${when}" == "-y" ]; then
if [ -n "${vidnamesarray[0]}" ] && [ -n "${vidlinksarray[0]}" ]; then
sed -i "s#$(grep 'currentyp01=' "${conf}")#currentyp01=${vidnamesarray[0]} ${vidlinksarray[0]}#" "${conf}"
fi
if [ -n "${vidnamesarray[1]}" ] && [ -n "${vidlinksarray[1]}" ]; then
sed -i "s#$(grep 'currentyp02=' "${conf}")#currentyp02=${vidnamesarray[1]} ${vidlinksarray[1]}#" "${conf}"
fi
if [ -n "${vidnamesarray[2]}" ] && [ -n "${vidlinksarray[2]}" ]; then
sed -i "s#$(grep 'currentyp04=' "${conf}")#currentyp04=${vidnamesarray[2]} ${vidlinksarray[2]}#" "${conf}"
fi
if [ -n "${vidnamesarray[3]}" ] && [ -n "${vidlinksarray[3]}" ]; then
sed -i "s#$(grep 'currentyp05=' "${conf}")#currentyp05=${vidnamesarray[3]} ${vidlinksarray[3]}#" "${conf}"
fi
if [ -n "${vidnamesarray[4]}" ] && [ -n "${vidlinksarray[4]}" ]; then
sed -i "s#$(grep 'currentyp11=' "${conf}")#currentyp11=${vidnamesarray[4]} ${vidlinksarray[4]}#" "${conf}"
fi
if [ -n "${vidnamesarray[5]}" ] && [ -n "${vidlinksarray[5]}" ]; then
sed -i "s#$(grep 'currentyp12=' "${conf}")#currentyp12=${vidnamesarray[5]} ${vidlinksarray[5]}#" "${conf}"
fi
fi
}
#
# VARIABLES:
#
show=$1
conf=$2
if [ -z "${conf}" ] || [ "${conf}" == "-" ]; then
conf="$(dirname "$(realpath "$0")")/$(basename -s .sh "$0").conf"
fi
ever=$4
if [ -z "${ever}" ] || [ "${ever}" == "-" ]; then
ever=1
fi
if grep -q -o "^[0-9][0-9]*$" <<< "${ever}"; then
:
else
execerror "${ever} - wrong argument"
fi
when=$3
if [ -z "${when}" ]; then
viddate=$(date +"%Y").$(date +"%m").$(date +"%d")
fi
if [ "${when}" == "-d" ]; then
d=$(date -d "-${ever} day" +"%d")
m=$(date +"%m")
if [ "$(date -d "-${ever} day" +'%m')" != "$(date +'%m')" ]; then
m=$(date -d "-${ever} day" +'%m')
fi
y=$(date +"%Y")
if [ "$(date -d "-${ever} day" +'%Y')" != "$(date +'%Y')" ]; then
y=$(date -d "-${ever} day" +'%Y')
fi
viddate="${y}.${m}.${d}"
fi
if [ "${when}" == "-w" ]; then
w=$(date -d "-${ever} week" +"%V")
y=$(date +"%Y")
if [ "$(date -d "-${ever} week" +'%Y')" != "$(date +'%Y')" ]; then
y=$(date -d "-${ever} week" +'%Y')
fi
viddate="${y}-w${w}"
fi
if [ "${when}" == "-m" ]; then
m=$(date -d "-${ever} month" +"%m")
y=$(date +"%Y")
if [ "$(date -d "-${ever} month" +'%Y')" != "$(date +'%Y')" ]; then
y=$(date -d "-${ever} month" +'%Y')
fi
viddate="${y}.${m}"
fi
if [ "${when}" == "-y" ]; then
y=$(date -d "-${ever} year" +"%Y")
viddate="${y}"
fi
vidname="${viddate}.mp4"
only=$5
time=$(date +%s)
cd "$(dirname "$(realpath "$0")")" || execerror
if [ ! -e "${conf}" ]; then
execerror "Not found config file: ${conf}"
else
getconfig
fi
if [ -z "${logs}" ]; then
logs=/dev/null
elif [ ! -e "${logs}" ]; then
touch "${logs}"
fi
if ! command -v curl &> /dev/null || \
! command -v ffmpeg &> /dev/null || \
! command -v xmllint &> /dev/null || \
! command -v jq &> /dev/null; then
execerror "Not found dependencies"
fi
#
# MAIN:
#
vidpathsarray=()
vidlinksarray=()
vidtgidsarray=()
vidtgcpsarray=()
for name in "${vidnamesarray[@]}"; do
vidmatch="${name}_${vidname}"
while read -r FILE; do
vidpathsarray+=("${FILE}")
done < <(find "${pathroot}" -name "*${vidmatch}" | sort)
done
for item in "${!vidpathsarray[@]}"; do
# WORDPRESS UPLOAD VIDEO
if [ ! "$only" == "--onlytg" ]; then
# This realisation isn't optimal, but it fixes a few issues with large files:
# variable=$(base64 $file) -> "xrealloc: cannot allocate"
# response=$(curl -X POST -d @${file}.xml $url) -> "curl: option -d: out of memory"
filetype="video/mp4"
echo '<?xml version="1.0"?>
<methodCall><methodName>wp.uploadFile</methodName>
<params>
<param><value>1</value></param>
<param><value>'"${wpxmlrpcuser}"'</value></param>
<param><value>'"${wpxmlrpcpass}"'</value></param>
<param><value><struct>
<member><name>name</name><value><string>'"$(basename "${vidpathsarray[$item]}")"'</string></value></member>
<member><name>type</name><value><string>'"${filetype}"'</string></value></member>
<member><name>bits</name><value><base64>' > "${vidpathsarray[$item]}.xml"
base64 --wrap=0 "${vidpathsarray[$item]}" >> "${vidpathsarray[$item]}.xml"
echo '</base64></value></member>
</struct></value></param>
</params>
</methodCall>' >> "${vidpathsarray[$item]}.xml"
response="${vidpathsarray[$item]}-response.xml"
if curl -X POST -T "${vidpathsarray[$item]}.xml" "${wpxmlrpclink}" > "${response}"; then
vidlinksarray+=("$(xmllint --xpath '//member[contains(name,"link")]/value/string/text()' "${response}")")
vidlinkcodeis=$(curl --output /dev/null --silent --write-out "%{http_code}" "${vidlinksarray[$item]}")
else
execerror "${response}"
fi
if [[ ${vidlinkcodeis} -eq 200 ]]; then
rm "${vidpathsarray[$item]}.xml"
rm "${response}"
echo "$(date +'%Y.%m.%d-%H:%M:%S') sent ${vidpathsarray[$item]} to ${vidlinksarray[$item]}" | tee -a "${logs}"
echo -e "WORDPRESS UPLOAD VIDEO RESULT:"
echo -e "item: ${item}"
echo -e "type: ${filetype}"
echo -e "name: ${vidnamesarray[$item]}"
echo -e "base: $(basename "${vidpathsarray[$item]}")"
echo -e "path: ${vidpathsarray[$item]}"
echo -e "link: ${vidlinksarray[$item]}"
echo -e "code: ${vidlinkcodeis}"
else
vidlinksarray[item]=''
fi
fi
# TELEGRAM SEND/UPLOAD VIDEO
if [ ! "${only}" == "--onlywp" ]; then
videofullpath=${vidpathsarray[$item]}
vidcompressed=${videofullpath//".mp4"/"-compressed.mp4"}
if [ -n "$(find "${videofullpath}" -prune -size +51380224c)" ]; then
duration=$(ffprobe -i "${videofullpath}" \
-show_entries format=duration -v quiet -of csv="p=0" | cut -d'.' -f 1)
if ffmpeg -i "${videofullpath}" \
-c:v libx264 -b:v "$((49*8*1000/duration))k" \
-vf "scale=960:540,fps=25,format=yuv420p" \
-preset veryslow "${vidcompressed}" -y -loglevel quiet -stats; then
videofullpath=${vidcompressed}
else
execerror "ffmpeg convert ${videofullpath} to ${vidcompressed}"
fi
fi
videobasename=$(basename "${videofullpath}")
videobasename=${videobasename//".mp4"/""}
response=$(curl -s \
-F "chat_id=${telegramchatid}" \
-F "video=@${videofullpath}" \
-F "caption=${videobasename}" \
"${telegramapiurl}/sendVideo")
if curl -s -F "chat_id=${telegramchatid}" \
-F "message_id=$(echo "${response}" | jq -r '.result.message_id')" \
"${telegramapiurl}/deleteMessage"; then
vidtgidsarray+=("$(echo "${response}" | jq -r '.result.video.file_id')")
vidtgcpsarray+=("$(echo "${response}" | jq -r '.result.caption')")
addtologs "sent ${videofullpath} to ${vidtgidsarray[$item]} Telegram file ID"
else
execerror "sent ${videofullpath} to ${telegramchatid} Telegram Chat ID"
fi
if [ -e "${vidcompressed}" ]; then
rm "${vidcompressed}"
fi
fi
done
# TELEGRAM SEND MEDIAGROUP
if [ ! "${only}" == "--onlywp" ]; then
response=$(curl -s -F "chat_id=${telegramchatid}" \
-F media='[
{"type":"photo","media":"'"${tgpreviewlink}"'",
"caption":"period: '"${viddate}"'\nsource: '"${tgpreviewtext}"'\nstream: '"${youtubelink}"'"},
{"type":"video","media":"'"${vidtgidsarray[0]}"'"},
{"type":"video","media":"'"${vidtgidsarray[1]}"'"},
{"type":"video","media":"'"${vidtgidsarray[2]}"'"},
{"type":"video","media":"'"${vidtgidsarray[3]}"'"},
{"type":"video","media":"'"${vidtgidsarray[4]}"'"},
{"type":"video","media":"'"${vidtgidsarray[5]}"'"}]' \
-H "Content-Type:multipart/form-data" \
"${telegramapiurl}/sendMediaGroup")
fi
# WORDPRESS UPDATE PAGE
if [ ! "${only}" == "--onlytg" ]; then
setconfig
getconfig
xml=$(cat "./${wptemplateis}")
xml=${xml//wpeditpageid/${wpeditpageid}}
xml=${xml//wpxmlrpcuser/${wpxmlrpcuser}}
xml=${xml//wpxmlrpcpass/${wpxmlrpcpass}}
xml=${xml//youtubelink/${youtubelink}}
xml=${xml//"currentdp01[0]"/${currentdp01[0]}}
xml=${xml//"currentdp01[1]"/${currentdp01[1]}}
xml=${xml//"currentdp02[0]"/${currentdp02[0]}}
xml=${xml//"currentdp02[1]"/${currentdp02[1]}}
xml=${xml//"currentdp04[0]"/${currentdp04[0]}}
xml=${xml//"currentdp04[1]"/${currentdp04[1]}}
xml=${xml//"currentdp05[0]"/${currentdp05[0]}}
xml=${xml//"currentdp05[1]"/${currentdp05[1]}}
xml=${xml//"currentdp11[0]"/${currentdp11[0]}}
xml=${xml//"currentdp11[1]"/${currentdp11[1]}}
xml=${xml//"currentdp12[0]"/${currentdp12[0]}}
xml=${xml//"currentdp12[1]"/${currentdp12[1]}}
xml=${xml//"currentwp01[0]"/${currentwp01[0]}}
xml=${xml//"currentwp01[1]"/${currentwp01[1]}}
xml=${xml//"currentwp02[0]"/${currentwp02[0]}}
xml=${xml//"currentwp02[1]"/${currentwp02[1]}}
xml=${xml//"currentwp04[0]"/${currentwp04[0]}}
xml=${xml//"currentwp04[1]"/${currentwp04[1]}}
xml=${xml//"currentwp05[0]"/${currentwp05[0]}}
xml=${xml//"currentwp05[1]"/${currentwp05[1]}}
xml=${xml//"currentwp11[0]"/${currentwp11[0]}}
xml=${xml//"currentwp11[1]"/${currentwp11[1]}}
xml=${xml//"currentwp12[0]"/${currentwp12[0]}}
xml=${xml//"currentwp12[1]"/${currentwp12[1]}}
xml=${xml//"currentmp01[0]"/${currentmp01[0]}}
xml=${xml//"currentmp01[1]"/${currentmp01[1]}}
xml=${xml//"currentmp02[0]"/${currentmp02[0]}}
xml=${xml//"currentmp02[1]"/${currentmp02[1]}}
xml=${xml//"currentmp04[0]"/${currentmp04[0]}}
xml=${xml//"currentmp04[1]"/${currentmp04[1]}}
xml=${xml//"currentmp05[0]"/${currentmp05[0]}}
xml=${xml//"currentmp05[1]"/${currentmp05[1]}}
xml=${xml//"currentmp11[0]"/${currentmp11[0]}}
xml=${xml//"currentmp11[1]"/${currentmp11[1]}}
xml=${xml//"currentmp12[0]"/${currentmp12[0]}}
xml=${xml//"currentmp12[1]"/${currentmp12[1]}}
xml=${xml//"currentyp01[0]"/${currentyp01[0]}}
xml=${xml//"currentyp01[1]"/${currentyp01[1]}}
xml=${xml//"currentyp02[0]"/${currentyp02[0]}}
xml=${xml//"currentyp02[1]"/${currentyp02[1]}}
xml=${xml//"currentyp04[0]"/${currentyp04[0]}}
xml=${xml//"currentyp04[1]"/${currentyp04[1]}}
xml=${xml//"currentyp05[0]"/${currentyp05[0]}}
xml=${xml//"currentyp05[1]"/${currentyp05[1]}}
xml=${xml//"currentyp11[0]"/${currentyp11[0]}}
xml=${xml//"currentyp11[1]"/${currentyp11[1]}}
xml=${xml//"currentyp12[0]"/${currentyp12[0]}}
xml=${xml//"currentyp12[1]"/${currentyp12[1]}}
xml=${xml//wpedituserid/${wpedituserid}}
xml=${xml//wppageauthor/${wppageauthor}}
xml=${xml//wppagelinkis/${wppagelinkis}}
xml=${xml//wpeditdateis/${wpeditdateis}}
response=$(curl -d "${xml}" "${wpxmlrpclink}")
if echo "${response}" | grep -q '<boolean>1</boolean>'; then
addtologs "update $(grep 'Link' "${xml}" | cut -d'>' -f 6 | cut -d'<' -f 1))"
else
echo "${response}" | xmllint --format - > "${pathroot}/wp-page${wpeditpageid}-response.xml" 2>/dev/null
execerror "${pathroot}/wp-page${wpeditpageid}-response.xml"
fi
fi
execquite

View File

@ -15,21 +15,37 @@
[enable-broadcast] [enable-broadcast]
# List the broadcast block names. Only blocks with the TRUE value will be used. # List the broadcast block names. Only blocks with the TRUE value will be used.
#
camera.test.local = true camera.test.local = true
[enable-sequences] [enable-sequences]
# List the sequence/camera block names. Only blocks with the TRUE value will be used. # List the sequence camera block names. Only blocks with the TRUE value will be used.
#
camera.test.local = true camera.test.local = true
[enable-sensors] [enable-sensors]
# List the sensor block names. Only blocks with the TRUE value will be used. # List the sensor block names. Only blocks with the TRUE value will be used.
#
sensor.test.local = true sensor.test.local = true
[enable-convert]
# List the convert block names. Only blocks with the TRUE value will be used.
#
camera.test.local = true
[enable-publish]
# List the publish block names. Only blocks with the TRUE value will be used.
#
camera.test.local = true
[broadcast-config:camera.test.local] [broadcast-config:camera.test.local]
# Broadcast parameter description block always starts with "broadcast-config:". # Broadcast parameter description block always starts with "broadcast-config:".
#
src = rtsp://user:pass@192.168.254.253:554/Streaming/Channels/101,http://radio.fm:8000/stream.mp3 src = rtsp://user:pass@192.168.254.253:554/Streaming/Channels/101,http://radio.fm:8000/stream.mp3
dst = rtp://239.0.0.1:5554 dst = rtp://239.0.0.1:5554
# Optionality you can change video stream framerate. # Optionality you can change video stream framerate.
@ -56,9 +72,11 @@ dst = rtp://239.0.0.1:5554
[sensor-config:sensor.test.local] [sensor-config:sensor.test.local]
# Remote host's sensor parameter description block always starts with "sensor-config:". # Remote host's sensor parameter description block always starts with "sensor-config:".
#
hostname = 192.168.254.252 hostname = 192.168.254.252
username = user username = user
userpass = pass userpass = pass
#
# To recognize options for polling a sensor, you must specify the type of sensor. # To recognize options for polling a sensor, you must specify the type of sensor.
# Supported types: # Supported types:
# ds18b20 # ds18b20
@ -68,19 +86,38 @@ nodename = 28-1a2b3c4d5e6f
[camera-config:camera.test.local] [camera-config:camera.test.local]
# Camera parameter description block always starts with "camera-config:". # Camera parameter description block always starts with "camera-config:".
#
hostname = 192.168.254.253 hostname = 192.168.254.253
username = user username = user
userpass = pass userpass = pass
#
# If a record directory on a remote host is used, a username and password must be specified. # If a record directory on a remote host is used, a username and password must be specified.
# Supported protocols: # Supported protocols:
# FTP, SFTP. # FTP, SFTP, SMB or local path.
records_root_path = ftp://192.168.254.254/Records/camera.test.local records_root_path = ftp://user:pass@192.168.254.254:21/Records/camera.test.local
records_root_user = user #
records_root_pass = pass # One line parameters string has lower priority and parameters are overwritten by
# separated parameter variables if you use both.
#
#records_root_path = /Records/camera.test.local
#
#records_root_host = 192.168.254.254
#
# Optionality you can set custom connection port:
#records_root_port = 21
#
# You must set connection type (ftp is faster than sftp, sftp is faster than smb):
# ftp, sftp, smb.
#records_root_type = ftp
#
#records_root_user = user
#
#records_root_pass = pass
[camera-sequences:camera.test.local] [camera-sequences:camera.test.local]
# Camera sequence description block always starts with "camera-sequences:". # Camera sequence description block always starts with "camera-sequences:".
#
# Place only the sequence of PTZ-actions in this block! # Place only the sequence of PTZ-actions in this block!
# Variable name can be anything. Only 'downloadjpeg' is using this for filename prefix. # Variable name can be anything. Only 'downloadjpeg' is using this for filename prefix.
# Available actions: # Available actions:
@ -108,5 +145,99 @@ step051 = setposashome, -, -, -, -, -, -,
step061 = settextonosd, 0, 0, -, -, -, -, 3, hello, 'x|y: osd text position, text: text for osd without quotes or commas' 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' 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' 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' step071 = downloadjpeg, 1920, 1080, -, -, -, -, 5, , 'name: filename prefix, x|y: camera width|height resolution'
step999 = rebootcamera, -, -, -, -, -, -, 120, , step999 = rebootcamera, -, -, -, -, -, -, 120, ,
[convert-config:camera.test.local]
# Converter parameter description block always starts with "convert-config:".
#
image_find_names = step071, image-01, image-02
# If image root or destination video directories on a remote host is used, username and password must be specified.
# Supported protocols:
# FTP, SFTP, SMB or local path.
image_root_path = sftp://user:pass@192.168.254.254/Records/camera.test.local
#
# One line parameters string has lower priority and parameters are overwritten by
# separated parameter variables if you use both.
#
#image_root_path = /Records/camera.test.local
#
#image_root_host = 192.168.254.254
#
# Optionality you can set custom connection port:
#image_root_port = 22
#
# You must set connection type (ftp is faster than sftp, sftp is faster than smb):
# ftp, sftp, smb.
#image_root_type = sftp
#
#image_root_user = user
#
#image_root_pass = pass
video_dest_path = smb://user:pass@192.168.254.254/Downloads
#
# One line parameters string has lower priority and parameters are overwritten by
# separated parameter variables if you use both.
#
#video_dest_path = /Downloads
#
# Optionality you can set custom connection port:
#video_dest_host = 192.168.254.254
#
#video_dest_port = 445
#
# You must set connection type (ftp is faster than sftp, sftp is faster than smb):
# ftp, sftp, smb.
#video_dest_type = smb
#
#video_dest_user = user
#
#video_dest_pass = pass
video_scale_x = 1920
video_scale_y = 1080
video_framerate = 25
[publish-config:camera.test.local]
# Publisher parameter description block always starts with "publish-config:".
#
video_find_names = step071, image-01, image-02
# If a video directory on a remote host is used, a username and password must be specified.
# Supported protocols:
# FTP, SFTP, SMB or local path.
video_root_path = /home/user/Downloads
#
# One line parameters string has lower priority and parameters are overwritten by
# separated parameter variables if you use both.
#
#video_dest_path = /home/user/Downloads
#
#video_dest_host =
#
# Optionality you can set custom connection port:
#video_dest_port =
#
# You must set connection type (ftp is faster than sftp, sftp is faster than smb):
# ftp, sftp, smb.
#video_dest_type =
#
#video_dest_user =
#
#video_dest_pass =
#
# Optionality you can enable or disable publishing by Wordpress:
# true - Wordpress enabled, false - Wordpress disbaled.
wp_enabled = true
wp_site_name = www.site.name
wp_user_name = user
wp_user_pass = pass
wp_update_page_id = 4848
#
# Optionality you can enable or disable publishing by Telegram:
# true - Wordpress enabled, false - Telegram disbaled.
tg_enabled = true
tg_api_key = TELEGRAM_API_KEY
tg_chat_id = @blackhole

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 KiB