mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-06 07:35:56 +02:00
Update helper_stats_graphs.yaml
This commit is contained in:
52
.github/workflows/helper_stats_graphs.yaml
vendored
52
.github/workflows/helper_stats_graphs.yaml
vendored
@@ -150,35 +150,31 @@ jobs:
|
|||||||
sed -i "2d" Stats3
|
sed -i "2d" Stats3
|
||||||
# Inverse file
|
# Inverse file
|
||||||
gawk -i inplace '{for(i=NF;i>1;i--)printf "%s ",$i;printf "%s",$1;print ""}' Stats3
|
gawk -i inplace '{for(i=NF;i>1;i--)printf "%s ",$i;printf "%s",$1;print ""}' Stats3
|
||||||
# Transpose data
|
# For each addon
|
||||||
echo "1"
|
for line in $(awk '{ print $1 }' Stats3); do
|
||||||
awk '
|
|
||||||
{
|
|
||||||
for (i=1; i<=NF; i++) {
|
|
||||||
a[NR,i] = $i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NF>p { p = NF }
|
|
||||||
END {
|
|
||||||
for(j=1; j<=p; j++) {
|
|
||||||
str=a[1,j]
|
|
||||||
for(i=2; i<=NR; i++){
|
|
||||||
str=str" "a[i,j];
|
|
||||||
}
|
|
||||||
print str
|
|
||||||
}
|
|
||||||
}' Stats3 > StatsTmp && mv StatsTmp Stats3
|
|
||||||
# For each addon, create graph
|
|
||||||
echo "3"
|
|
||||||
for line in $(head -1 Stats3); do
|
|
||||||
TITLE="${line%% *}"
|
TITLE="${line%% *}"
|
||||||
FOLDER="$(grep -rl "ghcr.io/alexbelgium/$TITLE-" . | xargs dirname)" || echo "$TITLE not found"
|
FOLDER="$(grep -rl "ghcr.io/alexbelgium/$TITLE-" . | xargs -r dirname)"
|
||||||
# if folder exists
|
# If non null
|
||||||
if [ -d "$FOLDER" ]; then
|
if [[ ${#FOLDER} -gt 2 ]]; then
|
||||||
echo "$TITLE"
|
cp Stats3 StatsTmp
|
||||||
head -1 Stats3 > StatsTmp
|
sed -i "/$TITLE/!d" StatsTmp
|
||||||
grep "$TITLE" Stats3 >> StatsTmp
|
# Transpose data
|
||||||
cat StatsTmp
|
awk '
|
||||||
|
{
|
||||||
|
for (i=1; i<=NF; i++) {
|
||||||
|
a[NR,i] = $i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NF>p { p = NF }
|
||||||
|
END {
|
||||||
|
for(j=1; j<=p; j++) {
|
||||||
|
str=a[1,j]
|
||||||
|
for(i=2; i<=NR; i++){
|
||||||
|
str=str" "a[i,j];
|
||||||
|
}
|
||||||
|
print str
|
||||||
|
}
|
||||||
|
}' StatsTmp > StatsTmp2 && mv StatsTmp2 StatsTmp
|
||||||
# Plot graph
|
# Plot graph
|
||||||
( gnuplot-nox -persist <<-EOFMarker
|
( gnuplot-nox -persist <<-EOFMarker
|
||||||
set title "$TITLE"
|
set title "$TITLE"
|
||||||
|
|||||||
Reference in New Issue
Block a user