diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-08-02 15:20:56 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-08-02 15:20:56 -0400 |
| commit | d942c2a67ffba17845f0f9a952228560f963ee70 (patch) | |
| tree | cfafc3ac3a7daf9cafc965d4b0846874d77a56f1 /scripts | |
| parent | 2c547184d437c2fe15dcdaed227d5e8f3e34f901 (diff) | |
Add previews for audio via ffmpeg and some archive formats
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/preview | 12 |
1 files changed, 10 insertions, 2 deletions
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" |
