video.sh 909 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. # $1 - action
  3. # $2 - type of file
  4. action=$1
  5. filetype=$2
  6. do_view_action() {
  7. filetype=$1
  8. case "${filetype}" in
  9. *)
  10. mplayer -identify -vo null -ao null -frames 0 "${MC_EXT_FILENAME}" 2>&1 | \
  11. sed -n 's/^ID_//p'
  12. ;;
  13. esac
  14. }
  15. do_open_action() {
  16. filetype=$1
  17. case "${filetype}" in
  18. ram)
  19. (realplay "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
  20. ;;
  21. *)
  22. if [ -n "$DISPLAY" ]; then
  23. (mplayer "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
  24. else
  25. mplayer -vo null "${MC_EXT_FILENAME}"
  26. fi
  27. #(gtv "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
  28. #(xanim "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
  29. ;;
  30. esac
  31. }
  32. case "${action}" in
  33. view)
  34. do_view_action "${filetype}"
  35. ;;
  36. open)
  37. xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \
  38. do_open_action "${filetype}"
  39. ;;
  40. *)
  41. ;;
  42. esac