Fixes channels:editor script

This commit is contained in:
freearhey 2023-10-15 10:25:55 +03:00
parent 11856161c2
commit 6e2cc42bc6
5 changed files with 23 additions and 7 deletions

View file

@ -17,7 +17,6 @@ const programOptions = program.opts()
const defaultCountry = programOptions.country.toLowerCase()
const newLabel = ` [new]`
let site: string
let options = new Collection()
async function main() {
@ -119,7 +118,7 @@ function save() {
.filter((option: { channel: Channel; delete: boolean }) => !option.delete)
.map((option: { channel: Channel; delete: boolean }) => option.channel)
const xml = new XML(channels, site)
const xml = new XML(channels)
storage.saveSync(filepath, xml.toString())

View file

@ -50,6 +50,11 @@ async function main() {
if (isPromise(parsedChannels)) {
parsedChannels = await parsedChannels
}
parsedChannels = parsedChannels.map((channel: Channel) => {
channel.site = config.site
return channel
})
channels = channels
.mergeBy(
@ -62,7 +67,7 @@ async function main() {
(channel: Channel) => channel.site_id
])
const xml = new XML(channels, config.site)
const xml = new XML(channels)
await storage.save(outputFilepath, xml.toString())