Commit 04328dd6 authored by user472393's avatar user472393
Browse files

add elo to matcher_promote

parent ab2381c5
......@@ -10,11 +10,16 @@ info "matcher_promoter advertising time"
advertising=(irc.local.#the_stream irc.local.#battle irc.quakenet.#arika \
irc.twitch.#tetrisconcept_tv)
db_dir=$PWD/elo_db
inwee=$HOME/bin/inwee
stream_url=https://twitch.tv/tetrisconcept_tv
site_url=https://tetrisconcept_tv
tmp_dir=$PWD/tmp
promoter () {
test -d "$db_dir" || mkdir "$db_dir"
declare -A elo_db
find_extract () {
# find the pid of the televised match
test -d "$tmp_dir/tv.lock" || quit "promoted without $tmp_dir/tv.lock"
......@@ -28,19 +33,28 @@ promoter () {
players=("${players[@]##*/}")
[[ -n "${players[0]}" && "${players[1]}" ]] || quit "promoted with p1 or p2 empty"
info "plers are ${players[0]} ${players[1]}"
}
elo_import () {
for i in "${players[@]}"; do
elo_db[$i]=$(head -n 1 "$db_dir/$i" 2> /dev/null || \
elo_db[$i]=1500)
done
}
spam () {
# spam these channels
for i in "${advertising[@]}"; do
printf '%s\n' "${players[0]} vs. ${players[1]} on $stream_url" |\
$inwee -b "$i"
done
# for i in "${advertising[@]}"; do
# printf '%s\n' "${players[0]} (${elo_db[${players[0]}]}) vs. ${players[1]} (${elo_db[${players[1]}]}) on $stream_url" |\
# $inwee -b "$i"
# done
for i in "${players[@]}"; do
printf '%s\n' "${players[0]} vs. ${players[1]} on $stream_url" |\
printf '%s\n' "${players[0]} (${elo_db[${players[0]}]}) vs. ${players[1]} (${elo_db[${players[1]}]}) on $site_url" |\
$inwee -b "irc.twitch.#$i"
done
}
promoter
find_extract
elo_import
spam
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment