MLT library
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.0KB

  1. #!/bin/bash
  2. function show_consumers( )
  3. {
  4. awk -F '\t' '{ printf( "%d. %s\n", ++ i, $1 ); }' < consumers.ini
  5. }
  6. function get_consumer( )
  7. {
  8. option=$1
  9. [ "$option" != "" ] && [ $option -gt 0 ] && sed 's/\t\+/\t/g' < consumers.ini | cut -f 2 | head -n $option | tail -n -1
  10. }
  11. function show_menu( )
  12. {
  13. sed 's/\t\+/\t/g' < demo.ini |
  14. awk -F '\t' '{ printf( "%2d. %-30.30s", ++ i, $2 ); if ( i % 2 == 0 ) printf( "\n" ); } END { if ( i % 2 == 1 ) printf( "\n" ); }'
  15. }
  16. function check_dependencies( )
  17. {
  18. option=$1
  19. if [ $option -gt 0 ]
  20. then
  21. deps=`sed 's/\t\+/\t/g' < demo.ini | cut -f 3 | head -n $option | tail -n -1`
  22. if [ "$deps" != "" ]
  23. then
  24. echo "$deps" |
  25. tr ',' '\n' |
  26. while read dep
  27. do
  28. ls $dep > /dev/null 2>&1
  29. val=$?
  30. [ $val != 0 ] && echo Failed to find $dep >&2 && echo $val
  31. done
  32. fi
  33. echo 0
  34. fi
  35. }
  36. function get_demo( )
  37. {
  38. option=$1
  39. if [ $option -gt 0 ]
  40. then
  41. cut -f 1 demo.ini | head -n $option | tail -n -1
  42. fi
  43. }
  44. while [ 1 ]
  45. do
  46. echo Select Consumer
  47. echo
  48. show_consumers
  49. echo
  50. echo 0. Exit
  51. echo
  52. echo -n "Option: "
  53. read option
  54. echo
  55. [ "$option" == "0" ] && break
  56. export MLT_CONSUMER=`get_consumer $option`
  57. while [ "$option" != "0" -a "$MLT_CONSUMER" != "" ]
  58. do
  59. echo Choose Demo
  60. echo
  61. show_menu
  62. echo
  63. echo -n "Option: "
  64. read option
  65. echo
  66. [ "$option" == "" ] && break
  67. demo=`get_demo $option`
  68. usable=`check_dependencies $option`
  69. if [ "$usable" = "0" -a "$demo" != "" ]
  70. then
  71. if [ "$MLT_CONSUMER" == "westley:" ]
  72. then export WESTLEY_CONSUMER="westley:$demo.westley"
  73. bash $demo -consumer $WESTLEY_CONSUMER
  74. inigo +$demo.txt out=100 $demo.westley $demo.westley -filter watermark:watermark1.png composite.fill=1 composite.geometry=85%,5%:10%x10%
  75. elif [ "$MLT_CONSUMER" == "westley" ]
  76. then bash $demo -consumer $MLT_CONSUMER | less
  77. else bash $demo -consumer $MLT_CONSUMER
  78. fi
  79. elif [ "$usable" != "" ]
  80. then
  81. echo
  82. echo Unable to locate suitable files for the demo - please provide them.
  83. read pause
  84. fi
  85. stty sane
  86. done
  87. done