Prefer cached stills and stream first frames in the grid

This commit is contained in:
Fisto
2026-09-16 13:44:34 +02:00
parent 0081224954
commit 1e064b69d0
3 changed files with 71 additions and 47 deletions
+10 -6
View File
@@ -391,16 +391,20 @@ export class MediaService {
const file = this.getMediaFile(scrapeId, itemId);
if (file) return { kind: "file", ...file };
const item = this.getMediaItem(scrapeId, itemId);
if (!item) return null;
return { kind: "remote", url: item.play_url ?? item.url };
}
/** Re-fetch the source message for a fresh signed URL. Null when not possible. */
async refreshMediaUrl(scrapeId: string, itemId: number): Promise<string | null> {
const meta = this.engine.get(scrapeId);
const item = this.getMediaItem(scrapeId, itemId);
if (!meta || !item) return null;
if (meta.backend !== "slopbot" || !meta.guildId || !this.bot) return null;
if (meta.backend === "slopbot" && meta.guildId && this.bot) {
const refreshed = await this.refreshUrls(meta.id, meta.channelId, item);
if (refreshed) return { kind: "remote", url: refreshed };
}
return { kind: "remote", url: item.play_url ?? item.url };
return this.refreshUrls(meta.id, meta.channelId, item);
}
/** Re-fetch the source message and update expired URLs. Returns the fresh playable URL. */