From b97b221891dc2eaf70d8a58e5e969ead70025a03 Mon Sep 17 00:00:00 2001 From: byte Date: Tue, 1 Apr 2025 21:01:31 +0200 Subject: [PATCH] foo --- .gitignore | 1 + inc/bahnhoefe.sh | 16 +++++++++++ inc/floskeln.sh | 49 +++++++++++++++++++++++++++++++++ inc/platform.sh | 17 ++++++++++++ inc/tones.sh | 5 ++++ inc/zeiten.sh | 39 +++++++++++++++++++++++++++ inc/zuege.sh | 46 +++++++++++++++++++++++++++++++ play.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 243 insertions(+) create mode 100644 .gitignore create mode 100755 inc/bahnhoefe.sh create mode 100755 inc/floskeln.sh create mode 100755 inc/platform.sh create mode 100755 inc/tones.sh create mode 100755 inc/zeiten.sh create mode 100755 inc/zuege.sh create mode 100755 play.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ae26c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +modules/* diff --git a/inc/bahnhoefe.sh b/inc/bahnhoefe.sh new file mode 100755 index 0000000..4557c0e --- /dev/null +++ b/inc/bahnhoefe.sh @@ -0,0 +1,16 @@ +ZielBhf() { +FileZielBhf=$(awk -F, -v search="$ZielBhf" '$5 == search {print $1}' modules/ziele.csv) +FullZielBhf=$(awk -F, -v search="$ZielBhf" '$5 == search {print $6}' modules/ziele.csv) +printf "${RED}$FullZielBhf${NC}\n" +mpv modules/dt/ziele/variante2/hoch/$FileZielBhf 2&>1 1>/dev/null +} + +ViaBhf() { +IFS=',' read -ra values <<< $ViaBhf +for value in "${values[@]}"; do +FileViaBhf=$(awk -F, -v search="$value" '$5 == search {print $1}' modules/ziele.csv) +FullViaBhf=$(awk -F, -v search="$value" '$5 == search {print $6}' modules/ziele.csv) +printf "${RED}$FullViaBhf${NC}\n" +mpv modules/dt/ziele/variante2/hoch/$FileViaBhf 2&>1 1>/dev/null +done +} diff --git a/inc/floskeln.sh b/inc/floskeln.sh new file mode 100755 index 0000000..bf6e958 --- /dev/null +++ b/inc/floskeln.sh @@ -0,0 +1,49 @@ +MeineDamenundHerrenanGleis() { +#Meine Damen und Herren, an Gleis +printf "${RED}Meine Damen und Herren an Gleis${NC}\n" +mpv modules/dt/module/0143.wav 2&>1 1>/dev/null +} + +vorsicht_bei_der_einfahrt() { +#Bitte vorsicht bei der Einfahrt +printf "${RED}Bitte Vorsicht bei der Einfahrt${NC}\n" +mpv modules/dt/module/0012.wav 2&>1 1>/dev/null +} + +BitteBeachtenSie() { +#bitte beachten sie +printf "${RED}Bitte beachten sie${NC}\n" +mpv modules/dt/module/0089.wav 2&>1 1>/dev/null +} + +InformationZu() { +#information zu, +printf "${RED}Information zu${NC}\n" +mpv modules/dt/module_3_1/030.wav 2&>1 1>/dev/null +} + +Nach() { +#nach +printf "${RED}Nach${NC}\n" +mpv modules/dt/module/0054.wav 2&>1 1>/dev/null +} + +Ueber() { +#über +printf "${RED}über${NC}\n" +mpv modules/dt/module/0063.wav 2&>1 1>/dev/null +} +Abfahrt_ursp() { +printf "${RED}Abfahrt ursprünglich${NC}\n" +mpv modules/dt/module_3_1/002.wav 2&>1 1>/dev/null +} +Ankunft_ursp() { +printf "${RED}Ankunft ursprünglich${NC}\n" +mpv modules/dt/module_3_1/005.wav 2&>1 1>/dev/null +} +Dieser_Zug_wird() { +printf "${RED}Dieser Zug wird${NC}\n" +#Dieser Zug wird +mpv modules/dt/module/0207.wav 2&>1 1>/dev/null +} + diff --git a/inc/platform.sh b/inc/platform.sh new file mode 100755 index 0000000..9986c30 --- /dev/null +++ b/inc/platform.sh @@ -0,0 +1,17 @@ +GleisNr() { +#Gleis +printf "${RED}$GleisNr${NC}\n" +mpv modules/dt/gleise_zahlen/hoch//$GleisNr.wav 2&>1 1>/dev/null +} + +ZugEinfahrt() { +#fährt jetzt ein +printf "${RED}fährt jetzt ein${NC}\n" +mpv modules/dt/module/0095.wav 2&>1 1>/dev/null +} + +planm_abfahrt() { +printf "${RED}planmäßige Abfahrt${NC}\n" +#planmäßige Abfahrt +mpv modules/dt/module/0438.wav 2&>1 1>/dev/null +} diff --git a/inc/tones.sh b/inc/tones.sh new file mode 100755 index 0000000..deb0f75 --- /dev/null +++ b/inc/tones.sh @@ -0,0 +1,5 @@ +Ansage_Start() { +#Gong +printf "${RED}Gong${NC}\n" +mpv modules/gong/klangtyp_modern/ag-short-gong3.wav 2&>1 1>/dev/null +} diff --git a/inc/zeiten.sh b/inc/zeiten.sh new file mode 100755 index 0000000..2646992 --- /dev/null +++ b/inc/zeiten.sh @@ -0,0 +1,39 @@ +uhrzeit(){ +length=${#AbfahrtUhr} + +# Check if the number has at least 3 digits +if [[ $length -eq 1 ]]; then +mpv modules/dt/gleise_zahlen//hoch/$AbfahrtUhr.wav 2&>1 1>/dev/null +echo "1 Digit" +elif [[ $length -eq 2 ]]; then +mpv modules/dt/gleise_zahlen//hoch/$AbfahrtUhr.wav 2&>1 1>/dev/null +echo "2 Digit" +elif [[ $length -eq 3 ]]; then + # Get the first part by truncating to the nearest hundred + first_part=$(($AbfahrtUhr / 100 * 100)) # Truncate to the nearest hundred + second_part=$(($AbfahrtUhr % 100)) # Get the remainder (last two digits) + + printf "${RED}$first_part $second_part${NC}\n" + mpv modules/dt/gleise_zahlen//hoch/${first_part}_.wav modules/dt/gleise_zahlen/hoch//$second_part.wav 2&>1 1>/dev/null + +elif [[ $length -eq 4 ]]; then + # Split a 4-digit number into 2 + 2 + first_part="${AbfahrtUhr:0:2}" # First two digits + second_part="${AbfahrtUhr:2:2}" # Last two digits + + printf "${RED}$first_part Uhr${NC}\n" + mpv modules/dt/zeiten/stunden/hoch/${first_part}.wav 2&>1 1>/dev/null + printf "${RED}$second_part${NC}\n" + mpv modules/dt/zeiten/minuten/hoch/$second_part.wav 2&>1 1>/dev/null + +else + echo "Please enter a number with at least 3 digits." +fi + +} +verspaetung_45() { +printf "${RED}voraussichtlich 45 Min später eintreffen${NC}\n" +#vorraussichtlich 45 Minuten später eintreffen +mpv modules/dt/zeiten/verspaetung_an/045.wav 2&>1 1>/dev/null +} + diff --git a/inc/zuege.sh b/inc/zuege.sh new file mode 100755 index 0000000..f8c2f0a --- /dev/null +++ b/inc/zuege.sh @@ -0,0 +1,46 @@ +Zuggattung() { +#ICE, RE usw. +printf "${RED}$Zuggattung${NC}\n" +mpv modules/dt/zuggattungen/hoch//$Zuggattung.wav 2&>1 1>/dev/null +} + +ZugNr() { +# Check if the input is a valid number +if ! [[ "$ZugNr" =~ ^[0-9]+$ ]]; then + echo "Please enter a valid number." + exit 1 +fi +# Get the length of the number +length=${#ZugNr} + +# Check if the number has at least 3 digits +if [[ $length -eq 1 ]]; then +mpv modules/dt/gleise_zahlen//hoch/$ZugNr.wav 2&>1 1>/dev/null +printf "${RED}$ZugNr${NC}\n" +elif [[ $length -eq 2 ]]; then +printf "${RED}$ZugNr${NC}\n" +mpv modules/dt/gleise_zahlen//hoch/$ZugNr.wav 2&>1 1>/dev/null +elif [[ $length -eq 3 ]]; then + # Get the first part by truncating to the nearest hundred + first_part=$(($ZugNr / 100 * 100)) # Truncate to the nearest hundred + second_part=$(($ZugNr % 100)) # Get the remainder (last two digits) + + printf "${RED}$first_part${NC}\n" + mpv modules/dt/gleise_zahlen//hoch/${first_part}_.wav 2&>1 1>/dev/null + printf "${RED}$second_part${NC}\n" + mpv modules/dt/gleise_zahlen/hoch//$second_part.wav 2&>1 1>/dev/null + +elif [[ $length -eq 4 ]]; then + # Split a 4-digit number into 2 + 2 + first_part="${ZugNr:0:2}" # First two digits + second_part="${ZugNr:2:2}" # Last two digits + + printf "${RED}$first_part${NC}\n" + mpv modules/dt/gleise_zahlen//hoch/${first_part}.wav 2&>1 1>/dev/null + printf "${RED}$second_part${NC}\n" + mpv modules/dt/gleise_zahlen/hoch//$second_part.wav 2&>1 1>/dev/null + +else + echo "Please enter a number with at least 3 digits." +fi +} diff --git a/play.sh b/play.sh new file mode 100755 index 0000000..b851e93 --- /dev/null +++ b/play.sh @@ -0,0 +1,70 @@ +AnsageTyp=$1 +GleisNr=$2 +Zuggattung=$3 +ZugNr=$4 +ZielBhf=$5 +ViaBhf=$6 +AbfahrtUhr=$7 + +RED='\033[0;31m' +NC='\033[0m' # No Color + +. $(dirname $0)/inc/floskeln.sh +. $(dirname $0)/inc/bahnhoefe.sh +. $(dirname $0)/inc/floskeln.sh +. $(dirname $0)/inc/platform.sh +. $(dirname $0)/inc/tones.sh +. $(dirname $0)/inc/zeiten.sh +. $(dirname $0)/inc/zuege.sh + +if [ $AnsageTyp = "Einfahrt" ]; then +Ansage_Start +read -t 0.5 +MeineDamenundHerrenanGleis +read -t 0.5 +GleisNr $GleisNr +read -t 0.5 +ZugEinfahrt +read -t 0.5 +Zuggattung $Zuggattung +read -t 0.5 +ZugNr $ZugNr +read -t 0.5 +Nach +read -t 0.5 +ZielBhf $ZielBhf +read -t 0.5 +Ueber +read -t 0.5 +ViaBhf $ViaBhf +read -t 0.5 +planm_abfahrt +read -t 0.5 +uhrzeit $AbfahrtUhr +read -t 0.5 +vorsicht_bei_der_einfahrt + +elif [ $AnsageTyp = "Information" ]; then +Ansage_Start +InformationZu +Zuggattung $Zuggattung +ZugNr $ZugNr +Nach +ZielBhf $ZielBhf +Ankunft_ursp +uhrzeit $AbfahrtUhr +Abfahrt_ursp +uhrzeit $AbfahrtUhr +Dieser_Zug_wird +verspaetung_45 +exit +fi +#Dieser Zug wird +#mpv modules/dt/module/0207.wav +#vorraussichtlich 45 Minuten später eintreffen +#mpv modules/dt/zeiten/verspaetung_an/045.wav +#Grund dafür verspätung vorausfahender zug +#mpv modules/dt/grund_dafuer/035.wav +#Wir bitten um Entschuldigung +#mpv modules/dt/module_3_1/042.wav +