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

#!/bin/bash
usage_create_lvpxml() {
echo -n
}
process_create_lvpxml() {
unset files
unset title
unset titleold
offset=0
for x in `printenv | grep ^file_ | cut -f1 -d=` ; do
[ ! -z "${files}" ] && files="${files}\n"
files="${files}${x}"
done
files=`echo -e ${files} | sort`
rm -f ${lvpxml}
touch ${lvpxml}
echo "Creating lvp.xml file"
echo "<lvp>" >${lvpxml}
item=0
for file in ${files} ; do
eval "file=\${${file}}" # dereference the variable to get the real file
title=${file##*/}
title=${title%% -*}
if [ "${title}" != "${titleold}" ] ; then
titleold=${title}
echo "Found possible new title \"${title}\""
confirm "Do you want to start a new headline?"
if [ ${?} -eq 0 ] ; then
[ ${offset} -gt 0 ] && offset=$(( ${offset} + 2 ))
[ $(( ${item} % 4 )) -gt 0 ] && item=$(( ${item} + ( 4 - ( ${item} % 4 ) ) ))
read -p "Please enter new title [${title}]: " tmp
[ ! -z "${tmp}" ] && title="${tmp}"
cat >> ${lvpxml} <<-EOF
<item type="text">
<position x="0" y="$(( 95 - ((${item} - (${item} % 4)) / 4) * 15 - ${offset} ))">
<size w="5" h="5">
<text>${title}</text>
</item>
EOF
offset=$(( ${offset} + 10 ))
fi
fi
button_text=${file%.*}
button_text=${button_text##*- }
read -p "Enter button text for ${file} [${button_text}]: " tmp
[ ! -z "${tmp}" ] && button_text=${tmp}
cat >> ${lvpxml} << EOF
<item type="button">
<position x="$(( (${item} % 4) * 50 - 75 ))" y="$(( 95 - ((${item} - (${item} % 4)) / 4) * 15 - ${offset} ))" />
<action>/usr/bin/mplayer -fs -zoom ${mplayer_param} '${file}'</action>
<size w="40" h="10" />
<text>${button_text}</text>
</item>
EOF
# a little "special" for multi-language anime
#if [ "${file##*.}" == "avi" ] ; then
#cat >> ${lvpxml} << EOF
#<item type="button">
#<position x="$(( (${item} % 4) * 50 - 75 ))" y="$(( 95 - ((${item} - (${item} % 4)) / 4) * 15 - 7 - ${offset} ))" />
#<action>/usr/bin/mplayer -aid 2 -sid 3 -fs -zoom '${file}'</action>
#<size w="40" h="4" />
#<text>jap</text>
#</item>
#EOF
#fi
item=$(( ${item} + 1 ))
done
echo "</lvp>" >> ${lvpxml}
echo "done creating lvp.xml file"
echo "Please check that the file is correct!"
if [ ! -z ${DISPLAY} ] ; then
echo "Trying to show menu now on ${DISPLAY}"
lvp=`which lvp`
[ -z "${lvp}" ] && lvp="livesystem/usr/bin/lvp"
if ! test -x ${lvp} ; then
echo "Can't execute ${lvp}... this doesn't look good..."
else
${lvp} ${lvpxml}
fi
fi
}