From 9dd44875eff831a70b62299595a890b47c1e03ec Mon Sep 17 00:00:00 2001 From: freearhey Date: Tue, 26 May 2020 15:57:29 +0300 Subject: [PATCH] Format each playlist at every run --- scripts/format.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/scripts/format.js b/scripts/format.js index 70d963cd8..515c4c822 100644 --- a/scripts/format.js +++ b/scripts/format.js @@ -47,19 +47,12 @@ async function main() { } } - if (playlist.changed) { - updatePlaylist(item.url, playlist) - updated++ - } else { - console.log('Nothing is changed') - } + updatePlaylist(item.url, playlist) } console.log(`Processing 'channels/unsorted.m3u'...`) filterUnsorted() - console.log(`Updated ${updated} playlist(s)`) - console.log('Done.\n') } @@ -85,9 +78,6 @@ function parsePlaylist(url) { function sortChannels(playlist) { const channels = JSON.stringify(playlist.items) playlist.items = helper.sortBy(playlist.items, ['name', 'url']) - if (channels !== JSON.stringify(playlist.items)) { - playlist.changed = true - } return playlist } @@ -109,10 +99,6 @@ function removeDuplicates(playlist) { return result }) - if (channels !== JSON.stringify(playlist.items)) { - playlist.changed = true - } - return playlist } @@ -168,8 +154,6 @@ function updatePlaylist(filepath, playlist) { for (let channel of playlist.items) { helper.appendToFile(filepath, channel.toShortString()) } - - console.log(`Playlist '${filepath}' has been updated`) } function filterUnsorted() {