<?php
require_once __DIR__ . '/../includes/nowplaying_lib.php';
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
$title = trim((string)smurf_fetch_nowplaying_title());
if ($title === '') {
    $title = 'Unable to fetch stream info.';
}
echo json_encode(['title' => $title], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
