Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
midnight commander - file associations [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
alex.blackbit
Advocate
Advocate


Joined: 26 Jul 2005
Posts: 2395

PostPosted: Fri Nov 16, 2012 6:37 pm    Post subject: midnight commander - file associations [SOLVED] Reply with quote

Hi,

my mc opens video files with vlc now, I don't know why.
I looked inside the /etc/mc/mc.ext file and found this:
Code:
---8<---
### Video ###

shell/i/.avi
        Include=video

regex/i/\.as[fx]$
        Include=video

shell/i/.divx
        Include=video

shell/i/.mkv
        Include=video

regex/i/\.(mov|qt)$
        Include=video

regex/i/\.(mp4|m4v|mpe?g)$
        Include=video

# MPEG-2 TS container + H.264 codec
shell/i/.mts
        Include=video

shell/i/.ts
        Include=video

shell/i/.vob
        Include=video

shell/i/.wmv
        Include=video

regex/i/\.fl[icv]$
        Include=video

shell/i/.ogv
        Include=video

regex/i/\.ra?m$
        Open=/usr/libexec/mc/ext.d/video.sh open ram

# WebM
shell/i/.webm
    Include=video

type/WebM
    Include=video

include/video
        Open=/usr/libexec/mc/ext.d/video.sh open ALL_FORMATS
        View=%view{ascii} /usr/libexec/mc/ext.d/video.sh view ALL_FORMATS
---8<---

I do not have an ~/.config/mc/mc.ext file.
The content of /usr/libexec/mc/ext.d/video.sh is:
Code:
#!/bin/sh

# $1 - action
# $2 - type of file

action=$1
filetype=$2


do_view_action() {
    filetype=$1

    case "${filetype}" in
    *)
        cat "${MC_EXT_FILENAME}"
        ;;
    esac
}

do_open_action() {
    filetype=$1

    case "${filetype}" in
    ram)
        (realplay "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
        ;;
    *)
        if [ -n "$DISPLAY" ]; then
            (mplayer "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
        else
            mplayer -vo null "${MC_EXT_FILENAME}"
        fi
        #(gtv "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
        #(xanim "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
        ;;
    esac
}

case "${action}" in
view)
    do_view_action "${filetype}"
    ;;
open)
    xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \
        do_open_action "${filetype}"
    ;;
*)
    ;;
esac

My assumption would be that video files should be opened with mplayer. I do not see vlc anywhere.
Code:
$ (find $HOME/.config/mc -type f; qlist -e mc) | xargs sudo grep vlc
/usr/share/mc/syntax/sh.syntax:    keyword whole svlc cyan
/usr/share/mc/syntax/sh.syntax:    keyword whole vlc cyan
/usr/share/mc/syntax/sh.syntax:    keyword whole wxvlc cyan
/usr/share/mc/syntax/sh.syntax:    keyword whole svlc cyan
/usr/share/mc/syntax/sh.syntax:    keyword whole vlc cyan
/usr/share/mc/syntax/sh.syntax:    keyword whole wxvlc cyan


I am open to all ideas.
Thanks in advance.


Last edited by alex.blackbit on Sat Nov 17, 2012 8:35 am; edited 1 time in total
Back to top
View user's profile Send private message
paulbiz
Guru
Guru


Joined: 01 Feb 2004
Posts: 506
Location: St. Louis, Missouri, USA

PostPosted: Fri Nov 16, 2012 8:34 pm    Post subject: Reply with quote

I believe it is using xdg-open which will play the video using the default player according to the MIME type associations on your system.
Back to top
View user's profile Send private message
alex.blackbit
Advocate
Advocate


Joined: 26 Jul 2005
Posts: 2395

PostPosted: Sat Nov 17, 2012 8:34 am    Post subject: Reply with quote

Right, I overlooked that.
Thank you, paulbiz.
It seems like the directory of interest is $HOME/.local/share/applications, especially the file mimeapps.list.
I modified the file I had to end up with this content:
Code:
[Added Associations]

[Default Applications]
application/x-cd-image=brasero-open-image.desktop;nautilus-cd-burner-open-iso.desktop;file-roller.desktop;userapp-totem-EZHRWU.desktop;userapp-mplayer-FJ43VU.desktop;
application/x-linguist=userapp-mplayer-ER1P0U.desktop;
application/octet-stream=gedit.desktop;
inode/directory=nautilus-folder-handler.desktop;brasero-copy-medium.desktop;
application/rdf+xml=gedit.desktop;
audio/x-vorbis+ogg=userapp-mplayer-RRK3UU.desktop
video/mp4=userapp-mplayer-RRK3UU.desktop
video/quicktime=userapp-mplayer-RRK3UU.desktop
video/x-ogm+ogg=userapp-mplayer-RRK3UU.desktop
video/x-msvideo=userapp-mplayer-RRK3UU.desktop
video/x-flv=userapp-mplayer-RRK3UU.desktop
video/x-ms-wmv=userapp-mplayer-RRK3UU.desktop;
video/x-matroska=userapp-mplayer-RRK3UU.desktop;
video/mpeg=userapp-mplayer-RRK3UU.desktop;
video/x-ms-asf=userapp-mplayer-RRK3UU.desktop;
video/mp4=userapp-mplayer-RRK3UU.desktop;

I achieved what I wanted, video files are opened with mplayer.
Thanks again paulbiz.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum