mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 02:16:40 -05:00
Fixes channels:editor script
This commit is contained in:
@@ -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())
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@ import { Channel } from 'epg-grabber'
|
||||
|
||||
export class XML {
|
||||
items: Collection
|
||||
site: string
|
||||
|
||||
constructor(items: Collection, site: string) {
|
||||
constructor(items: Collection) {
|
||||
this.items = items
|
||||
this.site = site
|
||||
}
|
||||
|
||||
toString() {
|
||||
@@ -18,7 +16,7 @@ export class XML {
|
||||
const xmltv_id = channel.xmltv_id || ''
|
||||
const lang = channel.lang || ''
|
||||
const site_id = channel.site_id || ''
|
||||
output += ` <channel site="${this.site}" lang="${lang}" xmltv_id="${escapeString(
|
||||
output += ` <channel site="${channel.site}" lang="${lang}" xmltv_id="${escapeString(
|
||||
xmltv_id
|
||||
)}" site_id="${site_id}"${logo}>${escapeString(channel.name)}</channel>\r\n`
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user