Skip to content

Using Radarr with MediaTracker Api using Custom lists

I have been using Radarr for some time, for managing my movies library. Recently, Trakt.tv limited maximum items in watchlists.

This caused my Trakt + Radarr setup to fail. So, in my search for alternatives, I found this gem, MediaTracker.

However, I faced a strange bug while adding MediaTracker watchlist in Radarr.

The movie I added in Mediatracker was "A Glitch in the Matrix" while movie that was added in Radarr was "Chocolat".

What was the cause of this issue?

This is the output of MediaTracker Api

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[
  {
    "id": 392,
    "listedAt": "2025-02-25T07:01:52.702Z",
    "type": "movie",
    "mediaItem": {
      "airedEpisodesCount": null,
      "backdrop": "/img/8ee1da0b01055661c36e969f87985379",
      "genres": [
        "Documentary"
      ],
      "id": 55,
      "imdbId": "tt9847360",
      "lastTimeUpdated": 1740462654022,
      "mediaType": "movie",
      "network": null,
      "overview": "Are we in fact living in a simulation? This is the question postulated, wrestled with, and ultimately argued for through archival footage, compelling interviews with real people shrouded in digital avatars, and a collection of cases from some of our most iconoclastic figures in contemporary culture.",
      "poster": "/img/930668df89f7cb5bc7dc6767933ffdbd",
      "posterSmall": "/img/930668df89f7cb5bc7dc6767933ffdbd?size=small",
      "releaseDate": "2021-02-05",
      "runtime": 108,
      "source": "tmdb",
      "progress": null,
      "status": "released",
      "title": "A Glitch in the Matrix",
      "tmdbId": 696109,
      "traktId": null,
      "tvdbId": null,
      "url": "https://www.aglitchinthematrixfilm.com/",
      "lastSeenAt": null,https://www.imdb.com/title/tt0241303ll,
      "onWatchlist": true
    }
  }
]

Here, the id field in MediaTrack Api Json for 'A Glitch in the Matrix' is parsed as tmdb_id in Radarr. And, this id (392) is tmdb_id for 'Chocolat' movie.

How to solve this issue?

Make calls from radarr to the following PHP script. It transforms MediaTracker Api Json and produce the desired Json output in Radarr compatible format.

PHP
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

$queryParams = $_GET;

if (empty($queryParams)) {
    http_response_code(400);
    echo json_encode(["error" => "No query parameters provided"]);
    exit;
}

$url = "http://127.0.0.1:8089/api/items?" . http_build_query($queryParams);

$response = @file_get_contents($url);

if ($response === false) {
    http_response_code(500);
    echo json_encode(["error" => "Failed to fetch data from API"]);
    exit;
}

$data = json_decode($response, true);

if (json_last_error() !== JSON_ERROR_NONE || !is_array($data)) {
    http_response_code(500);
    echo json_encode(["error" => "Invalid JSON data"]);
    exit;
}

$filteredData = array_values(array_filter(array_map(function ($item) {
    return [
        "id" => $item["tmdbId"] ?? null,
        "title" => $item["title"] ?? null,
        "imdb_id" => $item["imdbId"] ?? null,
        "tmdb_id" => $item["tmdbId"] ?? null
    ];
}, $data)));

header('Content-Type: application/json');
echo json_encode($filteredData, JSON_PRETTY_PRINT);