Ticket #4479: 0001-Ticket-4479-prioritize-console-players-for-audio-vid.patch

File 0001-Ticket-4479-prioritize-console-players-for-audio-vid.patch, 2.8 KB (added by zaytsev, 3 months ago)
  • misc/ext.d/image.sh

    From 01d2bdf31001b0f6553af586ed334eedddf7bcc3 Mon Sep 17 00:00:00 2001
    From: "Yury V. Zaytsev" <yury@shurup.com>
    Date: Thu, 29 Aug 2024 09:35:11 +0200
    Subject: [PATCH] Ticket #4479: prioritize console players for audio/video and
     images
    
    Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
    ---
     misc/ext.d/image.sh | 13 +++++++++----
     misc/ext.d/sound.sh |  2 +-
     misc/ext.d/video.sh | 16 ++++------------
     3 files changed, 14 insertions(+), 17 deletions(-)
    
    diff --git a/misc/ext.d/image.sh b/misc/ext.d/image.sh
    index c191225c8..a99c137b1 100755
    a b  
    66action=$1 
    77filetype=$2 
    88 
    9 [ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" 
     9[ [ -n "$DISPLAY" ] && [ -n "${MC_XDG_OPEN}" ] ] || MC_XDG_OPEN="xdg-open" 
    1010 
    1111do_view_action() { 
    1212    filetype=$1 
    do_open_action() { 
    5050            else 
    5151                (gqview "${MC_EXT_FILENAME}" &) 
    5252            fi 
    53         elif which see >/dev/null 2>&1; then 
    54             (see "${MC_EXT_FILENAME}" &) 
     53        elif which fim >/dev/null 2>&1; then 
     54            (fim "${MC_EXT_FILENAME}") 
     55        elif which fbi >/dev/null 2>&1; then 
     56            (fbi "${MC_EXT_FILENAME}") 
     57        elif which zgv >/dev/null 2>&1; then 
     58            (zgv "${MC_EXT_FILENAME}") 
    5559        else 
    56             (zgv "${MC_EXT_FILENAME}" &) 
     60            echo "Please install either fim or fbi to view this file" 
     61            return 
    5762        fi 
    5863        ;; 
    5964    esac 
  • misc/ext.d/sound.sh

    diff --git a/misc/ext.d/sound.sh b/misc/ext.d/sound.sh
    index 60a3cdd52..125e9b045 100755
    a b  
    66action=$1 
    77filetype=$2 
    88 
    9 [ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" 
     9[ [ -n "$DISPLAY" ] && [ -n "${MC_XDG_OPEN}" ] ] || MC_XDG_OPEN="xdg-open" 
    1010 
    1111do_view_action() { 
    1212    filetype=$1 
  • misc/ext.d/video.sh

    diff --git a/misc/ext.d/video.sh b/misc/ext.d/video.sh
    index 9cba21020..01b0ddda0 100755
    a b  
    66action=$1 
    77filetype=$2 
    88 
    9 [ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" 
     9[ [ -n "$DISPLAY" ] && [ -n "${MC_XDG_OPEN}" ] ] || MC_XDG_OPEN="xdg-open" 
    1010 
    1111do_view_action() { 
    1212    filetype=$1 
    do_open_action() { 
    2929    filetype=$1 
    3030 
    3131    if which mpv >/dev/null 2>&1; then 
    32         PLAYER=mpv 
     32        PLAYER="mpv --really-quiet" 
    3333    elif which mplayer >/dev/null 2>&1; then 
    34         PLAYER=mplayer 
     34        PLAYER="mplayer -really-quiet" 
    3535    else 
    3636        echo "Please install either mplayer or mpv to play this file" 
    3737        return 
    3838    fi 
    3939 
    40     case "${filetype}" in 
    41     *) 
    42         if [ -n "$DISPLAY" ]; then 
    43             ($PLAYER "${MC_EXT_FILENAME}" >/dev/null 2>&1 &) 
    44         else 
    45             $PLAYER -vo null "${MC_EXT_FILENAME}" 
    46         fi 
    47         ;; 
    48     esac 
     40    (clear && $PLAYER "${MC_EXT_FILENAME}" >/dev/null 2>&1 &) 
    4941} 
    5042 
    5143case "${action}" in