aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rwxr-xr-xscripts/00-export-videos.sh28
-rw-r--r--videos/.gitkeep0
3 files changed, 30 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..627c788
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+videos/*
+!videos/.gitkeep
diff --git a/scripts/00-export-videos.sh b/scripts/00-export-videos.sh
new file mode 100755
index 0000000..42f5d6f
--- /dev/null
+++ b/scripts/00-export-videos.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+CHAT_EXPORT="$1"
+
+jq \
+ -r '.messages | map(select(.media_type == "video_file")) | .[].file' \
+ "$CHAT_EXPORT/result.json" | while read -r file; do
+
+ FILE="$CHAT_EXPORT/$file"
+
+ ffprobe \
+ -v quiet \
+ -print_format json \
+ -select_streams a \
+ -show_streams \
+ "$FILE" > "$FILE.tmp.json"
+
+ HAS_AUDIO="$(jq '.streams | length > 0' "$FILE.tmp.json")"
+
+ if [ "$HAS_AUDIO" = "true" ]; then
+
+ cp "$FILE" videos/$(basename "$FILE")
+
+ fi
+
+ rm "$FILE.tmp.json"
+
+done
diff --git a/videos/.gitkeep b/videos/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/videos/.gitkeep