From f70a456a183390f2f257322feb7c5187808620c0 Mon Sep 17 00:00:00 2001 From: Hendrik Boll Date: Sat, 28 Sep 2019 13:25:49 +0200 Subject: [PATCH] added custom playlist support --- entrypoint-tmserver.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/entrypoint-tmserver.sh b/entrypoint-tmserver.sh index 22a8237..eaacf16 100755 --- a/entrypoint-tmserver.sh +++ b/entrypoint-tmserver.sh @@ -105,6 +105,24 @@ fi echo "Evaluation over" +echo "Checking for custom playlist" + + CUSTOM_PLAYLIST='playlist/playlist.txt' + TEMPLATE_PLAYLIST='GameData/Tracks/MatchSettings/_playlist.txt' + TMP_FILE='GameData/Tracks/MatchSettings/_playlist.txt.tmp' +if [[ -f 'playlist/playlist.txt' ]]; then + count=1 + while read l; do + xmlstarlet ed -s /playlist -t elem -n challenge $TEMPLATE_PLAYLIST > $TMP_FILE + xmlstarlet ed -s "/playlist/challenge[${count}]" -t elem -n file -v "${l}" $TMP_FILE > $TEMPLATE_PLAYLIST + count=$((count+1)) + done < $CUSTOM_PLAYLIST +else + xmlstarlet ed -s /playlist -t elem -n challenge $TEMPLATE_PLAYLIST > $TMP_FILE + xmlstarlet ed -s "playlist/challenge[1]" -t elem -n file -v "Challenges/Nadeo/A01-Race.Challenge.Gbx" $TMP_FILE > $TEMPLATE_PLAYLIST +fi + +echo "Evaluating custom playlist over" echo "Substition in config files" #Trackmania Files