Hello, Readers! I hope you are having fun and trying out new things with OpenCV. If you are having any issues with installing OpenCV and want to get started quickly, you can follow this guide to install OpenCV. In this post, I am going to show you a utility that I created while I was in college. I named it Movie Right Now. Let me show you what it does.
While I was in college, I had a lot of free time. I liked watching movies. I copied movies from the computers of my friends. Gradually, the collection of movies on my hard drive became huge. There were hundreds of movies which took hundreds of GBs of space. I had movies of every genre. It even contained movies that I had already watched a couple of times but forgot to delete them.
Later, I became busy. I had a lot of new things to learn. So the free time in my daily routine became marginally small. But I still liked watching movies. So whenever I could, I used to search for the best movie I had and watch it.
As I had that great collection of movies, it became a very tedious task. It used to waste a lot of my time. I was just browsing through the collection every time I wanted to watch a movie.
So I just had to make a list of the 10-12 movies after a lot of deciding. Then I opened IMDB to know the details of each shortlisted movie. This was not only wasting more of my time but also depended on the availability and speed of the internet connection.
API behind Movie Right Now
So one day I came across this cool API- OMDB API. It offers details of the movie that you send in the query as an input. It was public then. Now, it has gone private. So, you will need to pay at least 1$ a month to utilize the API.
I made a little script in java. The script iterated through each movie title stored on a hard drive location. It passed the title as the parameter to the OMDB API and fetched its details. This worked well enough. I was able to decide on the best movie I had on my hard drive after looking for those movies which returned the best rating and some other factors such as genre, director, and actors.
It saved a lot of my time. It only took some seconds as compared to hours when I was doing it manually. All I had to do was execute the script on the terminal/Command line. Then I needed to enter the location on my hard drive where the movies were stored. And that’s all. The Movie Right Now script printed out all the details of every movie on that location.
I showed it to my friends. It was fast, simple, and pretty accurate. But, executing the script on the command line and reading details from the output looked a bit complicated. So I decided to make a Graphical User Interface for the script.
GUI interface of Movie Right Now
This is the main screen of the Movie Right Now application.
It displays an option to enter a hard drive location where you have stored all the movies. You can just copy and paste the location of your movies folder. Or you can also use the File Chooser button to open the directory where you have stored all the movies.
Once you have pointed to where the movies are stored on your drive, you just have to hit the Enter button. It will load up the JavaFX tableview with the details of each movie at the pointed location.
The JavaFX tableview shows the following details about each movie:
- Movie name
- IMDB Rating
- Year of release
- Plot of the movie
Awards the movie received
Here is what we see.
The Movie Right Now application contains a Tab pane window. I have also included an option to do the manual entry of movies. This is helpful when you want to search for movie details one by one. Especially, when you are going to watch the movies by online streaming.
Here is what the Manual entry Pane looks like.
You have to enter the Movie name. You may also optionally specify the Year of release. It helps in case two movies have the same name. So you can just get the details of the movie by specifying it’s release year.
Then just hit the Enter button, and you should see something like this.
The Movie Right Now application makes it easy for movie lovers like me to save up a lot of time. It provides an effortless way to compare different movies and get details of any movie. It is fast and simple.
The underlying script calls the OMDB API, which in turn returns a JSON response. I parse the JSON response and build up the JavaFX tableview. I have also written an article on How to build a JavaFX tableview using JSON data received from an API.
Download Code of Movie Right Now
In case you want to download and run my code, you need to follow these steps.
- Visit the Patreon page and become a Patron(the minimum amount you need to pay to use this API is 1$/month).
- Get the API key
- Open the Controller class of the code of Movie Right Now.
- Enter your API key in OMDB_API_KEY variable
- Compile and Run the Application.
Here is the Movie Right Now Github repository from where you can download the code.
I hope you find this little utility helpful. I am regularly learning new technologies so that I can improve upon these applications. It would be fun to add new features and make it more useful. If you liked my work, you may also view one of my other application for Accountancy use. So that is all for now. I will show you some more work of mine very soon. Thank you for reading, please leave a comment.