MovieCLI

I recently stumbled across a YouTube video. They had created a simple bash script that allowed you to pull up a searchable list of movies and launch them from the terminal. I thought it was really cool. So I decided to extend that idea to allow me to do the same with the movies on my Plex server.

After a bit of tinkering and consulting with ChatGPT 😜, I ended up with what I am calling MovieCLI.

It is not specific to Plex. It will work with any server that you have access to. By updating a few variables, the script will temporarily mount your server and list out the movies and allow you to watch them directly. Once you close out of the movie, the server is unmounted.

Here are the variables to configure:

# Local base path for mounting drives (Be sure to include trailing slash)
LOCAL_BASE="/tmp/"

# Full base path for movie directories (Be sure to include trailing slash)
REMOTE_BASE="/home/username/plex/"

# Remote movie directories located inside the path defined in REMOTE_BASE (Be sure to not include any slashes)
MOVIE_DIRS=("movies" "movies-2")

# Remote server ex: username@hostname
SERVER="username@hostname"

MovieCLI is best used when the machine that you are using it on is configured to connect to the remote server using SSH Keys.

Get it on GitHub

Posted on