index : logbot | |
Archlinux32 log bot | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-04-09 20:22:13 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-04-09 20:22:13 +0200 |
commit | 0d8a7030ff123c7197251f75415a44ce1de74bda (patch) | |
tree | 9332abe80bc8b2100f07fc1852846ea339a56320 | |
parent | 820fee8960b870836e9ad73fc03fdc974929de84 (diff) |
-rwxr-xr-x | convert.sh | 28 |
@@ -1,13 +1,13 @@ #!/bin/bash -dir='/srv/arch-mirror/arch/arch/archlinux32/irc-logs/#archlinux-ports/' +dirs='/srv/arch-mirror/arch/arch/archlinux32/irc-logs/' declare -A colors create_color() { if [ -z "${colors["$1"]}" ]; then colors["$1"]=$( - find "${dir}" -type f -name '*-*-*.html' -exec \ + find "${dirs}" -type f -name '*-*-*.html' -exec \ grep -h "style=\"color:#[0-9a-f]\{6\}\"><$1>" {} \; | \ sed 's@.* style="color:#\([0-9a-f]\{6\}\)"><.*@\1@' | \ sort -u @@ -32,13 +32,28 @@ create_color() { # "time * | nick action" # we reformat other formats accordingly -if [ "$1" = 'html' ]; then +if [ "$1" = 'tyzoid' ]; then + shift + channel="$1" + shift + sed ' + s/^\[\([^]]\+\)] \*\*\* Joins: \(\S\+\) .*$/\1 --> | \2 has joined '"${channel}"' / + t + s/^\[\([^]]\+\)] \*\*\* Quits: \(\S\+\) (\(.*\))$/\1 <-- | \2 has quit (\3)/ + t + s/\[\([^]]\+\)] <\(\S\+\)> /\1 \2 | / + t + d + ' +elif [ "$1" = 'html' ]; then + shift + channel="$1" shift sed -n ' /^<font size="2">/{ s@^<font size="2">(\([^)]\+\))</font><b> @\1 @ /entered the room\.<\/b><br\/>$/{ - s@^\(\S\+\) \(.*\S\) \[.*] entered the room\.<\/b><br\/>$@\1 --> | \2 has joined #archlinux-ports @ + s@^\(\S\+\) \(.*\S\) \[.*] entered the room\.<\/b><br\/>$@\1 --> | \2 has joined '"${channel}"' @ p d } @@ -74,9 +89,10 @@ if [ "$1" = 'html' ]; then else cat fi | \ + sponge | \ sed ' s/([^()]*@[^()]*) // - ' + ' | \ sed ' :a $!N @@ -94,7 +110,7 @@ fi | \ exit 42 fi time=$( - date -d@$(($(date -d"${a}" +%s)+3600*$2)) +%T + date -d@$(($(date -d"${a}" +%s)+3600*$1)) +%T ) if [ "${b}" = '-->' ]; then name="${c%% *}" |