Update format.js
This commit is contained in:
parent
a580c76468
commit
3d761612d9
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue