logo
How to quickly create media ads display system?

001. Introduction

My friend ask me to help him to create a small video display system to show ads, based on RaspberryPi. This must be simple and easy for user – to change displayed content (update / refresh) of video files. After a few hours throwing insults i made a solution…


002. Let’s start

He done some work themself. He used an OpenELEC (http://openelec.tv) distro in version 4.2.1 and he want to stay on it.
I did some tests and found a solution – but this work strange anyway. After a reboot everything is started and video are played, but not in full screen – they are shown in “second” plan – in background, preceded by XMBC program gui. I searched for entire menu switching different options but without success. My friend was unable to say if something is not switched by him…
Using a hammer I convinced him to upgrade to a higher version and start work with clean system…


003. Install OpenELEC 5.0.0 on RaspberyPi

I downloaded last stable version of OpenELEC (5.0.0) from OpenELEC downloads page: http://openelec.tv/get-openelec

Using a image writing tool i prepared a SD card (you must extract “OpenELEC-RPi.arm-5.0.0.img” outside gz archive and write this one) (http://www.raspberrypi.org/documentation/installation/installing-images/)

After short installing process on RaspberryPi machine and ensuring, that it works (BTW: XMBC from version 4.2.1 are replaced by KODI in 5.0.0), i switched a few options (of course i switched SSH apo ccess to “ON” state,  connected my ethernet cable to device and turned on DHCP to obtain an IP address automatically without clicking and waste my time to define it manually 😉 ) i get back SD card to my PC and placed few videos on SD card.


004. Preparation

Path in the device is an “/storage/videos/”, in SD card is same (if i recall correctly). Put there a few videos what will be played.

Next, connect using SSH to a device. Default user / password is: root / openelec

Create a file in this path:

/storage/.kodi/userdata/autoexec.py

with this content:

xmbc.executebuiltin( "Playlist.Clear" )
xmbc.executebuiltin( "PlayMedia(/storage/videos/,isdir)" )
xmbc.executebuiltin( "PlayerControl(repeat)" )

… and reboot device.

After a while videos placed in previously mentined path will be played automatically in loop 😀


005. Conclusion

RaspberryPi + OpenELEC is a good solution to a media display system. There are linux on board so you can create a multiple media-ads display system and mount samba shares to change displayed content.

As i successfully tested, if you change content of videos folder, to start play new content just run those command in the shell:

kodi-send -a "Playlist.Clear"
kodi-send -a "PlayMedia(/storage/videos/,isdir)"
kodi-send -a "PlayerControl(Repeat)"

And player will start again, with newly automatically created playlist (files are get by filename order so good is to create a 001.avi, 002.avi, 003.mov etc.).

There only a step to create automated cron/scripts what can detect newly uploaded videos and change playlist or add them into it.
With a while of work You can send one content to hundreds devices…

Good luck!

.