Categorygithub.com/flxp49/notion-watchlistarr
repository
0.2.0
Repository: https://github.com/flxp49/notion-watchlistarr.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

notion-watchlistarr

Download media (via Radarr & Sonarr) directly from watchlist on Notion.

Prerequisites

  • Notion Integration

  • Radarr

  • Sonarr

  • The script requires the following properties to exist in the user's watchlist database on Notion

    Property Name (CASE SENSITIVE)Property TypeValue
    IMDb IDTextIMDb id of series/movie
    TypeSelectTV Series or Movie
  • Radarr Webhook (To be setup after running the app)

    • Navigate to Connect under Radarr Settings
    • Add a new connection and choose Webhook
    • Subscribe to the following:
      • On Grab
      • On Import
      • On Movie Added
      • On Movie Delete
      • On Movie File Delete
    • Set Webhook URL as http://localhost:PORT/radarr where PORT is whatever is set by the user.
    • Set Method as POST
    • Click Save
  • Sonarr Webhook (To be setup after running the app)

    • Navigate to Connect under Sonarr Settings
    • Add a new connection and choose Webhook
    • Subscribe to the following:
      • On Grab
      • On Import
      • On Series Add
      • On Series Delete
    • Set Webhook URL as http://localhost:PORT/sonarr where PORT is whatever is set by the user.
    • Set Method as POST
    • Click Save

Configuration

There are 2 ways to run Notion Watchlistarr.

  • Executable
  • Docker

Executable

NOTE Depending upon the location of the exe, you may need to run it as administator

The executable requires a .env file in the same directory from which it reads the following values:

EnvValueDefault
PORTPort No to listen on7879
RADARR_INITEnable Radarr Sync: false - Disable true - Enabletrue
SONARR_INITEnable Sonarr Sync: false - Disable true - Enabletrue
LOG_DEBUGfalse or truefalse
NOTION_INTEGRATION_SECRETNotion Integration SecretNA
NOTION_DB_IDDatabase id (found in the URL of the database page)NA
RADARR_HOSTRadarr Host. Ex: http://localhost:7878NA
RADARR_KEYRadarr API keyNA
RADARR_DEFAULT_ROOT_PATHEx: D:/Media/MoviesIf not provided, will set the first root path fetched from Radarr as default
RADARR_DEFAULT_MONITORMovie monitor profile, possible values: MovieOnly MovieandCollectionMovieOnly
RADARR_DEFAULT_QUALITY_PROFILEEx: HD-1080pIf not provided, will set the first profile fetched from Radarr as default
SONARR_HOSTSonarr Host. Ex: http://localhost:8989NA
SONARR_KEYSonarr API keyNA
SONARR_DEFAULT_ROOT_PATHEx: D:/Media/ShowsIf not provided, will set the first root path fetched from Sonarr as default
SONARR_DEFAULT_MONITORTV monitor profile, possible values: AllEpisodes FutureEpisodes MissingEpisodes ExistingEpisodes RecentEpisodes PilotEpisode FirstSeason LastSeason MonitorSpecials UnmonitorSpecials NoneAllEpisodes
SONARR_DEFAULT_QUALITY_PROFILEEx: HD-1080pIf not provided, will set the first profile fetched from Sonarr as default
POLL_INTERVAL_SECDuration (Seconds) Interval between each query to database for downloading10
WATCHLIST_SYNC_INTERVAL_HOURDuration (Hours) Interval to sync media in Radarr and Sonarr library with watchlist12

Docker

docker build --rm -t notionwatchlistarr .

Env variables can be setup while spinning up the docker image. The user can either set them via CLI individually or pass an env file.
env file is the same as the one specified above (Executable Section) EXCLUDING PORT. PORT = 7879.

docker run --env-file D:/path/to/env-file/.env -d -p XXXX:7879 notionwatchlistarr

NOTE the host for radarr and sonarr may have to be http://host.docker.internal:XXXX instead of http://localhost:XXXX

Usage

The app on launch adds the following properties with values to the Notion database.

Property NameProperty Type
DownloadCheckbox
Download StatusSelect
Quality ProfileSelect
Root FolderSelect
MonitorSelect
  • Quality Profile is populated with the quality profiles fetched from Radarr and Sonarr as options.
  • Root Folder is populated with the root paths fetched from Radarr and Sonarr as options.
  • Monitor is populated with the following options:
    TV Series: All Episodes
    TV Series: Future Episodes
    TV Series: Missing Episodes
    TV Series: Existing Episodes
    TV Series: Recent Episodes
    TV Series: PilotEpisode
    TV Series: FirstSeason
    TV Series: Last Season
    TV Series: Monitor Specials
    TV Series: Unmonitor Specials
    Movie: Movie Only
    Movie: Collection

The options for the respective properties can be used to set the Quality Profile, Root Folder and Monitor Profile for the media to download (via Radarr/Sonarr)

Download

To download, Select the required profiles and then 'check' the Download property of the title.
notionwatchlistarr1

Here, if Quality Profile Root Folder Monitor are not chosen before checking Download, the default values will be used instead.
notionwatchlistarr2

When Downloaded, the Download Status is updated with the respective info:
image

The app uses webhooks to sync the status of the media.

Sync

The app runs 2 routines:

  1. Queries the watchlist every POLL_INTERVAL_SEC for downloading media via Radarr/Sonarr
  2. Syncs the existing media in Radarr/Sonarr library with the watchlist every WATCHLIST_SYNC_INTERVAL_HOUR and updates the Download Status accordingly

Logging

  • Executable: On launch, app creates a log file in the same directory as the app. Will output logs in this file according to the log level set in the env file
  • Docker: Logs output to container logs

Limitations

  • Update feature: if a movie/series already exists in the library - updating it is not supported
  • Monitor info on watchlist sync shows up for movies but not series (unless set by the user before downloading)

Developer

go mod download
go run cmd/notionwatchlistarr/main.go