Don't cache long videos

This commit is contained in:
Max Isom 2020-03-18 12:44:36 -05:00
parent 11246812a6
commit b1895627db

View file

@ -211,8 +211,10 @@ export default class {
youtubeStream.pipe(capacitor); youtubeStream.pipe(capacitor);
// Don't cache livestreams // Don't cache livestreams or long videos
if (!info.player_response.videoDetails.isLiveContent) { const MAX_CACHE_LENGTH_SECONDS = 30 * 60; // 30 minutes
if (!info.player_response.videoDetails.isLiveContent && parseInt(info.length_seconds, 10) < MAX_CACHE_LENGTH_SECONDS) {
const cacheTempPath = this.getCachedPathTemp(url); const cacheTempPath = this.getCachedPathTemp(url);
const cacheStream = createWriteStream(cacheTempPath); const cacheStream = createWriteStream(cacheTempPath);