Giter Club home page Giter Club logo

notion-imdb-movielist-update's Introduction

Notion-IMDB Movie List Update

Notion-IMDB Movie List Update is a Python script that automizes updating ones movie database with information gathered from IMDB.

It checks a specific table and fills in the empty cells using the information on IMDB.

This is a project that I am developing to learn Python, environments, and APIs. Feel free to comment on the project about anything (structure, design, implementation, etc.).

Before Installation

Cloning the code

Clone the repository using git clone.

git clone https://github.com/tuzumkuru/notion-imdb-movielist-update.git

Setting up your Notion

Go to https://www.notion.so/my-integrations page and create an internal integration with Read and Update capabilities.

Duplicate this page (https://www.notion.so/tuzumkuru/819881b338594c6e9efa4902a6dcd37b) to your workspace and connect your integration with your page.

To add the connection after duplicating click on the ... on the top right corner of your page and hover on Add Connections and select the integration you created.

Environmental Variables

NOTION_DATABASE_URL is the URL of your page. You can copy it from the address bar of your browser when the page is open.

NOTION_TOKEN is the token you will get from your Notion application. Copy the Internal Integration Token after NOTION_TOKEN= without any trailing or leading spaces.

NOTION_DATABASE_NAME is the database name you use to store your movie files. It is not necessary if you provide NOTION_DATABASE_URL

Running as a Python script

Setting up an Environment

Setting up a Python environment is like giving your project its own little cozy space to live in. It's important because different projects might need different versions of Python or specific libraries, and environments help keep everything organized.

I prefer using venv for Python environment management.

You can install venv as below or look at the documentation of the tool:

sudo apt install python3.11-venv # You should use the appropriate version for your Python

Create an environment using venv in the project folder:

python -m venv .venv

Python venv will create an environment that you can use isolated from the system.

To use the environment source the activate file:

source .venv/bin/activate

Installing the dependencies

Now, you can install the dependencies using the requirements.txt:

pip install -r requirements.txt

Setting up .env File

There is a .env_example file created as a template to hold some user-specific values

Rename or copy it as .env and add your specific values.

You can find more information about these variables here

Running the Script

After finishing the installation steps you can run the script with the following command:

python main.py

The script will search the database for missing director or duration properties and when found will try to find the movie from the IMDB database using Cinemagoers. If IMDB URL is provided it will look through the Movie ID and find an exact result if the URL is correct. If not provided, it will search IMDB with the name provided and check for the exact name match. So providing name may give wrong results.

You can create recurring tasks to run the script in a determined interval.

Running in a Docker container

This project can be containerized using Docker. Follow the steps below to run it as a Docker container.

Prerequisites

Make sure you have Docker installed on your machine (Docker Installation Guide) and you succesfully cloned the repository.

Build Docker Image

Enter the directory cloned and run the following command

docker build -t tuzumkuru:notion-imdb-movielist-update .

Running Docker Container

Replace your_token and your_database_url or your_database_name with your actual values.

docker run -d --name movielist_update -e NOTION_DATABASE_URL=your-database-url -e NOTION_TOKEN=your-token -e NOTION_DATABASE_NAME=your-database-name tuzumkuru:notion-imdb-movielist-update

Alternatively you can pass a .env file that contains the variables.

docker run -d --name movielist_update --env-file .env tuzumkuru:notion-imdb-movielist-update

Contributing

Issues & Pull requests are welcome.

Future Work

The script would be better if it is triggered through a new entry event from Notion.

Will test the script and make it work on different architectures and OSs.

Acknowledgments

This readme file is created using a template from https://www.makeareadme.com

Thanks to @ramnes for Notion Python SDK (https://github.com/ramnes/notion-sdk-py)

Thanks to the Cinemagoer team (https://github.com/cinemagoer)

Thanks to Notion and IMDB

License

MIT

notion-imdb-movielist-update's People

Contributors

tuzumkuru avatar

Stargazers

 avatar

Watchers

 avatar

notion-imdb-movielist-update's Issues

Error

when I use the script, this error gets to me.
Traceback (most recent call last):
File "C:\Users\amir talaat\Desktop\notion\notion watchlist\main.py", line 208, in
DATABASE_ID = get_database_id_from_url(NOTION_DATABASE_URL)
File "C:\Users\amir talaat\Desktop\notion\notion watchlist\main.py", line 179, in get_database_id_from_url
result = re.search(r"notion.so/[^/]+/(\w+)", database_url).group(1)
File "C:\Users\amir talaat\AppData\Local\Programs\Python\Python310\lib\re.py", line 200, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.