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.

91 lines
2.4 KiB

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