I'm writing a couple of scripts to start vlc
and periodically update its playlist.
The update_pls.sh
works well if I execute it from prompt, but when I call it from start_vlc.sh
, in each for
cycle I get this:
./update_pls.sh: 20: ./update_pls.sh: 10#18: not found
./update_pls.sh: 20: ./update_pls.sh: 10#18==DIA: not found
start_vlc.sh:
#!/bin/bash
echo `date`
echo "A arrancar o VLC..."
cvlc --loop --fullscreen --extraintfttp --http-password kepler
sh update_pls.sh
update_pls.sh:
#!/bin/bash
/usr/bin/env > /Videos/cron_env.log
DIR=/Videos
FILES=$DIR/*
DIA=`(date +%d)`
HORA=`(date +%H)`
echo `date`
echo "Dir: $DIR"
echo "A fazer update da playlist.m3u..."
> $DIR/playlist.m3u
for f in $FILES
do
a=`(basename $f .mov | cut -b 1-2 | sed 's/[^0-9]//g')`
b=`(basename $f .mov | cut -b 3-4 | sed 's/[^0-9]//g')`
if [ -n "$a" ]; then
:
else
a="99"
fi
if (( 10#$a<DIA)) || ((10#$a==DIA && 10#$b<=HORA )); then
echo -e "$f\n" >> $DIR/playlist.m3u
echo "Adicionado o video $f"
fi
done
echo "A fazer upload da playlist para o VLC..."
curl -u '':kepler "http://localhost:8080/requests/status.xml?command=pl_empty"
curl -u '':kepler "http://localhost:8080/requests/status.xml?command=in_enqueue&input$
curl -u '':kepler "http://localhost:8080/requests/status.xml?command=pl_play"
I can't manage to find the cause of this and would apreciate any help. Vasco
.~/directory/scriptName.sh
– ryekayo Aug 21 '14 at 18:05$PATH
. – PersianGulf Aug 21 '14 at 18:11sudo chmod +x *.sh
– Vasco Sotomaior Aug 21 '14 at 18:11vlc
comes with a fully-scriptable cli. Dovlc -I lua
then typehelp
and play around. – mikeserv Aug 21 '14 at 22:06