Introduction
Introduction Statistics Contact Development Disclaimer Help
Add media statistics script - bitreich-memestats - Bitreich meme statistics and…
git clone git://bitreich.org/bitreich-memestats git://hg6vgqziawt5s4dj.onion/bi…
Log
Files
Refs
Tags
LICENSE
---
commit 3ef3415790635bdf3af5d3b7636a0c5b6c0869f2
parent ff98fb26d863ec1bd65b01d2203fae703f9cca8b
Author: Anders Damsgaard <[email protected]>
Date: Mon, 20 Apr 2020 10:03:28 +0200
Add media statistics script
Diffstat:
A media-stats.sh | 41 +++++++++++++++++++++++++++++…
1 file changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/media-stats.sh b/media-stats.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# output formatted table with memecache media statistics
+
+# estimated average image viewing time [s]
+img_viewing_time=5
+
+if [ $# -ne 1 ]; then
+ printf 'usage: %s <memecache_path>\n' "$0" >&2
+ exit 1
+fi
+
+i=0
+sum=0.0
+for f in "$1"/*.{mkv,mp4,webm,mp3,ogg}; do
+ i=$((i+=1))
+ new_sum="$(printf '%f + %f\n' \
+ "$(ffprobe -v error -show_entries format=duration \
+ -of default=noprint_wrappers=1:nokey=1 "$f")" "$sum" 2>/dev…
+ bc -l)"
+ sum="$new_sum"
+done
+n_img="$(ls "$1"/*.{png,jpg,JPG,gif} | wc -l)"
+n_vid="$(ls "$1"/*.{mkv,mp4,webm,mp3,ogg} | wc -l)"
+
+printf '\n '
+printf '+----- statistics (%s) ------+\n' "$(date '+%Y-%m-%d')"
+printf ' '
+printf '| number of images: %8s |\n' "$n_img"
+printf ' '
+printf '| number of movies: %8s |\n' "$n_vid"
+printf ' '
+printf '| average movie length: %10.1f s |\n' \
+ "$(printf '%f/%f\n' "$sum" "$i" | bc -l)"
+printf ' '
+printf '| total image viewing time: %6.1f h |\n' \
+ "$(printf '%s*%f/3600\n' "$n_img" "$img_viewing_time" | bc -l)"
+printf ' '
+printf '| total movie length: %10.1f h |\n' \
+ "$(printf '%s/3600\n' "$sum" | bc -l)"
+printf ' '
+printf '+------------------------------------+\n'
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.