Compare commits

..

No commits in common. "1c288ee4dc9ca6da3e474cd38e7e4c83383e8bca" and "7a32e5792e5655c417e51bf053836de6e40c3dbf" have entirely different histories.

2 changed files with 4 additions and 12 deletions

View File

@ -32,12 +32,7 @@ async function createImageSheet(images /*[{width, height, url}]*/, legacyMode) {
await Promise.all(images.map(({x, y, w, h, url}) => (async function(){
if (!url) return;
try {
var image = await loadImage(url);
} catch (error) {
console.error("failed to load image", url, error.message);
return;
}
ctx.drawImage(image, x, y, w, h);
})().catch(error => console.error("imageload", error.stack))));
@ -55,7 +50,7 @@ export async function makeImageSheetVrcUrl(pool, images, legacyMode) {
promise.then(() => {
setTimeout(() => {
if (store[key] === promise) delete store[key];
}, 1000*60); // 1 min;
}, 1000*60*10); // 10 mins;
});
promise.catch(error => {
console.error(error.stack);

View File

@ -21,16 +21,13 @@ async function getVideoCaptions(videoId) {
captionTracks = await Promise.all(captionTracks.map(captionTrack => (async () => {
var xml = await gotw(captionTrack.baseUrl, {resolveBodyOnly: true});
var parsed = xmlParser.parse(xml);
if (!parsed.transcript || !parsed.transcript.text) {
console.error("caption missing lines", parsed, xml);
}
var lines = parsed.transcript.text.map(({ "#text": text, "@_start": start, "@_dur": dur }) => ({ start: Number(start), dur: Number(dur), text }));
return {
name: captionTrack.name.simpleText,
id: captionTrack.vssId,
lines
};
})().catch(error => console.error("getVideoCaptions", error.stack))));
})().catch(error => console.error(error.stack))));
return captionTracks;
}
@ -41,7 +38,7 @@ export async function getVideoCaptionsCached(videoId) {
cache[videoId] = getVideoCaptions(videoId);
setTimeout(() => {
delete cache[videoId];
}, 1000*60*10); // 10 minutes
}, 1000*60*60*6); // 6 hours
}
return await cache[videoId];
}