Update format.js

This commit is contained in:
Aleksandr Statciuk 2021-08-02 21:48:04 +03:00
parent a580c76468
commit 3d761612d9
1 changed files with 0 additions and 14 deletions

View File

@ -1,4 +1,3 @@
const categories = require('./helpers/categories')
const parser = require('./helpers/parser') const parser = require('./helpers/parser')
const utils = require('./helpers/utils') const utils = require('./helpers/utils')
const file = require('./helpers/file') const file = require('./helpers/file')
@ -13,7 +12,6 @@ async function main() {
log.print(`\nProcessing '${playlist.url}'...`) log.print(`\nProcessing '${playlist.url}'...`)
await parser await parser
.parsePlaylist(playlist.url) .parsePlaylist(playlist.url)
.then(removeWrongCategories)
.then(addMissingData) .then(addMissingData)
.then(playlist => { .then(playlist => {
if (file.read(playlist.url) !== playlist.toString()) { if (file.read(playlist.url) !== playlist.toString()) {
@ -29,18 +27,6 @@ async function main() {
log.finish() log.finish()
} }
async function removeWrongCategories(playlist) {
for (const channel of playlist.channels) {
if (!channel.category) continue
const valid = categories.find(c => c.name === channel.category)
if (!valid) {
channel.category = ''
}
}
return playlist
}
async function addMissingData(playlist) { async function addMissingData(playlist) {
for (const channel of playlist.channels) { for (const channel of playlist.channels) {
const code = file.getBasename(playlist.url) const code = file.getBasename(playlist.url)