json copying
All checks were successful
🏗️ Build Plugin / build (push) Successful in 22s
Latest Release / latest-release (push) Successful in 28s
🧪 Test Plugin / test (push) Successful in 17s
🚀 Release Plugin / build-and-release (push) Successful in 27s

debugging overlay
This commit is contained in:
Duncan Tourolle 2026-06-12 20:09:36 +02:00
parent abad55788d
commit 4b3b64bd7e
3 changed files with 27 additions and 11 deletions

View File

@ -37,5 +37,6 @@ public class TruthActor
/// Gets the list of [start_sec, end_sec] windows during which the actor is on screen. /// Gets the list of [start_sec, end_sec] windows during which the actor is on screen.
/// </summary> /// </summary>
[JsonPropertyName("scenes")] [JsonPropertyName("scenes")]
[JsonObjectCreationHandling(JsonObjectCreationHandling.Populate)]
public Collection<double[]> Scenes { get; } = new(); public Collection<double[]> Scenes { get; } = new();
} }

View File

@ -37,5 +37,6 @@ public class TruthFile
/// Gets the list of actors detected in the film, each with their on-screen scene windows. /// Gets the list of actors detected in the film, each with their on-screen scene windows.
/// </summary> /// </summary>
[JsonPropertyName("actors")] [JsonPropertyName("actors")]
[JsonObjectCreationHandling(JsonObjectCreationHandling.Populate)]
public Collection<TruthActor> Actors { get; } = new(); public Collection<TruthActor> Actors { get; } = new();
} }

View File

@ -4,9 +4,23 @@
var POLL_INTERVAL_MS = 1000; var POLL_INTERVAL_MS = 1000;
var overlayEl = null; var overlayEl = null;
function getItemIdFromHash() { function getNowPlaying() {
var match = window.location.hash.match(/[?&]id=([0-9a-fA-F-]+)/); if (!window.ApiClient) {
return match ? match[1] : null; return Promise.reject(new Error('no ApiClient'));
}
var url = window.ApiClient.getUrl('Sessions', { DeviceId: window.ApiClient.deviceId() });
return window.ApiClient.ajax({ url: url, type: 'GET', dataType: 'json' }).then(function (sessions) {
var session = sessions && sessions[0];
if (!session || !session.NowPlayingItem || !session.PlayState) {
return null;
}
return {
itemId: session.NowPlayingItem.Id,
positionSeconds: (session.PlayState.PositionTicks || 0) / 10000000
};
});
} }
function removeOverlay() { function removeOverlay() {
@ -72,14 +86,14 @@
}); });
} }
function onPause(event) { function onPause() {
var video = event.target; getNowPlaying().then(function (info) {
var itemId = getItemIdFromHash(); if (info) {
if (!itemId) { fetchContext(info.itemId, info.positionSeconds);
return; }
} }, function () {
// ApiClient unavailable or request error - fail silently, never break playback.
fetchContext(itemId, video.currentTime); });
} }
function onPlay() { function onPlay() {