Update format.js

pull/2087/head
freearhey 4 years ago
parent 8127e77b07
commit 9c2285ba48

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

Loading…
Cancel
Save