Sean Meighan
Software => Enhancement Requests => Topic started by: bshep on November 28, 2017, 02:35:34 PM
-
Would it be possible to add a command line option to set the effective date ( alternatively to set a variable used when rendering)
This would be useful when making countdown sequences without the need for xSchedule. Right now generating the countdown is a manual process of changing the text on the UI and rendering, saving the file somewhere else and repeating.
Thanks!
Bruce
-
You could just set your pc time.
-
That works! Thanks for the suggestion
-
I decided to use a different technique so I'll share my code here
This replaces the text %DAY_COUNT% with the countdown, whoever uses it needs to edit the variables at the begining.
#!/bin/sh
SUB_TEXT="%DAY_COUNT%"
ORIG_FILE="days_countdown.xml"
DST_DIR="countdown_fseqs_new"
XLIGHTS_BIN="/Applications/xLights.app/Contents/MacOS/xLights"
XLIGHTS_DIR="/Users/USER_DIR/Dropbox/Xlights"
XLIGHTS_OPTS="-m $XLIGHTS_DIR -s $XLIGHTS_DIR -r"
if [ ! -d "$DST_DIR" ]; then
echo Destination dir $DST_DIR does not exists
exit
fi
echo "=========================================" >> $DST_DIR/xlights.log
echo "*** Starting render $(date) ***" >> $DST_DIR/xlights.log
echo "=========================================" >> $DST_DIR/xlights.log
for i in $(seq $1); do
i_PADDED=$(printf %02d $i)
if [[ $i == 1 ]]; then
TEXT="1 day"
else
TEXT="$i days"
fi
echo "Substituting for $TEXT" >> $DST_DIR/xlights.log
echo "=========================================" >> $DST_DIR/xlights.log
sed "s/$SUB_TEXT/$TEXT/" < $ORIG_FILE > tmp.xml
$XLIGHTS_BIN $XLIGHTS_OPTS tmp.xml >> $DST_DIR/xlights.log
if [[ $? != 0 ]]; then
echo Error rendering
exit
fi
mv tmp.fseq $DST_DIR/days$i_PADDED.fseq
echo "=========================================" >> $DST_DIR/xlights.log
done
rm tmp.xml