Interceptarr is a simple Flask-based web application specifically designed to send notifications for new episodes of continuing series in Sonarr. This is done by fetching "On Import" webhooks from Sonarr and forwarding them to a user-defined Discord webhook URL. The script listens for webhooks from Sonarr, processes the data, and if the release date of the episode is less than a week old, it forwards the message to the specified Discord webhook.
- Listens for webhook events from Sonarr and processes incoming data.
- Fetches and parses data from TVDB to extract episode air dates.
- Forwards processed data to a Discord webhook if the episode is less than a week old.
- Logs all events and errors to the endpoint
/logs
and saves tointerceptarr_logs.txt
.
- Python 3.7+
Flask
libraryrequests
librarybeautifulsoup4
librarypython-dotenv
library
Create a '.env' file in the same directory as the script with the following variables:
- DISCORD_WEBHOOK_URL: The Discord webhook URL where notifications for new episodes will be sent.
- DISCORD_OVERRIDE_WEBHOOK_URL: Optionally assign a Discord webhook URL where warning messages will be sent if the original embed data from Sonarr is overwritten with new data from TVDB. (Leave this blank unless "Episode Title Required" is set to "Never" in your Sonarr settings.)
- SHOW_EPISODE_THUMBNAIL: Optionally replace the generic show thumbnail with the episode thumbnail.
- WEBHOOK_HOST: The IP address or hostname the Flask app will bind to.
- WEBHOOK_PORT: The port the Flask app will listen on.
To integrate Interceptarr with Sonarr, create a new connection in Sonarr with only the "On Import" notification trigger checked, and set the connection's webhook URL to point to the IP address and port where Interceptarr is running. (e.g., 'http://10.0.0.1:8700')
-
Clone the repository:
git clone https://github.com/joobert/interceptarr.git cd interceptarr
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.env
file with the following content:DISCORD_WEBHOOK_URL=your_webhook_url DISCORD_OVERRIDE_WEBHOOK_URL=your_alt_webhook_url SHOW_EPISODE_THUMBNAIL=True WEBHOOK_HOST=your_host_ip WEBHOOK_PORT=8700
-
Run the application:
python interceptarr.py
-
Clone the repository:
git clone https://github.com/joobert/interceptarr.git cd interceptarr
-
Create a
.env
file with the following content:DISCORD_WEBHOOK_URL=your_webhook_url DISCORD_OVERRIDE_WEBHOOK_URL=your_alt_webhook_url SHOW_EPISODE_THUMBNAIL=True WEBHOOK_HOST=your_host_ip WEBHOOK_PORT=8700
-
Ensure that the port configurations in both the
compose.yml
andDockerfile
match the port specified in your.env
file (WEBHOOK_PORT
). By default, it should be set to8700
. Adjust the port settings in these files if necessary. -
Create an empty
interceptarr_logs.txt
file:touch interceptarr_logs.txt
-
Start the service with Docker Compose:
docker compose up -d
Once the script or container is running, the application will be listening for webhook events on the specified IP address and port.
- Webhook Listener: The application listens for POST requests at the root endpoint
/
and processes incoming webhook data. - Logging: All events and errors are logged to the endpoint
/logs
and saved tointerceptarr_logs.txt
.
Contributions are welcome! Please feel free to submit a Pull Request or open an Issue.