Bash script that uploads the IMDb Watchlist data to influxdb on a daily basis
-
Configure
imdb_exporter.conf
(see the configuration section below). -
Run it.
docker compose up --detach
-
Build the docker image.
docker build . --tag imdb-exporter
-
Configure
imdb_exporter.conf
(see the configuration section below). -
Run it.
docker run --rm --init --tty --interactive --volume $(pwd):/app localhost/imdb-exporter
For convenience, you can install this exporter with the following command or follow the manual process described in the next paragraph.
make install
$EDITOR $HOME/.config/imdb_exporter.conf
-
Copy
imdb_exporter.sh
to$HOME/.local/bin/
and make it executable. -
Copy
imdb_exporter.conf
to$HOME/.config/
, configure it (see the configuration section below) and make it read only. -
Copy the systemd unit and timer to
$HOME/.config/systemd/user/
:cp imdb-exporter.* $HOME/.config/systemd/user/
-
and run the following command to activate the timer:
systemctl --user enable --now imdb-exporter.timer
It's possible to trigger the execution by running manually:
systemctl --user start imdb-exporter.service
The config file has a few options:
INFLUXDB_HOST='influxdb.example.com'
INFLUXDB_API_TOKEN='ZXhhbXBsZXRva2VuZXhhcXdzZGFzZGptcW9kcXdvZGptcXdvZHF3b2RqbXF3ZHFhc2RhCg=='
ORG='home'
BUCKET='imdb'
IMDB_WATCHLIST_ID='ls000111111'
INFLUXDB_HOST
should be the FQDN of the influxdb server.ORG
should be the name of the influxdb organization that contains the IMDb data bucket defined below.BUCKET
should be the name of the influxdb bucket that will hold the IMDb data.INFLUXDB_API_TOKEN
should be the influxdb API token value.- This token should have write access to the
BUCKET
defined above.
- This token should have write access to the
IMDB_WATCHLIST_ID
should be the imdb watchlist ID value.- This ID can be retrieved from the "Export this list" link displayed at the bottom of the watchlist page on IMDb.
Run the script manually with bash set to trace:
bash -x $HOME/.local/bin/imdb_exporter.sh
Check the systemd service logs and timer info with:
journalctl --user --unit imdb-exporter.service
systemctl --user list-timers
- imdb_stats: Watchlist item metadata
imdb_stats,title_type=movie,genres=Action\ Adventure\ Biography\ Drama\ History\ War,year=2023 position=697,imdb_id="tt13287846",title="Napoleon",imdb_rating=6.5,runtime_mins=158,imdb_votes=89277,release_date="2023-11-14",directors="Ridley Scott" 1705190400
In imdb-dashboard.json
there is an example of the kind of dashboard that can be built with imdb-exporter
data:
Import it by doing the following:
- Create a dashboard
- Click the dashboard's settings button on the top right.
- Go to JSON Model and then paste there the content of the
imdb-dashboard.json
file.
For convenience, you can uninstall this exporter with the following command or follow the process described in the next paragraph.
make uninstall
Run the following command to deactivate the timer:
systemctl --user disable --now imdb-exporter.timer
Delete the following files:
~/.local/bin/imdb_exporter.sh
~/.config/imdb_exporter.conf
~/.config/systemd/user/imdb-exporter.timer
~/.config/systemd/user/imdb-exporter.service