This is possibly a solution to a problem no one other than me has, but once in a while I like to challenge myself to see if something ridiculous is possible.
I didn’t want to just see if I could install Plex though; I wanted to see if it would be possible to actually run a PMS instance along with Sonarr to download content automatically for shows I’m interested in.
This introduced a couple of challenges, as Sonarr would need to be run using Mono (as it’s a .NET project), I’d need a Bittorrent client to actually download the content, and I’d likely need to be running a Jackett service to allow Sonarr to process request through sites like The Pirate Bay.
Finally, as the Moto X is an ARM device, all of our software will need to be capable of running on an ARM platform.
Note that this process (with some minor changes) can be used to get a Plex + Sonarr + Jackett + Filebot + Transmission setup done on any Linux distribution. I just thought it would be fun to do it using a phone.
Setup the Phone
This was the easiest part, as it simply required rooting the device so we could install SuperSU.
Once both are installed from the Play Store, run Busy Box and select Install. You should only have to run this once, as it just installs a handful of Unix tools that Linux Deploy will need for the next step.
Linux Deploy will require a bit more configuration as you need to tweak it a bit to suit your needs.
First, select the repository you’d like. For my phone I went with ubuntu-lxde_arm, as this would setup an Ubuntu 16.04 LXDE distro along with VNC and SSH. Those will come into play when we want to start setting up Sonarr and Plex.
Under the properties for the repository (the settings icon in the lower right next to the Stop button) I set the Installation type to Directory. This setting allows use to have access to all available storage on our device. The first time I tried this I used the default of File, which only gave me 2GB of storage to play with. Once the base installation was done, there wasn’t enough space left for me to do much. I tried tweaking the Image Size (MB) setting and starting over but it didn’t make a difference. Your milage may vary, so feel free to try other configurations.
Next, from the top-right menu you need to Install the selected repository. This will do the basic installation of the Linux distribution you selected and pre-configure it for SSH and VNC access.
Once installed, click on the Start button to boot up the image. After a lot of terminal scrolling, you’ll see something along the lines of
<<< start on the last line and the text will stop. This is our signal to start setting up our software.
We’ve now got Linux running alongside Android on our phone. Let’s SSH into it and continue. The credentials are available under the repository properties. You can change these prior to installation or just use the defaults that are generated.
Setting Up Plex
There isn’t an official ARM distribution of Plex, but thanks to some great work by Jan Friedrich, we can easily patch the Plex NAS distribution for ARM or ARM64.
1 2 3 4 5
This will create a Debian package that can be installed directly. For me, it produced
plexmediaserver-installer_18.104.22.16872-b207937f1-2_armhf.deb, so installation was done using:
Then, to start up your Plex Media Server:
You can verify it by going to http://phone-ip:32400/web/index.html.
I’m not going to set anything up here yet as we first need our media source available, which we’ll be doing next.
Setting Up Sonarr and Jackett
Sonarr can be installed from a repository list, so we’ll just set that up on our phone. Sonarr will also require Mono to be installed, which luckily for us is also available from Ubuntu compiled for armhf.
1 2 3 4 5 6
Before we configure Sonarr, we’ll setup Jackett. Jackett can be used to connect a torrent search site as a Torznab feed to Sonarr.
For the purposes of this test I just setup The Pirate Bay, but Jackett supports a number of sites that may better suit your needs ;)
To start Jackett, we’ll need to run it using Mono:
Jackett will be available at http://phone-ip:9117. Once you’ve configured a search site in Jackett, you can start Sonarr and begin configuration.
Sonarr will start up at http://phone-ip:8989. First we’ll setup an Indexer (from Settings -> Indexers). This is where we’ll plug in the details we configured in Jackett. You’ll need exact url from Jackett, as well as the API key. This information is all easy to find from the Jackett interface.
Next, setup a TV show from the Series section. Once added we’ll need to configure way to download content automatically when Sonarr detects a new episode. This is done under Settings -> Download Client.
Create a new Transmission client, give it a name and leave the default settings.
The only issue now though is that we don’t have Transmission setup …
Setting Up Transmission and Filebot
First, let’s install whatever we can from our existing SSH session:
1 2 3 4 5 6 7
NOTE: if you get an error installing the key via
apt-key, try the following:
In order to use Filebot, we’ll need a script we can call from Transmission. The script I’m working with is as follows:
This script assumes that (a) your home directory is
/home/android, and (b) you will be storing your media for Plex at
/home/android/Media/TV. Feel free to modify the values to fit your particular installation.
Let’s save this script as transmission-postprocess and make it executable using
chmod +x transmission-postprocess.
Next, we’ll need to actually VNC into our Linux distro. This is due to Transmission being a GTK application so we’ll need to interact with it in a desktop environment.
From the desktop, launch Transmission and go to Edit -> Preferences. We want to do two things now:
- Setup Remote Access
- Under Downloading setup the script we created above to be called when a torrent completes
Putting It All Together
open in new tab to see full size
Going back to our Plex Media Server url, we can now setup a library that points to our downloaded media directory.
When Sonarr detects a new episode, it will send the torrent link it finds from our TPB indexer to Transmission, and on completion Filebot will analyze the file and move it to the appropriate series/season folder for the show that was downloaded.