This commit is contained in:
root committed 2022-10-11 07:44:28 +07:00
1 parent ab642d9c51
commit 9abad2f998
13 files changed
+57 -41

No files matched your search

+4 -4
View File
@@ -2,16 +2,16 @@
set +vx
# encode - Encode for streaming and schedule cron job
# Usage: encode
# Called by cron every minute; process oldest .upload file in ./uploadpage/streams)
# Called by cron every minute; process oldest .upload file in ./web/streams)
# Required: file coreutils(readlink ls head mv tail rm) cron(crontab) date ffmpeg
# mailer[gitlab.com/pepa65/mailer]
# Check for oldest uploaded file
_=$(readlink -f -- "${BASH_SOURCE:-$0}") repopath=${_%/*}
log=$repopath/process.log dir=$repopath/uploadpage/streams
log=$repopath/process.log dir=$repopath/web/streams
upload=$(ls -Atr "$dir"/*.upload 2>/dev/null |head -1)
# Finished if no uploadpage/streams/*.upload files found
# Finished if no web/streams/*.upload files found
[[ $upload ]] || exit 0
Log(){ # 1:message 2:returncode(empty: no exit) I:file
@@ -22,7 +22,7 @@ Log(){ # 1:message 2:returncode(empty: no exit) I:file
Mail(){ # 1:kind(0:done, 1:wrong type, 2:encoding error) 2:logline I:repopath,email,username,name,type,start,finish
local lines line message sbj msg to from="Stream Upload server" user password smtp port ssltls bcc
source "$repopath/vars" # I:user,password,smtp,port,ssltls,bcc
mapfile -t lines <"$repopath/mailhash"
mapfile -t lines <"$repopath/accounts"
for line in "${lines[@]}"
do [[ ${line:0:1} = '#' ]] && continue
[[ $username = ${line%%$'\t'*} ]] && _=${line#*$'\t'} to=${_%$'\t'*} && break