# \_meta\_TMDB

TMDb metadata provider (lookups + image URLs).

{% tabs %}
{% tab title="End users" %}

### What this metadata provider does

Uses TMDb to improve matching across providers.

It helps CrossWatch:

* resolve items by TMDb ID
* normalize titles and years
* build poster/backdrop URLs

### Reads from config

Primary keys:

* `tmdb.api_key` (preferred)
* `metadata.tmdb_api_key` (fallback/compat)

Optional keys:

* `metadata.ttl_hours` (cache TTL)

### External endpoints

* `https://api.themoviedb.org/3`
* `https://image.tmdb.org/t/p`

### Related docs

* UI setup: [Meta: TMDb](/crosswatch/providers/metadata/meta-tmdb.md)

### Gotchas

* Cache is in-memory. Restarts flush it.
* If lookups are slow, you’re probably hitting rate limits.
  {% endtab %}

{% tab title="Power users" %}

### Code map

* `providers/metadata/_meta_TMDB.py`

### Public surface

* class: `TmdbProvider`
* functions: `log()`, `build()`, `html()`

### Key constants

* `IMG_BASE` = `https://image.tmdb.org/t/p`

### External endpoints

* `https://api.themoviedb.org/3`
* `https://image.tmdb.org/t/p`
* `https://www.themoviedb.org/settings/api`

### How it works (high level)

```mermaid
flowchart LR
  A[Caller] -->|lookup/search| M[TMDb metadata provider]
  M -->|GET| TMDB[api.themoviedb.org]
  M -->|cache TTL| C[In-memory cache]
  M --> A
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.crosswatch.app/blueprint-architecture/meta/_meta_tmdb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
