How to Leverage Plex Media Server to create an Indian Classical Music Library

How to Leverage Plex Media Server to create an Indian Classical Music Library

What is Plex?

Plex Media Server is a user-friendly way to store all your movies, shows, and other media in one place–and make it accessible from any device, whether you’re at home or on the go. It is a centralized media server system that eliminates virtually every problem you run into while managing a large personal media collection. The Plex model is simple: you park all your media on a single computer with the Plex server software installed, and then you install the Plex client on all your other devices, where you can remotely access your entire media library and watch it with no hassle. Plex also lets you add users to access your media library while allowing you to monitor them and grant permissions as required.

Further, because the Plex model is a server/client one, you don’t have to worry about copying files to your various devices and dealing with issues like playback quality, video resolution, and other details. Your Plex server will transcode all your media content on the fly so that it plays properly on whatever device you’re using. Not only do you get on-demand streaming to all your devices but you also get absolutely beautiful metadata and art to go along with it.

So basically a Netflix with my personal media collection right? What's so special about it?

Let's dive into how I actually used this to help solve a problem in the classical music industry in India.

\( \)

What was the Problem?

Today we live in a world where we can stream any music that we want by just opening an app on our phone. However, when it comes to listening to and studying classical music, all the recordings are not easily available on these streaming platforms. There are a number of such recordings of old artists from multiple events that have been recorded and preserved carefully to be listened to and studied by musicians and scholars in the field. However, they are not available on streaming platforms in order to not commercialize them and to respect the rights of the artists.

One such organization, Jaipur Gunijankhana, has a well-documented archive of recordings of some popular artists in the country. They wanted to provide an interface for their end-users, like music enthusiasts, to access these recordings in a manner that the users could not download or make a copy of the recordings and misuse them. They also wanted to track the users to see which songs they were listening to and other data for analysis.

\( \)

The Solution

After some research and discussion with our mentors, we came up with the solution of using Plex Media Server as an interface for the users to access the recordings.

JaipurGunijankhanaArchitecture.png This is a birds-eye view of how our project architecture is setup

How we achieved our goal

  1. To host the Plex Media Server(PMS), we configured a virtual Ubuntu server on our local machine and installed the plex server on it.
  2. We wrote a short python program to tag all the recordings before uploading them to PMS in a way that each artist along with their recordings and albums would be displayed separately in a single library. The program would make use of data from the excel sheet to update the metadata(tagging) of all the recordings and store them on the drive.
  3. For PMS to access these recordings stored on the cloud storage we had to first mount the files onto the Ubuntu server where plex was hosted. We achieved this using a command-line program called Rclone . Using Rclone we configured a remote for google drive which helped us mount the files.
  4. To upload the files(tagged recordings) to PMS we created a library in plex and added the local path of the mounted google drive to this library so that it remains in sync. Now any new file added to the drive will be mounted onto the server which will be reflected in the plex library after a scan.
  5. For any user to access the recordings, they simply have to download and create a plex account and provide us with their email id associated with this account. We will then be able to share the library with them as well as monitor and grant special permissions to prevent piracy.

My Contribution and Learnings

In this group project, I was responsible for setting up the plex media server on the virtual Ubuntu server. I also set up the rclone remote to ensure proper mounting of the google drive on our Ubuntu Linux server and create a library to sync the google drive file with the Plex Media Server.

This project has personally been a great learning experience for me in terms of networking principles and server management.

Key Learnings -

  • Learnt how to ssh into a virtual server for remote access

  • Learnt about SSH Authentication keys - public and private keys (more secure than simply using a password)

  • Setting up a basic firewall (ufw firewall)

  • Setting up a VNC connection and using SSH tunneling(for a secure connection) to access the remote server via GUI

  • Using Rclone to configure a remote to mount google drive files onto the server

  • Creating a daemon to start the VNC server on Ubuntu server startup after a reboot

  • Several Linux commands to create a user, grant administrative privileges, change the mode of files(chmod), move and copy files, download and install files as well as configure certain ports as needed.

Challenges Faced

While working on this project I faced some challenges which taught me a lot. I will highlight some of the challenges which were harder to resolve than the rest

  • While using rclone to access the google drive for mounting, configuring the remote to access the google account was somewhat confusing. I recommend creating your own client ID and client secret using google OAuth instead of leaving it blank.

  • While testing to see if the music files added to plex were audible and functioning as expected, we could not hear any audio. After some research, I learnt that VNC connections to remote servers do not support audio connections. To solve this issue I learnt how to configure the Plex server for remote access (directly from my local machine’s browser). I did this by configuring certain ports on the ubuntu server to allow remote connections to the plex server which resides on the ubuntu server.

\( \)

In conclusion, I am really grateful to have gotten this opportunity to work on a project which would enable research and study on the rich musical heritage of my country. This was the first time I was working on such a project and had to learn on the go to complete some of the tasks. I would encourage everyone to try and set up a virtual server at least once to experience and learn some of the concepts of computer networking.

P.S. - I would love to help anyone who is struggling with setting up an ubuntu server and connecting it to plex. If you have any questions ask me in the comments! :)