#!/bin/bash

if [ $# -eq 0 ]; then
  xmessage -buttons OK -default OK -timeout 3\
   "Drag and drop '*.flv' files on the icon you clicked to extract mp3"
fi
while [ -n "$1" ]; do
  target_file="$(echo $1 | sed -ne 's#.flv$#.mp3#p')"
  if [ -n "$target_file" ] && [ -f "$1" ]; then
    mplayer -dumpaudio "$1" -dumpfile "$target_file"
  fi
  shift
done
