You are not logged in.

#1 2020-10-27 23:14:15

shoelesshunter
Member
From: USA
Registered: 2014-05-18
Posts: 289

ranger previews for m4a files

I have recently begun using ranger on i3. I have enbled previews in my scope.sh (which I had help setting up).

mp3 files display a mediainfo preview. m4a files however display the contents of embedded artwork.

I want to get a mediainfo preview of my m4a audio files. here is that section of my scope.sh:

case "$mimetype" in
    # Syntax highlight for text files:
    text/* | */xml)
        if [ "$(tput colors)" -ge 256 ]; then
            pygmentize_format=terminal256
            highlight_format=xterm256
        else
            pygmentize_format=terminal
            highlight_format=ansi
        fi
        try safepipe highlight --out-format=${highlight_format} "$path" && { dump | trim; exit 5; }
        try safepipe pygmentize -f ${pygmentize_format} "$path" && { dump | trim; exit 5; }
        exit 2;;
    # Ascii-previews of images:
    image/*)
        img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;;
    # Display information about media files:
    video/* | audio/*)
        exiftool "$path" && exit 5
        # Use sed to remove spaces so the output fits into the narrow window
        try mediainfo "$path" && { dump | trim | sed 's/  \+:/: /;';  exit 5; } || exit 1;;
esac

exit 1

It seems the output of

file --mime-type *.m4a

is 'video/mp4', and that is the issue. Suggestions?

Last edited by shoelesshunter (2020-10-27 23:14:49)

Offline

#2 2020-10-28 08:17:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,665

Re: ranger previews for m4a files

Split audio/* and video/*, don't run exiftool on audio or drop exiftool altogether? Seems more interesting to be used on images (camera photos)

Offline

Board footer

Powered by FluxBB