After updating Plex, Infuse cannot connect anymore

Preface

I sometimes use Infuse on my Apple TV to watch things. But after I upgraded my Plex server, suddenly Infuse was unable to connect to Plex. Took me a while before I found the correct setting responsible for this, so I thought I’d share it here.

Solution

Navigate to “Settings -> Server -> Network” and go here:

screen-shot-2016-10-23-at-10-15-09

Ofcourse, adjust the ‘192.168.0.0’ to your setup.

Result

Now you can connect with Infuse (and probably other affected third-party ‘Plex-clients’ as well) without authentication, which is good. Right?!

Clean out the trash from your media-folders

Preface

I’m a big fan of movies and series and use a combination of Couchpotato, Sickbeard & Sabnzbd to download. Then, I feed everything to Plex which adds meta-data, makes it look pretty and available on my Apple TV to watch. Works like a charm.
What annoyed me, was that when I deleted a movie with the Plex GUI, it just deletes the media-file (e.g. just the .mkv or whatever) but leaves all the surrounding trash and the folder which contained the file as well.
So I created a few one-liners to ‘find’ the trash, delete it, and finally delete the empty folders.

Also, you must enable, or allow ‘media deletion’ on your plexmediaserver (it’s a setting in ‘Settings -> Server -> Library) but after that I experienced that the tools I use for downloading and the Plex-clients use different permissions (so I ended up with a Plex-client that does not have the right permissions to delete the files.)

screen-shot-2016-10-23-at-10-10-45

Warning: it’s not pretty, this should probably be done in a nice little script and can be done much more clean, but this was a quick hack and I want the syntax to be here for future reference, so don’t bash me for that .

Code

Example to correct the permissions (bad hack!) & find all the garbage-files recursively in the media folders and zap them to oblivion:

@daily sudo chmod -R 777 /media/media
@daily sudo find /media/media -name "*.nzb" -type f -delete
@daily sudo find /media/media -name "*.idx" -type f -delete
etc ..

Then when you cleaned out the folders, you can (at your own risk ofcourse) safely use:

@daily sudo find /media/media -type d -empty -delete

which will ‘find’ things with ‘type d’ (that are directories ;) ) which are ‘-empty’ and deletes ’em.

Result

A nice and clean media library! Hurray!

Automatic subtitle downloader

Preface

I’m a real big fan of Plex and installed plexmediaserver on my Debian box. But there is one thing Plex seems to lack which is automatic subtitle downloads (which I think is pretty weird, because it’s really good at anything else media related (this seems missing guys!).

Anyway, I found the package ‘subliminal’ to be useful. Created a small one-liner that crawls through my media-library and adds the (not of all the time) correct subtitles to my movies and series.

Code

Install the package like so:

sudo apt-get install subliminal

Then add it to cron like so:

@daily subliminal download -l nl en /media/media/TV\ Shows/
@daily subliminal download -l nl en /media/media/Movies/

This makes sure subliminal runs ‘daily’, crawls through both libraries and tries to fetch the Dutch (nl) and English (en) subtitles and saves them next to the files. That way Plex can easily spot them and offer them when available.

Makse sure to change the path’s to your correct media-libraries. I explicitely created two entries for TV Shows and Movies, because I have two other libraries in /media/media/ that don’t need subtitles. Let’s just say that the ‘stories’ or dialogues in these libraries are not thatimportant .

Result

Fresh subtitles every day!

Automatic NPO watchlist downloader (Dutch television)

Preface

I have been waiting (and waiting) for an app for my Apple TV for a long time now, but it seems to never come. I started looking around for alternatives and stumbled upon flexget, which offers a pluggable framework to ‘get’ stuff media related.
Next to that, I found another useful tool, download-npo, which can download episodes from the NPO-website command-line.
Third, someone created a plugin for Flexget (npo_watchlist) which ties these two together.
Because this is used by Dutch people only and then very few of them I guess, there’s not a lot of support available, so I thought I’d share my setup, because it gave me quite some headaches to get up and running, but looking back it was pretty easy if you know how.

1. Install flexget
2. Install download-npo
3. Create an NPO-account
4. Create a config-file
5. Add it to cron

Code

1. Install Flexget
Make sure you have Python running and install it with pip (this makes it easier to upgrade later on)

sudo pip install --upgrade setuptools
sudo pip install flexget

2. Install download-npo

pip install download-npo

3. Navigate to the NPO-website and create an account.

4. Create a config file
Flexget will look at several places for it’s config-file, I put everything in my ~/.flexget folder. The config file is called ‘config.yml’ and for the npo_watchlist plugin to work it needs minimal information, see this link for the setup.

screen-shot-2016-10-23-at-09-13-18

Updating is easy with pip:

sudo pip install --upgrade setuptools
sudo pip install --upgrade flexget
sudo pip install --upgrade download-npo

5. Add it to cron (crontab -e)

@hourly /usr/local/bin/flexget --cron execute

Results

Flexget now downloads the new episodes to my Plex directory where they are automatically added to a library I called “DVR”. Now every show I add to my watch-list or favorite-list in my NPO-account will be downloaded to Plex so I can watch it on my Apple TV .

cleanup script to put files into date folders

Preface

I made a backup-script which just dumps it’s files into 1 folder, but that got messy pretty quickly. I needed a script which could cleanup files (*.tgz) from a folder and put them into their respective date-folder.

Code

#!/bin/bash
cd /rootfolder/to/cleanup
for x in *.tgz; do
d=$(date -r "$x" +%Y-%m-%d)
mkdir -p "$d"
mv -- "$x" "$d/"
done