From d942c2a67ffba17845f0f9a952228560f963ee70 Mon Sep 17 00:00:00 2001 From: JP Appel Date: Sat, 2 Aug 2025 15:20:56 -0400 Subject: Add previews for audio via ffmpeg and some archive formats --- scripts/preview | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'scripts/preview') diff --git a/scripts/preview b/scripts/preview index 7ea67c4..29cb751 100755 --- a/scripts/preview +++ b/scripts/preview @@ -17,6 +17,8 @@ elif grep -q "directory" <<< "$fileinfo"; then filetype="directory" elif grep -q "image" <<< "$mimetype"; then filetype="image" +elif grep -q "audio" <<< "$mimetype"; then + filetype="audio" elif grep -q "video" <<< "$mimetype"; then filetype="video" elif grep -q "ISO" <<< "$fileinfo" ; then @@ -35,7 +37,13 @@ case $filetype in bat -p -r ":$lines" --color=always "$path" ;; "archive") - echo "archive preview not currently supported" + if [[ $mimetype == "application/zip" ]] ; then + unzip -l "$path" + elif [[ $mimetype == "application/x-tar" ]] ; then + tar -t -f "$path" + else + echo "this archive format is currently unsupported" + fi echo "$fileinfo" ;; "iso") @@ -54,7 +62,7 @@ case $filetype in echo "$fileinfo" sqlite3 -readonly "$path" ".schema" ;; - "video") + "video"|"audio") echo "$fileinfo" ffmpeg -loglevel fatal -i "$path" -f ffmetadata - |\ tail -n +2 | sed 's/\\$//' | head -n "$lines" -- cgit v1.2.3