Ticket #3940: add Meson syntax highlighting.
[midnight-commander.git] / misc / ext.d / sound.sh
bloba7b6025dcdaaad69fac62554de876299f597c4bc
1 #!/bin/sh
3 # $1 - action
4 # $2 - type of file
6 action=$1
7 filetype=$2
9 [ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open"
11 do_view_action() {
12 filetype=$1
14 case "${filetype}" in
15 mp3)
16 mpg123 -vtn1 "${MC_EXT_FILENAME}" 2>&1 | \
17 sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
19 ogg)
20 ogginfo "${MC_EXT_FILENAME}"
22 wma)
23 mplayer -quiet -slave -frames 0 -vo null -ao null -identify "${MC_EXT_FILENAME}" 2>/dev/null | \
24 tail +13 || file "${MC_EXT_FILENAME}"
27 cat "${MC_EXT_FILENAME}"
29 esac
32 do_open_action() {
33 filetype=$1
35 case "${filetype}" in
36 common)
37 if [ -n "$DISPLAY" ]; then
38 (xmms "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
39 else
40 play "${MC_EXT_FILENAME}"
43 mod)
44 mikmod "${MC_EXT_FILENAME}"
45 #tracker "${MC_EXT_FILENAME}"
47 wav22)
48 vplay -s 22 "${MC_EXT_FILENAME}"
50 mp3)
51 if [ -n "$DISPLAY" ]; then
52 (xmms "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
53 else
54 mpg123 "${MC_EXT_FILENAME}"
57 ogg)
58 if [ -n "$DISPLAY" ]; then
59 (xmms "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
60 else
61 ogg123 "${MC_EXT_FILENAME}"
64 midi)
65 timidity "${MC_EXT_FILENAME}"
67 wma)
68 mplayer -vo null "${MC_EXT_FILENAME}"
70 playlist)
71 if [ -n "$DISPLAY" ]; then
72 (xmms -p "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
73 else
74 mplayer -vo null -playlist "${MC_EXT_FILENAME}"
79 esac
82 case "${action}" in
83 view)
84 do_view_action "${filetype}"
86 open)
87 ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
88 do_open_action "${filetype}"
92 esac