docker-tmserver/tmserver/bin/eval_playlist.sh

25 lines
864 B
Bash
Raw Permalink Normal View History

2022-06-26 17:41:12 +02:00
#!/command/with-contenv bash
echo "INFO | Parsing custom playlist..."
[[ -z "${CUSTOM_PLAYLIST}" ]] && \
echo "INFO | Custom Playlist is not enabled, keeping default or user-edited playlist" && \
exit 0
PLAYLIST_PATH=${PLAYLIST_PATH:-playlist.txt}
2022-06-26 17:41:12 +02:00
PLAYLIST_FILE='GameData/Tracks/MatchSettings/playlist.xml'
if [[ -f "${PLAYLIST_PATH}" ]]; then
2022-06-26 17:41:12 +02:00
count=1
while read l; do
xmlstarlet ed -L -s /playlist -t elem -n challenge $PLAYLIST_FILE
xmlstarlet ed -L -s "/playlist/challenge[${count}]" -t elem -n file -v "${l}" $PLAYLIST_FILE
count=$((count+1))
done < $PLAYLIST_PATH
2022-06-26 17:41:12 +02:00
else
xmlstarlet ed -L -s /playlist -t elem -n challenge $PLAYLIST_FILE
xmlstarlet ed -L -s "playlist/challenge[1]" -t elem -n file -v "Challenges/Nadeo/A01-Race.Challenge.Gbx" $PLAYLIST_FILE
fi
echo "INFO | Finished parsing playlist files"