Skip to content

Instantly share code, notes, and snippets.

@samuelstein
Forked from Dhertz/Ubuntu_Aerial.md
Last active November 27, 2016 18:36
Show Gist options
  • Save samuelstein/5e4ece541a2c69e54dfe to your computer and use it in GitHub Desktop.
Save samuelstein/5e4ece541a2c69e54dfe to your computer and use it in GitHub Desktop.
Quick overview of how to get Apple's new TV screensavers working on most linux systems.

Using Apple’s Aerial Screensavers on Ubuntu After coming across the [Aerial] (https://github.com/JohnCoates/Aerial) screensavers for Mac, and installing them, I decided that I had had enough of the graphics-demos of my Ubuntu Precise system. I hope to provide a simple guide on how to add them to your setup as well.

First, you need to install xscreensaver (for example with aptitude, but your distro should have it):

sudo apt-get install xscreensaver

Now remove gnome screensaver

sudo apt-get remove gnome-screensaver

and the latest version of mpv (you must use the latest version, see here for a list of repos for various package managers:

sudo add-apt-repository ppa:mc3man/mpv-tests
sudo apt-get install mpv

Then, we need to go and actually get the videos that Apple uses as screensavers. I wanted to do this regularly as they may add more locations or videos, so I wrote a hacky script that checks the server to see if there are any videos that I do not have on disk and download them:

#!/usr/bin/python

import json
import os
import requests
import sys

if len(sys.argv) != 2:
  print("Usage: %s <folder to save videos to>" % (sys.argv[0]))
  sys.exit(1)

downloadDir = sys.argv[1]

if downloadDir[-1] != '/':
  downloadDir += '/'

response = requests.get("http://a1.phobos.apple.com/us/r1000/000/" +
     "Features/atv/AutumnResources/videos/entries.json")

screensavers = json.loads(response.text)
for screensaver in screensavers:
  for asset in screensaver['assets']:
    filename = downloadDir + asset['id'] + ".mov"
    if not os.path.isfile(filename):
      print("Downloading %s" % (asset['url'],))
      film = requests.get(asset['url'], stream=True)
      with open (filename, "wb") as filmFile:
        print("Writing %s to %s" % (asset['id'], filename))
        for chunk in film.iter_content(chunk_size=1024):
          if chunk:
            filmFile.write(chunk)

and then I set it to be run every day at 3:00 pm by adding this to my crontab (run crontab -e):

03 00 * * * /home/samuelstein/screensavers/apple-aerial/get_videos.py /home/samuelstein/screensavers/apple-aerial

You will want to replace where you saved the script and the folder where you wish to save the videos as appropriate.

Finally, I added this to my .xscreensaver file under the programs section (which by default is in your home directory), after all of the other screensaver options (at the end of the big list of names with lines that end with \n\)

"Apple Aerial" mpv --really-quiet --shuffle --no-audio                      \
                                  --fs --loop=inf --no-stop-screensaver       \
                                  --wid=$XSCREENSAVER_WINDOW --panscan=1      \
                                  $HOME/screensaver/apple-aerial/*          \n\

and selected "Only One Screen Saver", "Apple Aerial" and to Cycle After 0 minutes in the xscreensaver-demo:

At last you have to add xscreensaver to your startup applications: Find Startup Applications from Dash. Press Add. Type xscreensaver for the name and xscreensaver -no-splash for the command.

@ntassani
Copy link

Hi! Sorry for the delay. I don't receive any notification...
Yes, i install mpv with this method. I'm running elementary loki. But I'm getting the samme error :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment