Kodi for the rich


The Project

I work in IT, the company owner approached me last month with a problem. He owns a lot of properties and wants his movies available at all properties at all times, most properties are remote and have very slow internet connections due to geography. (Think Mountains, Islands, etc)

Requirements I was given

  • Cost was no object (within reason)
  • Downloading movies at each location is fine but would have to happen off hours as not to impact internet use during the day.
  • All movies/TV had to be purchased (his rules)
  • No DRM
  • RF remote would be best as many of the AV racks are in an adjacent room
  • The interface had to provide cover art, have an ipad app and look slick.
  • One of the 5 locations includes a Gulfstream Jet where downloading one movie would cost over $10,000 in internet fees. So i would need to mount an AP in the hanger connected to my own internet and make sure it ONLY used that internet to sync while still connecting to the jets internet for ipad controls. I also had to talk to the ground team to setup a power on scheduled for the unit so it had time to sync.

My plan:

  • Get an unlimited cloud provided storage account with SFTP
  • Buy 400 Bluray movies and rip them
  • Start with 5 Slice boxes with 4TB HDD’s (later found out that they had to be mounted outside, so they are just set on top for now)
  • Write a python script that when the box was booted looks for the proper wireless, exits if it cant find it, syncs the movies from an online cloud provider if it can.

Steps taken so far.

So two weeks ago i started doing exactly that.

Ripping and uploading the movies started many weeks ago and to be honest will take me many more weeks, its boring and slow, I use AnyDVD to decrypt the Bluray and Handbrake to encode it. This system works great, i have it all scripted so the drive ejects and i put in the next disk, it encodes, and ejects, etc, etc. The owner now has an account he can order movies on, the movies automatically ship to me, i will encode them, then i upload them to the storage account so he can watch them anywhere.

The Slice units arrived, i quickly found out that the 4TB drives i have wont fit but thats not an issue because I have put them in external cases and Velcro them to the top of the slices.

The script

I started by SSHing into the Slice and editing the autostart.sh file to look like this

echo pcf8523 0x68 > /sys/class/i2c-dev/i2c-0/device/new_device
hwclock -s
sleep 60
python /var/media/Master\ Drive/scripts/Download.py
) &

This will run the Download.py script that is on my hard drive. It waits 60 seconds to make sure that the drive is mounted and that Kodi has had a chance to start (the script uses some Kodi Json to invoke the file index after the files have copied)

The Download.py file is a work in progress but here is what i have so far.

Main Logic

Connects to the Wifi, if it cant find the AP it closes.
if we are not connected to the AP but its in range we try to connect, if unsuccessful we close.
Once every 10 times run it will spider though all of the local files deleting the ones that don’t line up with the SFTP.
if Still connected it connects to the SFTP and spiders though all files
If a file is found that is missing it downloads it. (only if still connected to the right AP)
If a file is found that is the wrong size it deletes and redownloads it. (only if still connected to the right AP)
It then forces Kodi to index those files. (only if still connected to the right AP)
Saves a log to to the SFTP Site in the log folder

There is a limit for the MB downloaded for each run.
There is a limit for the number of files downloaded for each run
There is a limit for the number of seconds the script can run

Future things to add

Hub and spoke updates
If a file has to be downloaded check local kodi boxes for the file first.
if they have them copy on the local lan, if they are already
downloading skip and move on, come back later to copy off the lan

I tried uploading the code but so far this forum mangles it, if i try to change the ext to jpg it tells me its not valid… i will have to find a new way if anyone is interested.

Worth mentioning that i am not a programmer and this is the first program i have ever written in Python and i only have about 8 hours into programming and testing it so i’m sure it has a few bugs i have not found yet.


Problems i have not found solutions to so far.

  • The wireless module the slice comes with is horrible, dropping packets left and right on all 5 Slices. Even when the AP is set right beside it. 4 of the slices will be hardwired so this isn’t a problem. The one on the Jet however will have to be wireless. Does anyone have a solution for this, maybe a better USB dongle that OpenElec has drivers for.

This may be caused by the USB bus speed because i am using the USB for the HDD and Wireless. Does the internal SATA port also use the USB bus? or would an internal HDD make this problem go away?

Transferring a movie on wireless takes many hours. I will test wired today to see if the problem is only on the wireless.

  • The Slice is a little slow to loop though a few thousand files in a timely manor, I have ordered 5 of the new faster compute modules and some parts to try and make heat sinks with.
  • I would love to have more remotes on some of the systems, like on the jet, a remote at every seat would be ideal. The owner was thinking of using ipads at each seat but i would also be nice to buy more of the black remotes, are these available?

Problems i have solutions for but there may be better solutions

  • The 4 TB drive wont fit an i will have about 3.5TB of files, i now have external 4TB usb drives that work just fine.
  • OpenElec wont let you install any modules or compile any new code or drivers. for instance the wifi module for python. So i had to write a few of my own subs to use the “connman” system that’s already installed. This isnt a show stopper, it just slowed me down a little while i worked around it.


I believe the SATA interface is implemented using a USB->SATA bridge on the Slice motherboard.

USB WiFi, Ethernet, SATA and USB ports on Pis (including the CM) all run across a single USB 2.0 bus. External Gigabit Ethernet->USB 3.0 adaptors (even running in USB 2.0 mode) can deliver higher speeds that the internal 100Mbs Ethernet solution. The bundled WiFi adaptor is 2.4GHz only - I’d look at a 5GHz module (or external access point connected over Ethernet working as a client?)


Sounds good, i will look for a 5Ghz USB.

I ran the sync last night on a wired connection and everything worked great.


I would have got two Slices for the jet. Set them up (hard wired in the hangar) the same as other locations, then swap them out regularly on the plane. They are probably the cheapest part of the whole plan.
Then all would be same build and easily replaced. And if you’re not fitting hard disks in them, why not just use Pi3 boxes? A lot more flexibility.

