Added 'View' action to all video formats.
[midnight-commander.git] / misc / ext.d / sound.sh
blob33f00e032e5f7826732bda6f3ea40f6b80380a7b
1 #!/bin/sh
3 # $1 - action
4 # $2 - type of file
6 action=$1
7 filetype=$2
9 do_view_action() {
10 filetype=$1
12 case "${filetype}" in
13 mp3)
14 mpg123 -vtn1 "${MC_EXT_FILENAME}" 2>&1 | \
15 sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
17 ogg)
18 ogginfo "${MC_EXT_SELECTED}"
20 wma)
21 mplayer -quiet -slave -frames 0 -vo null -ao null -identify "${MC_EXT_FILENAME}" 2>/dev/null | \
22 tail +13 || file "${MC_EXT_FILENAME}"
25 cat "${MC_EXT_FILENAME}"
27 esac
30 do_open_action() {
31 filetype=$1
33 case "${filetype}" in
34 common)
35 if [ "$DISPLAY" = "" ]; then
36 play "${MC_EXT_FILENAME}"
37 else
38 (xmms "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
41 mod)
42 mikmod "${MC_EXT_FILENAME}"
43 #tracker "${MC_EXT_FILENAME}"
45 wav22)
46 vplay -s 22 "${MC_EXT_FILENAME}"
48 mp3)
49 if [ "$DISPLAY" = "" ]; then
50 mpg123 "${MC_EXT_FILENAME}"
51 else
52 (xmms "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
55 ogg)
56 if [ "$DISPLAY" = "" ]; then
57 ogg123 "${MC_EXT_FILENAME}"
58 else
59 (xmms "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
62 midi)
63 timidity "${MC_EXT_FILENAME}"
65 wma)
66 mplayer -vo null "${MC_EXT_FILENAME}"
68 playlist)
69 if [ -z "$DISPLAY" ]; then
70 mplayer -vo null -playlist "${MC_EXT_FILENAME}"
71 else
72 (xmms -p "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
77 esac
80 case "${action}" in
81 view)
82 do_view_action "${filetype}"
84 open)
85 xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \
86 do_open_action "${filetype}"
90 esac