57 lines
1.5 KiB
Diff
57 lines
1.5 KiB
Diff
|
--- misc/ext.d/sound.sh.orig 2012-12-27 12:13:20.000000000 +0400
|
||
|
+++ misc/ext.d/sound.sh 2013-03-10 11:54:01.186301679 +0400
|
||
|
@@ -6,27 +6,46 @@
|
||
|
action=$1
|
||
|
filetype=$2
|
||
|
|
||
|
-[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open"
|
||
|
+[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="_xdg_open"
|
||
|
+
|
||
|
+_xdg_open()
|
||
|
+{
|
||
|
+ if [ -n "$DISPLAY" ] && type -p gmplayer ; then
|
||
|
+ gmplayer "${MC_EXT_FILENAME}"
|
||
|
+ elif type -p mplayer ; then
|
||
|
+ mplayer "${MC_EXT_FILENAME}"
|
||
|
+ else
|
||
|
+ xdg-open "${MC_EXT_FILENAME}"
|
||
|
+ fi
|
||
|
+}
|
||
|
|
||
|
do_view_action() {
|
||
|
filetype=$1
|
||
|
|
||
|
+ if type -p mediainfo >/dev/null 2>&1 ; then
|
||
|
+ mediainfo "${MC_EXT_FILENAME}"
|
||
|
+ return $?
|
||
|
+ fi
|
||
|
+
|
||
|
case "${filetype}" in
|
||
|
mp3)
|
||
|
- mpg123 -vtn1 "${MC_EXT_FILENAME}" 2>&1 | \
|
||
|
- sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
|
||
|
+ if type -p mpg123 ; then
|
||
|
+ mpg123 -vtn1 "${MC_EXT_FILENAME}" 2>&1 | \
|
||
|
+ sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
|
||
|
+ return 0
|
||
|
+ fi
|
||
|
;;
|
||
|
ogg)
|
||
|
- ogginfo "${MC_EXT_FILENAME}"
|
||
|
+ type -p ogginfo && ogginfo "${MC_EXT_FILENAME}" && return 0
|
||
|
;;
|
||
|
wma)
|
||
|
mplayer -quiet -slave -frames 0 -vo null -ao null -identify "${MC_EXT_FILENAME}" 2>/dev/null | \
|
||
|
tail +13 || file "${MC_EXT_FILENAME}"
|
||
|
- ;;
|
||
|
- *)
|
||
|
- cat "${MC_EXT_FILENAME}"
|
||
|
+ return $?
|
||
|
;;
|
||
|
esac
|
||
|
+
|
||
|
+ mplayer -identify -vo null -ao null -frames 0 "${MC_EXT_FILENAME}" 2>&1 | sed -n '/^ID_/p'
|
||
|
}
|
||
|
|
||
|
do_open_action() {
|