I first looked into the possibilities of writing a VLC LUA extentionen, and this seams very possible.
I looked at this extension : http://addons.videolan.org/CONTENT/content-files/140699-addsimilar.lua
Which has all the functionality we need. So modifying it heavily would properly work, but it seamed as too much work for this project.
So I googled some more and stumbled upon this site:
It turns out that this bash script can easily be modified to use VLC or cvlc.
So I did and the result looks like this:
# get rid of the cursor so we don't see it when videos are running
setterm -cursor off
# set here the path to the directory containing your videos
# you can normally leave this alone
# now for our infinite loop!
while true; do
if ps ax | grep -v grep | grep $SERVICE > /dev/null
for entry in $VIDEOPATH/* # You could add .mkv to the end of this or any other file extention, to only play specific extentions
cvlc --play-and-exit --no-video-title -f "$entry" > /dev/null
The reason I need this functionality is for a kiosk video screen like project, where videos are uploaded and deleted at all times.
One con about this solution is that VLC still need to open and close after playing each video, which it does using this script. So the PC running the script, need to have a blank desktop (GUI removed) and a black background. This way you will only see about 0.5 - 1 sec black screen in between each video clip.
The script is still work in progress, since I will be adding some more features to it, so if you find it useful and want my final script, leave a comment and I will update the answer.
If you have a better solution or even a LUA solution, please post it - and I will accept the answer - but for now this works for my project.