David Hutchison

Plex DVR - Introduction

I have been using Plex as the software powering my media server for around two years now, and recently opted to pay for a lifetime Plex Pass. It does get used daily, and some of the features of the paid version looked particularly useful, such as the offline mobile media sync and the (beta) Live TV & DVR feature.

Since I dropped my subscription to satellite television 6 months or so ago, I have been without the ability to record anything which shows on TV, and need to rely on catch up services. In reality, this is not much of a problem as I do not watch a lot of television, but there are a couple of programs I watch which I would like to keep.

My home antenna does have a cable terminating in to the same room as my server sits and, while not on the supported hardware list, I do have a Microsoft Official Xbox One Digital TV Tuner lying about unused.

The setup I am starting with is:

It was worth spending a bit of time trying to get this tuner device working, as I already had it, and it is a cheap USB tuner compared to the devices which are officially supported (~£8, vs the cheapest of the supported devices being the Hauppauge Freeview HD TV for Xbox One at ~£40). Also, the host OS I use rules out the Hauppauge Freeview HD TV for Xbox One anyway, as the only operating system listed for Linux support is Ubuntu 16.4.

This is the introduction to a series of posts documenting the journey to getting Plex DVR working with this unsupported device. The approach has been rife with failures, but has been a learning experience and, while a bit less clean than I would like, it works.

Centos, MakeMKV and External Drives

For most of the last two years, I have been using an HP Microserver as my media server (running plex) and general development server running on CentOS 7. A few months ago I bought an external Blu-Ray writer, specifically a Samsung SE-506, for use with it.

In the past I have tried MakeMKV for extracting MKV files from some old home made DVDs, and I wanted to try this directly from the server. I had two problems when trying this:

  1. The drive was not supported by the libusb version supplied with the version of CentOS which was available at the time, fortunately the release of CentOS 7.3 brought the support I needed.
  2. MakeMKV was unable to use the attached drive unless it was being ran by root.

In order to allow MakeMKV to be able to access the drive when ran as a non-root user, a new udev rule is needed. My drive is mounting as the device “/dev/sr0”, so I created a new file “etc/udev/rules.d/80-bluray.rules” with the content:

    KERNEL=="sr?", MODE="0666"

This file will target any “sr” device and change the permissions so it is accessible by any user (the default permissions where 0660). More details are available in the udev documentation - it looks to be an enourmously powerful utility.

Site Updates

Last week I became aware of an issue where some pages of my site were not rendering correctly, specifically ones which used code blocks including line numbers. Unfortunately it looks like this has been the case since February when GitHub Pages upgraded to Jekyll 3.

With the help of Parker Moore from the Jekyll Project the cause was found to be the compress layout for Jekyll, which I’ve previously written about and recommended. This is logged as an issue against the project, but there does not seem to be a fix on the horizon.

In addition to removing this layout from use, I have redone the CSS to be built using SASS instead of LESS. This change is purely so the build is part of Jekyll and not a separate process to manage. Re-doing it provided the opportunity to streamline and optimise the CSS used. The styling is not yet perfect, but it is sure a lot more manageable than it was previously.

Pythonista Dropbox Sync - Revisited

As mentioned in my previous post the Pythonista Dropbox Sync script has been receiving some improvements as a result of “issues” raised on the GitHub Project. It still has some outstanding issues, but has gained many new features since it was first introduced.

Run Arguments

Pressing and holding the Play button in Pythonista will result in a prompt dialog being displayed to allow arguments to be supplied to the script.

There are three run arguments which can be supplied to this script to change its behaviour.

  1. “-v” turns on FINE level logging in the script
  2. “-vv” turns on full DEBUG level logging in the script
  3. “-c” runs the advanced configuration phase detailed below.

Arguments are processed from first to last, with later arguments taking precedence where there is any overlap.

Configuration

The initial version of the script which was published required the user to tweak some variables near the start of the file to hold items such as API tokens. This made updating the script to commit, or pulling a new version problematic.

First run configuration

When the script is ran without the “<Pythonista Documents>/dropbox_sync/PythonistaDropbox.conf” file existing, a set of first-run configuration prompts are shown. This just covers the basic configuration of the Dropbox authentication token required for the script to function.

Advanced configuration

Running the script with the “-c” run argument will prompt for input for an advanced set of configuration options.

These are:

  • The file extensions to sync.
    • The default set are: “.py, .pyui, .txt, .conf”.
    • A special value of “*” can be used to sync all file types.
    • Entered values will be merged with the default options.
  • File paths to explicitly skip
    • Multiple paths can be specified by comma separating them.
    • Paths should be relative to the root Pythonista documents folder.

Going Forward

There are still a few bugs to work out in the script, and a few larger enhancements. I’m hoping to get some time over the next month to tackle them, but all contributions are welcome!

You can contribute using this GitHub repository.