#!/bin/bash usage_create_lvpxml() { echo -n } process_create_lvpxml() { unset files unset title for x in `printenv | grep ^file_ | cut -f1 -d=` ; do [ ! -z "${files}" ] && files="${files}\n" files="${files}${x}" [ -z "${title}" ] && eval "title=\${${x}}" done title=${title##*/} title=${title%% -*} files=`echo -e ${files} | sort` rm -f ${lvpxml} touch ${lvpxml} echo "Creating lvp.xml file" read -p "Enter title of this LVP [${title}]: " tmp [ ! -z "${tmp}" ] && title="${tmp}" cat > ${lvpxml} << EOF ${title} EOF item=0 for file in ${files} ; do eval "file=\${${file}}" # dereference the variable to get the real file 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 /usr/bin/mplayer -fs -zoom ${mplayer_param} '${file}' ${button_text} EOF # a little "special" for multi-language anime #if [ "${file##*.}" == "ogm" ] ; then #cat >> ${lvpxml} << EOF # # #/usr/bin/mplayer -aid 2 -sid 3 -fs -zoom '${file}' # #jap # #EOF #fi item=$(( ${item} + 1 )) done echo "" >> ${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 }