This is the process I followed to get a working AirPlay receiver!
First off, assemble your Raspberry Pi (put the case on, plug in the Wi-Fi and sound adapters, and plug in an Ethernet cable). I highly recommend connecting a keyboard (USB) and a monitor (HDMI). This is going to just be a temporary thing until you’ve got everything configured, so you could just unplug your Blu-Ray player and hook it up to your telly (this is basically what I did).
Now you’re going to download Raspbian, which is the official Linux for the Raspberry Pi. I got Raspbian Wheezy from the official downloads page, as opposed to Raspbian Jessie, which is a more recent version. I choose Wheezy because it boots to the command line instead of to GUI, and I thought that for what I was doing, that would be a more sensible choice; I’m sure most of the instructions herein will be the same.
After I downloaded Raspbian Wheezy, I unzipped the resulting file and followed the instructions for creating an SD card using OS X. I used Disk Utility and worked out what the disk number of the SD card was by looking at the entry for ‘Device’ in the table underneath the usage chart, and then I ran the following in Terminal.app, where the n in rdiskn should be replaced with whatever the disk number you find is:
This whirred away with no outputs to the Terminal until the process had finished, so don’t be alarmed if nothing appears immediately; just be patient.
I then took the SD card out and put it into the Raspberry Pi. I connected an Ethernet cable to the Pi and to my router, so that it would have an Internet connection. I initially did this with no connected monitor, but I found it too frustrating for words not to be able to see what was happening, so I also plugged in a USB keyboard and a HDMI display. Then, I plugged the power cable in and watched everything boot.3
The username and password for your Raspberry Pi are, by default, pi and raspberry. On my first boot, I was logged in without needing these, but it’s worth knowing what they are for now. You ought to see the configuration screen upon your first boot, and so I followed these steps to configure my machine, expanding the filesystem, setting a locale and a timezone, and changing the name of my Raspberry Pi on the network. Then I rebooted, and logged in using the username and password, ending up at the shell.
At this stage, I got bored of being in front of my TV, so I unplugged the USB keyboard and the HDMI display and headed to my iMac, where I brought up my Wi-Fi router’s list of devices on the network. Upon learning the IP address that my Raspberry Pi had on the network, I was able to run
The Ethernet cable was trailing across my living room, so configuring Wi-Fi was the next thing to do. Fortunately, once you have the drivers for your Wi-Fi adapter set up correctly, this is pretty easy5! The Wi-Fi adapter I bought isn’t supported out-of-the-box, but a trip to Stack Exchange revealed that this wasn’t a problem, courtesy of this post by MrEngman on the Raspberry Pi forums. To get the adapter working, simply do
pi@RaspberryPi ~ $ uname -a
Linux RaspberryPi 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l GNU/Linux
to find your version number (in this case, it’s 3.18.11-v7+ #781) and then, on MrEngman’s post, find the .tar.gz filename which corresponds to that number. Then, I just scrolled to the bottom of his post to find out that I needed to run
tar xzf 8188eu-v7-20150406.tar.gz
to get my Wi-Fi adapter working. I rebooted the system before continuing, just to be sure.
I then rebooted and tested the output by plugging my EarPods into the sound adapter and then running
speaker-test -t sine
If you don’t hear a tone, it’s not properly configured.
Finally, I installed the tools I needed to get AirPlay running on my Raspberry Pi. I initially used this AirPlay tutorial and this AirPlay tutorial to get it working by installing a GitHub project called Shairport into ~/airplay, which is currently not under active development. I AirPlayed some audio to the Pi, and it worked fine, which made me very happy! However, when I tested using iTunes to play through the Pi and my iMac simultaneously, the two audio tracks were not in sync. As such, I went looking for ways to make AirPlay synchronise the playback.
I found my salvation in the form of Shairport Sync, which is a fork of Shairport with the added benefit that it is in active development6. Here are the steps I took to install it7 (including a line which checks whether systemd or System V is the way forward on your machine8), which come from the project’s Readme.
I then configured Shairport Sync so that when I AirPlayed to my Raspberry Pi it would appear with a different name. Since I’m going to hook this up to a Sony Hi-Fi, I ran
sudo nano /etc/shairport-sync.conf
before uncommenting the first line under general so that it read
name = "Sony Hi-Fi";
before the rest of the settings. Then I rebooted the Pi, and Shairport Sync automatically ran on startup and let me AirPlay my music to it, perfectly synchronised with my other speakers.
Finally, I decided to make a copy of my SD card so that if I messed things up in the future, I can roll back to being satisfied with my progress. To do this, I put the SD card back in my iMac, and then (following the advice of this guide) used Disk Utility to work out what disk number it was (the n in rdiskn), and then did
sudo dd if=/dev/rdiskn of=~/Desktop/pi.img bs=1m
I might be going crazy, but a look at the SanDisk website doesn’t seem to show this product as a current part of their line-up, with only a microSD XC card available; hence the link to a shop rather than the official product page. ↩
I later found out that this adapter doesn’t work without a significant amount of coaxing. Don’t worry, I’ll give the details of how I coaxed it herein! ↩
Watching all the console outputs whizz past on Linux really does make you feel like you’re in The Matrix. ↩
A lot of Raspberry Pi guides will tell you that you need to enable SSH yourself, but this appears to be false in newer versions of Raspbian. ↩
Some guides, such as this one, will tell you to edit /etc/network/interfaces to get Wi-Fi up and running, but again, this appears not to be necessary in newer versions of Raspbian. ↩
Shairport Sync was last updated in October 2015, three months before this was written. ↩
Note that I did this having already followed the tutorials to install Shairport, so it’s possible that this will not work without having done that. I think it should be fine, but I might be wrong! ↩
I think Raspbian Wheezy requires the System V method whereas Raspbian Jessie can use the systemd method, so this part might be a little different if you went modern and plumped for Jessie. ↩
When I moved into my new flat, I got an Apple TV. I love it so much — it connects to the TV in the flat, letting me watch Netflix and YouTube videos, or videos that are in my iTunes library. It also lets me use AirPlay, which is baked into Apple devices; if I’m watching a video on my iPad, I can tap a button and suddenly the video I was watching appears on my television, letting me watch videos either on the sofa or as I wander around doing housework.
This is especially useful for me, because there are a couple of video sources on my iPad that I can’t get on the Apple TV. The first requires some context: I have a Synology NAS1, which is running Plex Media Server2 By running Plex on my Synology, I can watch any of the videos I have downloaded on my iPad (or my Mac, or any other device). But, there isn’t a Plex app for Apple TV, so I have to use the iPad to watch this content and use AirPlay if I want to watch it on my television.
The second video source is Netflix. While the British Netflix is available through the Apple TV, sometimes it’s useful to be able to connect to Netflix in other regions because the video content there is different (the US has many more US sitcoms, for instance; the Dutch site has a lot of blockbusters). I can’t do that through the Apple TV, so I had to connect the iPad to my VPN (Private Internet Access) and then the iPad to watch it.
It’s a fairly minor inconvenience, but I got more and more annoyed that whenever I wanted to watch videos from Plex or other regions’ Netflix I had to use the iPad. Using my iPad to AirPlay the video to the Apple TV worked fine, but it was annoying if the iPad was running low on battery, or even if I was browsing Reddit and accidentally clicked a link to a video. Heck, even visiting a website with video ads can replace the show you’re watching with something completely different!
Fortunately, however, it’s possible to get your Apple TV to play video from both the sources I list above, and this blog post shows you how to do that. Before we start, I’m assuming that you already have Plex Media Server running on your Synology (and therefore that you have configured your Synology to allow third-party packages). Also, this process caused me a great deal of stress and occasionally went very wrong for me, so make notes of the initial state and don’t blame me for anything that happens as a result of these instructions; you do this at your own risk.
Getting Plex onto the Apple TV
The first step is to visit this very useful post on the Plex forums, which will take you through the process of installing and running PlexConnect on your Synology. It looks scarier than it is, but honestly it’s about five minutes’ work to get everything working. This process neatly addresses the first of my two gripes about the Apple TV, and I can’t imagine I’ll ever miss the WSJ Live app. It’s worth noting that installing PlexConnect will cause your Apple TV to stop receiving updates by default, but this can be changed (I’ll leave how to do so as an exercise for the reader).
Getting US Netflix onto the Apple TV using OpenVPN
Once you’ve got PlexConnect working, if you want to get US Netflix as well, there are a couple of ways to do that. The way I did it was predicated around my choice of VPN, Private Internet Access; they allow connections through OpenVPN but don’t offer what’s called a Smart DNS3, which meant I had to get a little clever. The first thing to do is to visit your Wi-Fi router’s settings and make your Apple TV’s IP address permanent4. Then, on your Apple TV:
Open Settings, then General, then Network, then the name of your network (as before).
Select Configure IP, then select Manual.
Don’t change the first two IP addresses.
Change the IP address for Router and DNS to the IP address of your Synology (the second one should already be set).
Then, on your Synology:
Open Control Panel and head to the Network, before opening the ‘Network Interface’ tab.
Create VPN profile.
Select whichever type of VPN you have. OpenVPN is the best choice if your VPN supports it.
Fill in the details, and make sure you tick the box that allows other devices to use the Synology’s internet connection.
Connect the VPN
Go back to the Apple TV, and open the Netflix app; the content shown should be from the region that you’re VPN’d to. However, there’s an important caveat here: as far as I can tell, PlexConnect doesn’t work when the Synology is connected to a VPN if you’ve followed these instructions. So: disconnect the VPN if you want to watch Plex content, and reconnect it to watch Netflix in other regions.
So, there you have it. You can watch US Netflix content from your sofa using a VPN and PlexConnect. Go forth and binge Parks and Rec!
A NAS is a box that has some hard drives in it and connects to your router. Once it’s connected, anyone on your network can access the drives, and you can install some simple programs on it that are also accessible to people on your network. One of these programs is Plex, which basically takes video files and organises them for you. But, if you didn’t already know all that, this blog post might not be ideal for you…. ↩
I use Transmission, a popular BitTorrent client developed for OS X and Unix platforms. I also own a Synology DS415+; whilst it’s possible to run Transmission directly on a Synology NAS, I run Transmission on my iMac and set the NAS as the destination folder for my downloads.
The other day, I began to encounter a problem. Whenever I added a new torrent, Transmission would stop downloading at about 1%, with the error Permission Denied (/Synology/Downloads). This was, naturally, quite irritating, so I set out to find out what was happening.
This error is caused by a bug in Yosemite. If you go to the terminal and type
you’ll see a list of the names of the volumes connected to your iMac. In my case, something was immediately a little weird; Synology appeared in the list as it should have done, but Synology-1 was also listed. Ejecting the network drive meant that Synology-1 disappeared, but Synology was still listed.
I had cause today to try to unpack a .pkg file. I had installed PDF File Unlocker and found it was a bit pants1. Unfortunately, it installed from a .pkg file and there was no uninstaller or list of files that get installed, so I wanted to make sure I’d efficiently purged it from my system.
I have BetterZip, which is a really good utility for unzipping basically any file on the planet for OS X. I will just note at this stage that I have an older version of the utility and I haven’t upgraded to BetterZip 2, but I’ve got a lot of use out of the app. The below steps rely on having BetterZip. If you’d like to do it without BetterZip, I found this blog post and this Stack Overflow post to be very helpful in informing my actions.
Change the extension from .pkg to .xar.
Open the file with BetterZip. This took a while on my system but did eventually work.
Three files should appear: Payload, Bom, and PackageInfo.
PackageInfo: Just open this in your favourite text editor.
Add the extension .cpio.gz.
Open the file with BetterZip.
Navigate to the file.
Hopefully that all helps somebody else, too!
If you generate a PDF with the free trial, it’ll be the first half of the PDF and every time you open it Adobe Acrobat will give you a little pop-up window. I disliked it. ↩
I recently transferred stewardship of the Leicester Sabres PR machine1 to a new council, and as part of the process had to explain how to construct blog posts on WordPress. The new PR rep asked some questions about how to find images to use on a website, and what the rules were about using images. I explained that she would have to either find images that were in the public domain or licenced with Creative Commons2. It is not legal to simply use an image and credit the copyright holder; you must have their explicit permission before using any image! She balked a little at the news, and so I briefly explained some of my tricks for finding suitable images. Since I figure they might help my fellow bloggers, I humbly present them here!
Take your own photographs
Simply create your own images, either by photographing things that you want to write about or by drawing the images you want to use. In one way, this is the simplest solution: you created the image, so you definitely know you can use it. In another, it’s the hardest: you need to be able to create the image. You can’t just take a photograph of a piece of artwork, since that’s making a copy of the artwork and therefore copyright infringement. It has to be original!3
This is usually my first port of call. Visit Flickr, and simply enter what it is you’re looking for in the search box on the front page. Then, click ‘Advanced Search’, scroll to the bottom and tick the box that says ‘Only search within Creative Commons-licensed content’. The result of your search will give you images that you can use on your site. Flickr is a huge website with a lot of talented photographers putting images up completely for free, so this is a great way to do things.
Like Flickr, deviantART lets creators tell their visitors that images are under Creative Commons licences. Unlike Flickr, DeviantArt lacks any sort of way to search based on this. As a result, Google is our friend; simply perform a Google search for what it is you’re looking for, with site:deviantart.com "creative commons" tacked on (if you’re lazy, click here). Doublecheck the copyright status of the image by opening the ‘details’ tab below the picture; if it has a Creative Commons licence, you’re good to go!
Alternatively, you can search via DeviantArt and then click ‘Resources & Stock Images’. The description of the image http://www.mindanews.com/buy-imitrex/ will generally have the terms under which you may use it. This is another useful way to find images you can use on the site.
Wikimedia Commons is a collection of media, including images, which are free for you to use either because they are licenced by their creators under Creative Commons or because they are in the public domain. Simply head over to the website, enter the thing you’re looking for, and look through the pictures to find one that you like. Below the photograph will be information about the copyright status of the photograph explaining how you can use it.
If you’ve explored the above sources thoroughly and you don’t know where else to turn, there is a setting in the Advanced Search on Google Images which can find permissible images. I’m a bit hesitant to use it, though, because I don’t fully understand how they tell if a photograph is available for use; it’s worth a try, but make sure to read the webpage that Google finds before using the images!
Another potential source for images is organisations like NASA, which tend to make their images free to download and use as people see fit. This is provided that a specific credit is used, depending on the institutions and agencies involved in creating a given image. Other organisations involved in scientific research disseminate images, so if you know of one, look to see whether you can use their images. For instance, EFDA, the organisation responsible for JET and ITER, lets you use their images for “non-commercial, scientific, news and educational purposes provided that you acknowledge EFDA as the source”.
Hopefully this blog post will give people the tools they need to illustrate their blog posts whilst staying within the law. I hope you find it useful!
It’s not a very big machine, if I’m honest. Mostly a Facebook group and a website. ↩
A legal grey area arises if you take a photograph that happens to include a piece of copyrighted artwork, but which isn’t simply a copy. Or making screenshots of software, since they include the developer’s art assets. Do these count as making a copy and are they therefore against the rules? I haven’t found the answer to either of these problems — if you know the answers, please do comment below (preferably citing your sources!). ↩