Update format.js

This commit is contained in:
freearhey 2021-01-30 07:18:06 +03:00
parent 8127e77b07
commit 9c2285ba48
1 changed files with 4 additions and 7 deletions

View File

@ -38,7 +38,7 @@ async function main() {
.then(removeDuplicates)
.then(detectResolution)
.then(updateFromEPG)
.then(updatePlaylist)
.then(savePlaylist)
.then(done)
}
@ -46,7 +46,7 @@ async function main() {
await loadPlaylist('channels/unsorted.m3u')
.then(removeUnsortedDuplicates)
.then(sortChannels)
.then(updatePlaylist)
.then(savePlaylist)
.then(done)
}
@ -191,12 +191,9 @@ async function removeUnsortedDuplicates(playlist) {
return playlist
}
async function updatePlaylist(playlist) {
async function savePlaylist(playlist) {
const original = utils.readFile(playlist.url)
let output = playlist.getHeader()
for (let channel of playlist.channels) {
output += channel.toString(true)
}
const output = playlist.toString(true)
if (original === output) {
console.info(`No changes have been made.`)