Sign inSign up

waazaafr/sonarr-metadata-localizer

By waazaafr

โ€ขUpdated 1 day ago

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

Image
0

3.2K

waazaafr/sonarr-metadata-localizer repository overview

โ Sonarr Metadata Localizer

Translate the metadata of your TV shows into your language, for Jellyfin.

Sonarr writes its NFO files in English. This image rewrites the titles and plots of your series and episodes with localized metadata from TMDbโ , and can download localized artwork (poster, backdrop, logo, episode thumbnails) with Jellyfin-friendly file names.

It works instantly through a Sonarr webhook, and with a scheduled scan of your whole library as a safety net.


โ Features

  • ๐ŸŒ Localized series plot, episode titles and plots from TMDb, in the language of your choice
  • ๐Ÿ–ผ๏ธ Localized artwork: poster, cover, backdrop, logo and episode thumbnails
  • โšก Sonarr webhook: a series is updated as soon as an episode is imported or renamed
  • ๐Ÿงบ Events are grouped: importing a full season triggers a single update of the series
  • ๐Ÿ•’ Scheduled scan of the whole library
  • ๐Ÿ’พ Backup of every modified NFO (.bak), cleaned up automatically after 7 days
  • ๐Ÿงช Dry-run mode to preview changes
  • ๐Ÿ–ฅ๏ธ Multi-arch: linux/amd64 and linux/arm64

โ How it works

  1. A series folder is detected by its tvshow.nfo, which provides the TMDb ID of the series.
  2. The app fetches the localized metadata from TMDb and updates:
    • tvshow.nfo: the plot, and optionally the title;
    • each episode .nfo: the title and plot, when the episode number can be read from the file name (S01E02, 1x02).
  3. Before a file is modified for the first time, the original is kept next to it (*.bak).
  4. If enabled, artwork is downloaded into the series folder:
FileContent
cover.jpg / poster.jpgSeries poster (same image)
backdrop.jpgSeries background
logo.pngSeries logo, if available
<episode>-thumb.jpgEpisode thumbnail, next to its .nfo

Images that were already downloaded are not downloaded again (tracked in .tmdb-art-state.json in each series folder).


โ Quick start

You need a free TMDb API key: themoviedb.org/settings/apiโ .

services:
  sonarr-metadata-localizer:
    image: waazaafr/sonarr-metadata-localizer:latest
    container_name: sonarr-metadata-localizer
    restart: unless-stopped
    ports:
      - "8787:8787"
    environment:
      TZ: "Europe/Paris"
      TMDB_API_KEY: "your-tmdb-api-key"
      AUTH_TOKEN: "a-long-random-secret"
      TMDB_LANGUAGE: "fr-FR"
      TMDB_IMAGE_LANGUAGE: "fr,null"
      SONARR_ROOT_FOLDER: "/tv"
    volumes:
      # Must be the SAME path as your series folder inside Sonarr (e.g. /tv)
      - /your/series/folder:/tv:rw

โš ๏ธ The series path must be identical in Sonarr and in this container. The webhook receives the series path as Sonarr sees it (e.g. /tv/My Show), and looks for it inside this container.


โ Sonarr webhook

In Sonarr, go to Settings โ†’ Connect โ†’ + โ†’ Webhook:

FieldValue
TriggersOn Import, On Upgrade, On Rename, On Series Add
URLhttp://<container-ip>:8787/sonarr
MethodPOST
HeadersX-Auth-Token = the value of AUTH_TOKEN

Click Test: Sonarr should report a success.

๐Ÿ” Set AUTH_TOKEN and the X-Auth-Token header: without AUTH_TOKEN, anyone who can reach the port can trigger the webhook.

What happens when Sonarr calls the webhook:

  • Events of the same series are grouped for DEBOUNCE_SECONDS (30 s): importing a full season updates the series once.
  • The app waits for Sonarr to write tvshow.nfo and the .nfo of the imported episodes before updating them.
  • Upgrades are sent by Sonarr as Download events, so they are handled too.
  • On Series Add is ignored when Sonarr has not created the series folder yet: the series is handled at its first import.

