mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.9 KiB

  1. #!/bin/bash
  2. usage_create_lvpxml() {
  3. echo -n
  4. }
  5. process_create_lvpxml() {
  6. unset files
  7. unset title
  8. for x in `printenv | grep ^file_ | cut -f1 -d=` ; do
  9. [ ! -z "${files}" ] && files="${files}\n"
  10. files="${files}${x}"
  11. [ -z "${title}" ] && eval "title=\${${x}}"
  12. done
  13. title=${title##*/}
  14. title=${title%% -*}
  15. files=`echo -e ${files} | sort`
  16. rm -f ${lvpxml}
  17. touch ${lvpxml}
  18. echo "Creating lvp.xml file"
  19. read -p "Enter title of this LVP [${title}]: " tmp
  20. [ ! -z "${tmp}" ] && title="${tmp}"
  21. cat > ${lvpxml} << EOF
  22. <lvp>
  23. <item type="text">
  24. <position x="0" y="90">
  25. <size w="5" h="5">
  26. <text>${title}</text>
  27. </item>
  28. EOF
  29. item=0
  30. for file in ${files} ; do
  31. eval "file=\${${file}}" # dereference the variable to get the real file
  32. button_text=${file%.*}
  33. button_text=${button_text##*- }
  34. read -p "Enter button text for ${file} [${button_text}]: " tmp
  35. [ ! -z "${tmp}" ] && button_text=${tmp}
  36. cat >> ${lvpxml} << EOF
  37. <item type="button">
  38. <position x="$(( (${item} % 4) * 50 - 75 ))" y="$(( 80 - ((${item} - (${item} % 4)) / 4) * 15))" />
  39. <action>/usr/bin/mplayer -fs -zoom ${mplayer_param} '${file}'</action>
  40. <size w="40" h="10" />
  41. <text>${button_text}</text>
  42. </item>
  43. EOF
  44. # a little "special" for multi-language anime
  45. #if [ "${file##*.}" == "ogm" ] ; then
  46. #cat >> ${lvpxml} << EOF
  47. #<item type="button">
  48. #<position x="$(( (${item} % 4) * 50 - 75 ))" y="$(( 80 - ((${item} - (${item} % 4)) / 4) * 15 - 7))" />
  49. #<action>/usr/bin/mplayer -aid 2 -sid 3 -fs -zoom '${file}'</action>
  50. #<size w="40" h="4" />
  51. #<text>jap</text>
  52. #</item>
  53. #EOF
  54. #fi
  55. item=$(( ${item} + 1 ))
  56. done
  57. echo "</lvp>" >> ${lvpxml}
  58. echo "done creating lvp.xml file"
  59. echo "Please check that the file is correct!"
  60. if [ ! -z ${DISPLAY} ] ; then
  61. echo "Trying to show menu now on ${DISPLAY}"
  62. lvp=`which lvp`
  63. [ -z "${lvp}" ] && lvp="livesystem/usr/bin/lvp"
  64. if ! test -x ${lvp} ; then
  65. echo "Can't execute ${lvp}... this doesn't look good..."
  66. else
  67. ${lvp} ${lvpxml}
  68. fi
  69. fi
  70. }