diff options
Diffstat (limited to 'scripts/00-export-videos.sh')
| -rwxr-xr-x | scripts/00-export-videos.sh | 28 |
1 files changed, 28 insertions, 0 deletions
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 |
