mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-16 09:28:20 +01:00
Update weekly_stats_graphs.yaml
This commit is contained in:
68
.github/workflows/weekly_stats_graphs.yaml
vendored
68
.github/workflows/weekly_stats_graphs.yaml
vendored
@@ -139,73 +139,7 @@ jobs:
|
||||
)
|
||||
#plot for [i=1:*] 'Stats3' using 0:i
|
||||
rm Stats3
|
||||
|
||||
- name: Create individual stats
|
||||
run: |
|
||||
# Prepare data
|
||||
cp Stats Stats3
|
||||
# Remove Totals
|
||||
sed -i "2d" Stats3
|
||||
# Transpose data
|
||||
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
|
||||
input="Stats3"
|
||||
while IFS= read -r line
|
||||
do
|
||||
TITLE="${line%% *}"
|
||||
FOLDER="$(grep -rl "ghcr.io/alexbelgium/$TITLE-" */* | xargs dirname)"
|
||||
# if folder exists
|
||||
if [ -d "$FOLDER" ]; then
|
||||
# Plot graph
|
||||
( gnuplot-nox -persist <<-EOFMarker
|
||||
set title "$TITLE"
|
||||
set ylabel 'Number of installations'
|
||||
set xdata time
|
||||
set datafile missing "-"
|
||||
set timefmt "%Y-%m-%d"
|
||||
set format x "%y-%m-%d"
|
||||
set datafile sep ' '
|
||||
set autoscale
|
||||
set terminal png size 500,300
|
||||
set output "$FOLDER/stats.png"
|
||||
set term png tiny
|
||||
plot for [i=2:*] 'Stats3' using 1:i w l title columnhead(i) smooth csplines
|
||||
EOFMarker
|
||||
) || ( gnuplot-nox -persist <<-EOFMarker
|
||||
set title "$TITLE"
|
||||
set ylabel 'Number of installations'
|
||||
set xdata time
|
||||
set datafile missing "-"
|
||||
set timefmt "%Y-%m-%d"
|
||||
set format x "%y-%m-%d"
|
||||
set datafile sep ' '
|
||||
set autoscale
|
||||
set terminal png size 500,300
|
||||
set output "$FOLDER/stats.png"
|
||||
set term png tiny
|
||||
plot for [i=2:*] 'Stats3' using 1:i w l title columnhead(i)
|
||||
EOFMarker
|
||||
)
|
||||
fi
|
||||
done < "$input"
|
||||
# Clean files
|
||||
rm Stats3
|
||||
|
||||
|
||||
- name: Commit if needed
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user