Sign inSign up

waazaafr/sonarr-metadata-localizer

By waazaafr

Updated 7 months ago

Docker image that updates Sonarr-generated NFO files using TMDb localized metadata (title/overview).

Image
0

2.6K

waazaafr/sonarr-metadata-localizer repository overview

sonarr-metadata-localizer

Docker image that updates Sonarr-generated NFO files using TMDb localized metadata (title/overview), and can optionally download series artwork in Jellyfin-friendly filenames.

What it does

  • Scans a root directory (or a single series directory) and detects series folders by the presence of tvshow.nfo.
  • Extracts the TMDb TV ID from tvshow.nfo (<uniqueid type="tmdb"> and a few fallback tags are supported).
  • Updates:
    • tvshow.nfo: <plot> (and optionally <title>).
    • episode .nfo files: <title> and <plot> when the episode number can be parsed from the filename.
  • Creates a one-time backup next to each modified file: *.bak.
  • Optional: downloads best-matching TMDb images into the series folder:
    • poster/cover (same image, w500)
    • backdrop (original)
    • logo (original)
  • Supports --dry-run to preview changes without writing or downloading anything.

Variables

VariableDefaultRequiredDescription
TMDB_API_KEY""Yes (or Bearer)TMDb v3 API key from themoviedb.org.
TMDB_BEARER_TOKEN""Yes (or API key)Alternative: TMDb Bearer token (same quota).
TMDB_LANGUAGEfr-FRNoText language for TMDb (e.g. fr-FR, en-US, es-ES).
TMDB_IMAGE_LANGUAGEfr,nullNoImage language preference (e.g. fr,null, en,fr,null).
DOWNLOAD_IMAGEStrueNoEnable/disable image downloads (series + episodes).
SKIP_EMPTYtrueNoSkip TMDb empty text (don't overwrite existing plots).
UPDATE_SHOW_TITLEfalseNoUpdate tvshow.nfo with TMDb series name.
SERIES_COVER_NAMEcover.jpgNoSeries portrait image filename (Jellyfin).
SERIES_POSTER_NAMEposter.jpgNoSeries poster image (copy of cover).
SERIES_BACKDROP_NAMEbackdrop.jpgNoSeries backdrop image filename.
SERIES_LOGO_NAMElogo.pngNoSeries logo image filename (if available).
SLEEP_BETWEEN_REQUESTS0.25NoSeconds between TMDb requests (respect rate limits).
HTTP_TIMEOUT25NoHTTP request timeout (seconds).

Webhook Variables

VariableDefaultRequiredDescription
PORT8787NoHTTP listen port.
NFO_SCRIPT/app/nfo_jellyfin.pyNoPath to NFO processing script.
AUTH_TOKEN""NoOptional X-Auth-Token header for webhook auth.
ALLOWED_EVENT_TYPESDownload,Upgrade,Rename,SeriesAdd,SeriesEditNoComma-separated Sonarr events to process.
WORKERS4NoConcurrent worker threads.
QUEUE_MAX500NoMaximum queued jobs.
DRY_RUNfalseNoLog changes without writing files/images.
WAIT_FOR_TVSHOWNFO_SECONDS60NoWait for tvshow.nfo (SeriesAdd/Edit).
WAIT_POLL_INTERVAL2NoPoll interval when waiting (seconds).
MAX_RETRIES3NoRetry attempts for missing tvshow.nfo.
RETRY_BACKOFF_SECONDS20NoBackoff between retries.
LOG_LEVELINFONoDEBUG, INFO, WARNING, ERROR.

Settings a webhook on Sonarr

To work reactively via a Sonarr webhook (on events like Download, Upgrade, Rename, SeriesAdd, SeriesEdit) you must add a Connect > Webhook. Select options you need and set the url : http://>:8787/sonarr

You must also set the VARIABLE AUTH_TOKEN and add a variable header on the webhook settings: X-Auth-Token with value the AUTH_TOKEN

Run with docker compose

services:
  sonarr-metadata-localizer:
    image: waazaafr/sonarr-metadata-localizer:latest
    container_name: sonarr-metadata-localizer
    hostname: sonarr-metadata-localizer
    ports:
      - "8787:8787"
    environment:
      TMDB_API_KEY: "27cXXXXYYYY88c"
      AUTH_TOKEN: "supersecretforwebhookaccess"
      TMDB_LANGUAGE: "fr-FR"
      TMDB_IMAGE_LANGUAGE: "fr,null"
      SONARR_ROOT_FOLDER: "/tv"
      CRON_CHECK_INTERVAL: "0 6 * * *"
      CRON_BAK_CLEANUP: "15 3 * * *"
    volumes:
      # IMPORTANT: must match Sonarr's series path inside Sonarr (e.g. /tv) and SONARR_ROOT_FOLDER
      - /yout/series/folder/:/tv:rw
    restart: unless-stopped

CRON_CHECK_INTERVAL: when the proactive scan is done

CRON_BAK_CLEANUP: when cleanup of .bak files is done

=======================================================================

Source: https://codeberg.org/waazaa/sonarr-metadata-localizer

=======================================================================

Feel free to join me on https://discord.gg/p9xkjEw8ts⁠⁠

If you like this, consider buing me a coffee:

https://buymeacoffee.com/waazaa⁠⁠

https://ko-fi.com/waazaa

If you need an UnRAID license follow this link: https://unraid.net/pricing?via=4c3f80⁠⁠

Tag summary

Content type

Image

Digest

sha256:872d78769

Size

55.2 MB

Last updated

7 months ago

docker pull waazaafr/sonarr-metadata-localizer