One of the most common and infuriating problems with running your own Plex server, (apart from non-local auth) is how do you manage a library with 4k content?
There are two schools of thought as to how is best to deal with this problem. The most common, and easiest way of dealing with 4k content is to have a separate library for your 4k films. Then simply don't share this with your users.
This will likely save you the most headaches. But I don't like doing this. If you have a separate library for 4k content, it is another library you have to scroll though to find a film. Not very usable for the the most important user, you, the server owner.
Now I propose a different way. A single library with all your film content in one place. But separate your films from each other.
You can see in the image above what happens when you store more than one copy of a film. You get an icon in the corner of the poster letting you know that there are multiple copies. Now you can play each version manually, but people just want to click play and it just work. If you were to click play on this outside of my house, Plex would start to transcode the 4k file which is not what we want.
Now, my solution is to split apart the movies. This gives you two distinct options to chose from, I then change the poster art for the 4k file to make sure that it is easily identifiable as 4k.
Doing this will give you multiple copies in your library, and that's annoying and bloats your library. To change this, I add the two copies of the film to a collection using the name of the film as the collection title. This has a downside of needing to be a little more ontop of your collection, and needing to manually add artwork to the collection if you want a single poster rather than the default multiple posters combined.
Now when you click a film you are taken to a screen where you can easily chose between the 4k version and the HD verson.
Lets take it one step further...
Now what if you haven't had time to edit your posters manually, users could select the 4k version and struggle through a stream, usually getting in touch to kindly let you know there is an issue with your server.
Restrict your users from being able even see the 4k content by using the sharing tags. Add a transcodable tag to all of your HD films, and a Best tag to all your best quality files. Then in your user settings, in restrictions set only transcodable as a restriction and boom, they will only be able to see films that your server can transcode.
That sounds like an awful lot of work
It is. but luckily we can automate a huge amount of that work. Making the task much, much easier.
Using a python script we will go through our film library, check for the resolution, check to see whether there are multiple copies of the film, if so, split them and add them to a collection. We will then add the appropriate tags.
To start you will need:
Once you have those installed you can clone my github repo
git clone https://github.com/jkirkcaldy/plex-utills.git
cd into to the plex-utils folder
pip3 install -r requirements.txt
Open the 4klibrary.py with your favourite text editor. Find the lines that say
baseurl and token
if __name__ == "__main__": baseurl = 'YOUR_PLEX_SERVER_URL' token = 'YOUR_PLEX_TOKEN' plex = PlexServer(baseurl, token) movies_section = plex.library.section('Films') movies = defaultdict(list) added = movies_section.search(sort='addedAt:desc')
Change these to your Plex server url and add your plex token.
Also make sure that the
plex.library.section is correct. For example all of my films are in a library called
Films. If yours is called anything different, change it to match your library.
Save the file and run it.
it will take a while to complete, especially if you have a lot of content. But once it has finished you will have a single library with all your films that is easy to navigate.
*In order to make sure you don't have a lot of duplicate films, make sure you have the library set to hide items that are in collections. *
Next time I will show you how to easily manage posters using a browser plugin.
Code was edited from a script posted on reddit by u/spazatk