A health endpoint is available at http://<container-ip>:8787/health.


โ Configuration

โ TMDb & metadata
VariableDefaultDescription
TMDB_API_KEYโ€”Required (or TMDB_BEARER_TOKEN): TMDb v3 API key
TMDB_BEARER_TOKENโ€”Alternative to the API key: TMDb read access token
TMDB_LANGUAGEfr-FRLanguage of titles and plots (fr-FR, en-US, es-ESโ€ฆ)
TMDB_IMAGE_LANGUAGEfr,nullPreferred image languages, in order (null = images without text)
SKIP_EMPTYtrueKeep the existing text when TMDb has no translation
UPDATE_SHOW_TITLEfalseAlso replace the series title in tvshow.nfo
SLEEP_BETWEEN_REQUESTS0.25Pause between TMDb requests, in seconds
HTTP_TIMEOUT25Timeout of HTTP requests, in seconds
โ Artwork
VariableDefaultDescription
DOWNLOAD_IMAGEStrueDownload series artwork and episode thumbnails
SERIES_COVER_NAMEcover.jpgFile name of the series poster
SERIES_POSTER_NAMEposter.jpgFile name of the copy of the poster
SERIES_BACKDROP_NAMEbackdrop.jpgFile name of the background
SERIES_LOGO_NAMElogo.pngFile name of the logo
โ Scheduled tasks
VariableDefaultDescription
SONARR_ROOT_FOLDER/tvRoot folder of your series inside the container
CRON_CHECK_INTERVAL0 */8 * * *When the whole library is scanned (cron syntax)
CRON_BAK_CLEANUP15 4 * * *When .bak files older than 7 days are deleted (cron syntax)
TZEurope/ParisTime zone used by the schedules

A scan never starts while the previous one is still running.

โ Webhook
VariableDefaultDescription
PORT8787Listening port
AUTH_TOKENโ€”Secret expected in the X-Auth-Token header (recommended)
ALLOWED_EVENT_TYPESDownload,Rename,SeriesAddSonarr events that trigger an update
DEBOUNCE_SECONDS30Delay used to group the events of a same series
WAIT_FOR_EPISODE_NFO_SECONDS120How long to wait for Sonarr to write the .nfo of imported episodes
WAIT_FOR_TVSHOWNFO_SECONDS60How long to wait for Sonarr to write tvshow.nfo
WAIT_POLL_INTERVAL2Check interval while waiting, in seconds
MAX_RETRIES3Retries when tvshow.nfo is still missing
RETRY_BACKOFF_SECONDS20Delay between retries, increased at each retry
WORKERS4Number of series processed in parallel
QUEUE_MAX500Maximum number of series waiting to be processed
DRY_RUNfalseLog the changes without writing any file (webhook only)
LOG_LEVELINFODEBUG, INFO, WARNING or ERROR

โ Changelog

โ 1.1.0 โ€” 2026-10-22
  • Multi-arch image: linux/amd64 and linux/arm64.
  • Webhook: events of a same series are grouped (DEBOUNCE_SECONDS), so a season import updates the series once instead of once per episode.
  • Webhook: waits for the .nfo of imported episodes (WAIT_FOR_EPISODE_NFO_SECONDS), which Sonarr may write after calling the webhook.
  • Webhook: Sonarr's Test always succeeds; On Series Add no longer fails when the series folder does not exist yet.
  • Webhook: retries no longer block a worker.
  • ALLOWED_EVENT_TYPES now defaults to Download,Rename,SeriesAdd (Upgrade and SeriesEdit are not sent by Sonarr; upgrades arrive as Download).
  • The original NFO is now really backed up to .bak before the first change.
  • The webhook and the scheduled scan can no longer update the same series at the same time, and scans can no longer overlap.
  • Episode files with 4-digit seasons (S2024E05) are now recognized.
โ 1.0.1 โ€” 2026-02-24
โ 1.0.0 โ€” 2026-02-23
  • First releases.

Tag summary

Content type

Image

Digest

sha256:c7a45d962โ€ฆ

Size

61.4 MB

Last updated

1 day ago

docker pull waazaafr/sonarr-metadata-localizer