If you need assistance (site visits, Blu-ray ripping etc) let me know. I work for myself and after 40 years in IT I’m semi retired…


So i found a Wireless AC 2.4/5GHz Dlink adapter in our storage room.

Night and day difference on wireless reliability.

Ian, i like your idea of buying two boxes, i will have to talk to the pilots to see if they are up to the task of swapping units out, at present they have the unit plugged in and wedged under one of the seats and its not easy to get at.

I selected the Slice because it was the easiest device to get past the FAA, bare circuit boards or raspberry pi’s in a case with no FCC or other certification labels would have been a red flag. As long as this device is not “permanently installed” and has passed its certifications its allowed on the Jet. That being said i’m not sure the Slice has passed FCC, it doesn’t have any labels on it, not sure i want to know at this point :slight_smile:

If this all works out as planned i will most likely buy another 10-20 of these and place them on other TV’s throughout the properties and then update the script to attempt to sync locally before going externally. There are 7 TV’s on the Jet alone, it would be possible to allow each seat to watch its own Slice.


Not sure about the Slice - but the original Pi has travelled on the International Space Station (albeit in a custom metal enclosure)… That may mean it exceeded FCC requirements (albeit in the custom metal enclosure) :slight_smile:


if you look at flight safety testing (for space!!) it somewhat exceeds FAA requirements, I suspect :slight_smile:. But worth a read if you have not seen it.

I thought that all the PI family of devices had to meet current CE (Europe) and FCC (US) certifications in order to be sold in the respective places. I am sure one of the FIVE NINJAS will confirm.



Hi Todd,

Very interesting project. Thanks for sharing it with us.

You may want to look at using something more efficient with data for syncing files between your slices.
I am guessing that rsync would be more efficient because it should just copy what has changed.
Another option could be to use something like bt-sync as this could torrent between all of your slices rather than just one server.

Sing out if you need a hand



for my particular case the amount of time it takes to sync doesn’t matter however i could see how it would for some individuals. There are many ways i could make it faster, i will look into that a little later once i have all of the sites deployed.

The Jets Slice was installed today, everything worked great. There will be a total of 6 ipads configured with the “official kodi remote” app. I added 3 movies last night to the FTP server and when i loaded up the Slice it downloaded them, indexed them and cached all of the images for the movie, actors, etc. Everything worked as it should.

Once the sync was done the unit disconnected from the hangers internet feed and connected back to the Jets internal control network just like it should (the sync script controls this)

Now i am focusing my attention on the units that will be installed in their houses. Currently the sync is triggered by the Slice being booted. I was thinking the best way to sync the in home Slices would be to reboot the Slice automatically every night at 3 AM. This would
A) cause the Slice to sync
B) cause Kodi to restart so its always at the home screen each morning
C) cause Kodi to restart just in case there was a memory leak or software bug that caused it to slow down or crash if left on for months at a time.

On Monday i will see if Cron works on OpenElec, if it does that might be my easiest solution.


until one of your ‘customers’ is up late watching a movie and … it reboots … just before the ending… may cause unhappy customer, I know I would be upset :slight_smile:



There are a number of things that you could change to improve the experience

Upgrade to the CM3 module and heatsink :slight_smile:
Use the latest version of LibreELEC
Make use of https://github.com/MilhouseVH/texturecache.py


In addition to @MikeBuzz suggestions, the network interface works somewhat faster using the CM3 too, so sync of the devices would be quicker as well.

… but I agree CM3 does need a heatsink



Thanks MikeBuzz and g7ruh

The rebooting at 3AM while watching a movie problem can be easily solved. I will write a small :“Reboot” script. The reboot script will check if XBMC is currently playing, if not, reboot. If it is playing just skip the reboot and wait for the next day. I could also just sleep for 10 minutes and check if its playing again , do that 24 times or so and if its still playing something just wait for the next day for the script to run again.

I ordered the CM3 Modules at the same time I ordered the slices along with some heatsinks that I think will work. Looks like they are back ordered though and might take a while to get here.

My current script does use the texturecache.py script to download all the artwork. I found that while google searching and it works perfectly. I couldn’t figure out how to include the texturecache script and then execute the proper subs correctly so i just run the texture cache script from the command line after my script has terminated.

The pilots mentioned that word of how well the system is working is already starting to get around private airport and he told me that there may be some new customers that would be interested in systems for their jets. One of the interested customers owns a fleet of private jets.

Most of these jets have large HDMI switches at the front that are hooked to multiple BluRay players. It might be possible to create a system that fits into the rackmount Bluray slot that contains 10+ slice boards (or something similar mounted vertically. You could then use one Slice as the “File Server”, it would handle the content and hold the Kodi database, the remaining would run one kodi instance per seat on the plane. This would potentially allow each seat to watch its own movie. Round that out with a theme that’s branded GulfStream or Leer, etc. A screen saver that shows some photos of their Jet (owners love that kind of thing) and i bet I could get in the business of making a lot more of these things… I think i would need to have anything FAA tested though… that could get expensive but a system like that could sell for mid 5 figures easily. (the linksys router that Gulfstream sells is a clone of the WRT54G running OpenWRT and sells for 8K because its certified for aircraft use.)

I know this is a slice forum but potentially I could create something similar to this
Multiple Compute modules
with multiple HDMI connections on the back, and maybe a touch LCD on the front for control of the sync settings and cluster, with buttons for “Play Safety Video”, etc.

Skys the limit… (pun intended) but for now back to configuring this to work for the houses on the ground.


Sounds like a Slice Light kit required?

Gordon had suggested that Pimoroni would probably be able to supply with CM3 rather than the original CM1 fit.