summaryrefslogtreecommitdiffstats
path: root/skripti
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-04-15 10:33:24 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-04-15 10:33:24 +0200
commit1ffa25152f18588b381fa9260f437f07d9a04003 (patch)
tree99b688314ca245b80185798e12f1e3450eb2a667 /skripti
parentdn05p2 (diff)
downloadr-1ffa25152f18588b381fa9260f437f07d9a04003.tar
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.gz
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.bz2
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.lz
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.xz
r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.zst
r-1ffa25152f18588b381fa9260f437f07d9a04003.zip
Diffstat (limited to 'skripti')
-rwxr-xr-xskripti/namesti.sh1
-rwxr-xr-xskripti/registracija_uporabnika.sh12
-rwxr-xr-xskripti/transcribe_large_file.sh14
3 files changed, 27 insertions, 0 deletions
diff --git a/skripti/namesti.sh b/skripti/namesti.sh
index 88253bf..e36a894 100755
--- a/skripti/namesti.sh
+++ b/skripti/namesti.sh
@@ -7,4 +7,5 @@ Uporabnik $DOAS_USER na računalniku `hostname` je pravkar zahteval poganjanje p
EOF
p=`grep -Eo '[a-zA-Z0-9+][a-zA-Z0-9_+.-]*[a-zA-Z0-9_+./]*' <<<$1 | head -n1`
echo Začel bom nameščanje $p.
+[ $DOAS_USER = dijak ] && echo "PREKINJAM NAMEŠČANJE. uporabnik dijak ne sme nameščati programov iz varnostnih razlogov."
echo | emerge $p
diff --git a/skripti/registracija_uporabnika.sh b/skripti/registracija_uporabnika.sh
new file mode 100755
index 0000000..a2419fa
--- /dev/null
+++ b/skripti/registracija_uporabnika.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# $1 je username, $2 je fullname, $3 je komentar, $4 je expiredate YYYY-MM-DD, $5 je groups, $6 je crypt password
+# GECOS: full name,room number,office tel,home tel,other contact
+set -euo pipefail
+username=`grep -o "[a-z][-_.a-z0-9]*" <<<"$1" | head -n1 | head -c16`
+if [ ! "$username" = "$1" ]
+then
+ echo uporabniško ime ni pravilne oblike. predlagam takole uporabniško ime: $username -- uporabnika nisem izdelal
+ exit 1
+fi
+useradd --expiredate "$4" --groups "$5" --password "$6" --comment "`sed -e s/,//g<<<$2`,,,,`sed -e s/,//<<<$3`-reg.sh $DOAS_USER `date +%s`" $username
+echo uporabnik uspešno izdelan!
diff --git a/skripti/transcribe_large_file.sh b/skripti/transcribe_large_file.sh
new file mode 100755
index 0000000..e9bcc27
--- /dev/null
+++ b/skripti/transcribe_large_file.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -xeuo pipefail
+p=`rev <<<$0 | cut -d/ -f1 | rev`
+d=`mktemp -p "" -d $p.XXX`
+trap "rm -fr $d" EXIT
+ffmpeg -i $1 -f segment -segment_time 240 -acodec pcm_s16le -ac 1 -ar 16000 $d/%03d.wav
+for i in $d/*.wav
+do
+ curl -X 'POST' \
+ 'http://splet.4a.si.:8000/api/transcribe' \
+ -H 'accept: application/json' \
+ -H 'Content-Type: multipart/form-data' \
+ -F "audio_file=@$i;type=audio/wav" | jq --raw-output .result > $1.`rev <<<$i | cut -d. -f2 | cut -d/ -f1 | rev`.txt
+done