Middle initial removed from CSV; AM/PM in HTML; comments
[tpope-extra.git] / fvwm / fvwm-menu-music
1 #!/bin/sh
2 # Author: Tim Pope
3 # Belongs in "$HOME/.fvwm/fvwm-menu-music"
4
5 cd "$HOME/media/music"
6
7 cd "$1"
8 menu="`echo $1|sed -e 's/"/\\\\"/g'`"
9
10 echo "DestroyMenu recreate \"$menu\""
11 echo "AddToMenu \"$menu\""
12 echo "+ DynamicPopDownAction DestroyMenu \"$menu\""
13 echo "+ MissingSubMenuFunction FuncMenuMusic"
14
15 icontitle=48x48-gnome/folder-open.xpm
16 [ -f ".icontitle.png" ] && icontitle="$1/.icontitle.png"
17 [ -f "../.`basename $1`.png" ] && icontitle="`dirname $1`/.`basename $1`.png"
18 [ -f "../.`basename $1`.xpm" ] && icontitle="`dirname $1`/.`basename $1`.xpm"
19 [ -f ".title.png" ] && icontitle="$1/.title.png"
20 [ -f ".title.xpm" ] && icontitle="$1/.title.xpm"
21 echo "+ \"*$icontitle*\" FuncMusicPlay \"$menu\""
22 echo "+ \"\" Nop"
23
24 /bin/ls -1|while read fn; do
25     fs="`echo $fn|sed -e 's/"/\\\\"/g'`"
26     #fd="`echo $1/$fn|sed -e 's/"/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"/g'`"
27     fe="`echo $1/$fn|sed -e 's/"/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"/g'`"
28     if [ -d "$fn" ]; then
29         icontitle=menu/folder.xpm
30         #[ -f "$fn/.icontitle.png" ] && icontitle="$1/$fn/.icontitle.png"
31         [ -f "$fn/.title.png" ] && icontitle="$menu/$fs/.title.png"
32         [ -f "$fn/.title.xpm" ] && icontitle="$menu/$fs/.title.xpm"
33         [ -f "$1/.$fn.png" ] && icontitle="$menu/.$fe.png"
34         [ -f "$1/.$fn.xpm" ] && icontitle="$menu/.$fs.xpm"
35         echo "+ \"%$icontitle%`echo $fs|sed -e 's/_/ /g'`\" Popup \"$menu/$fs\""
36     else
37         case "$fn" in
38         *.jpg|*.png|*.xpm|*.txt) ;;
39         *.ogg|*.mp3|*.wav)
40             icontitle=menu/file.xpm
41             [ -f ".$fn.png" ] && icontitle= "$menu/.$fs.png"
42             [ -f ".$fn.xpm" ] && icontitle= "$menu/.$fs.xpm"
43             echo "+ \"%$icontitle%`echo $fs|sed -e 's/_/ /g' -e 's/\....$//'`\" FuncMusicPlay \"$fe\""
44         ;;
45     esac
46     fi
47 done