From 96837d3753f171ddaddb6ffa493d3721c87d5296 Mon Sep 17 00:00:00 2001 From: freearhey Date: Thu, 6 May 2021 01:09:32 +0300 Subject: [PATCH] Update format.js - check if the channel already has the resolution specified - small refactoring --- scripts/format.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/format.js b/scripts/format.js index 2db55e071..e0083ddb9 100644 --- a/scripts/format.js +++ b/scripts/format.js @@ -118,13 +118,13 @@ async function detectResolution(playlist) { const results = [] for (const channel of playlist.channels) { bar.tick() - const url = channel.url - const response = await instance - .get(url) - .then(utils.sleep(config.delay)) - .catch(err => {}) - if (response) { - if (response.status === 200) { + if (!channel.resolution.height) { + const response = await instance + .get(channel.url) + .then(utils.sleep(config.delay)) + .catch(err => {}) + + if (response && response.status === 200) { if (/^#EXTM3U/.test(response.data)) { const resolution = parseResolution(response.data) if (resolution) {