Package: imgdb
Imgdb - a command line IMDb search appThis is a Python command line application that allows the user to get
IMDb information about a particular title as well as downloading its
corresponding poster.IntroductionImgdbis a play on theIMDbacronym. Since the application can also
download movie posters, I added thegtoIMDbto get a name that is
both closer toIMDbwhile also representing one of the main application's
functionalities at the same time.
The idea behindImgdbis to create a simple command line application that
fetches information about a specific title (e.g., a movie or series) from IMDb
as well as RottenTomatoes.The application makes use of the freely availableIMDb datasetsto extract the required information (e.g., genres, title, rating, etc).
To achieve that,Imgdbalso usesGoogle Custom Search APIto make
sure the entered title is exactly what the user is looking for.Imgdbis also capable of doing some fancy stuff by leveraging the power ofImageMagickto
generate an image containing the movie's or series' ratings like so:RequirementsPython dependenciesbeautifulsoup4clickpandasPyYAMLtqdmWandSystem dependenciesImageMagickIn order to use the image editing option, you should haveImageMagickinstalled on you system.
Please, use your distribution's package manager to install it.InstallationThe easiest way to installImgdbis to usepip:pip install imgdbConfigurationThe application is configured using ayamlconfiguration file that resides
in yourXDG_CONFIG_HOMEdirectory. After running the application for the first
time, it will create an initial configuration file (imgdb.yaml) in the$HOME/.config/imgdbdirectory.Theimgdb.yamlfile should have the following structure:general:download:true | falseimage editing:true | falsefont:<font name>log file path:<path/to/log/file.log>update frequency:daily | weekly | bi-weekly | 1d (for 1 day) | 1h (for 1 hour) | etcinterface:api:google search api key:<google API key>imdb custom search id:<custom IMDb search engine ID>You can refer toimgdb_config_template.yamlfor an example
configuration file.UsageUsage: imgdb [OPTIONS]

Options:
    --mov TEXT      The title of the movie.
    --tv TEXT       The title of the series.
    --tvmini TEXT   The title of the mini series.
    --debug TEXT    The logging level of the application.
    --logfile TEXT  The path of the log file.
    --freq TEXT     The update frequency of the datasets.
    --font TEXT     The font used to generate the rating image.
    -d              Download the movie's poster image.
    -e              Save the edited image containing the movie's ratings.
    --help          Show this message and exit.When you run the application for the first time, it will attempt to download
the required IMDb datasets fromimdb.com/interfaces.
You can think of them as daily snapshot of the huge IMDb database.
The application needs these datasets in order to extract and display information
about a specific movie or series.
I opted for this solution because it allowsImgdbto fetch almost all the information
from the datasets that are stored on the user's computer.
This makes the application more reliable as opposed to scraping for example.These datasets are automatically updated on a weekly basis by default. However, you can
always change the automatic update frequency by using the--freqoption as documented
above. In most cases, you don't really need to update them very frequently. Aweeklyor
even abi-weeklyupdate interval should suffice.To use the application, you also need a Google API key as well as an IMDb custom search
engine ID.
You can refer to the relevantGoogle documentationfor more information on how to get and use an API key.
For creating an IMDb custom search engine (Google), you can refer to thislink.Once you have the application set up properly, you can invoke it like so:imgdb --mov "The Dark Knight" -deThe above command will display the following information in your terminal:Title: The Dark Knight
Genres: Action, Crime, Drama
Year: 2008
Runtime: 152 min
IMDb Rating: 9.0
RottenTomatoes Rating: 94
Description: The Dark Knight: Directed by Christopher Nolan. With 
             Christian Bale, Heath Ledger, Aaron Eckhart, Michael 
             Caine. When the menace known as the Joker wreaks havoc 
             and chaos on the people of Gotham, Batman must accept 
             one of the greatest psychological and physical tests 
             of his ability to fight injustice.
➜ Downloading: The_Dark_Knight.jpg - Size: 274 KiB

100%|██████████████████████████████████| 281k/281k [00:00<00:00, 3.15MiB/s]
Edited image saved as: The_Dark_Knight_by_imgdb.pngIt will also download the movie's poster (The_Dark_Knight.jpg) and save it in the current directory.
TheThe_Dark_Knight_by_imgdb.pngrating image will look something like this:For optimal results, you should use a good design font likeMalerwhich is
the default font of the application that was used in the image above.To get a list of installed fonts that can be used with the application, you can issue
this command:convert -list fontTODOAdd multi result search optionAdd API-less search optionAdd JSON output