Update queueCreator.ts

This commit is contained in:
freearhey 2023-12-01 20:11:28 +03:00
parent 571b77b481
commit d466a071e5
1 changed files with 11 additions and 7 deletions

View File

@ -36,12 +36,13 @@ export class QueueCreator {
const queue = new Queue()
for (const channel of this.parsedChannels.all()) {
if (!channel.site || !channel.xmltv_id) continue
if (!channel.site || !channel.site_id || !channel.name) continue
if (this.options.lang && channel.lang !== this.options.lang) continue
const configPath = path.resolve(SITES_DIR, `${channel.site}/${channel.site}.config.js`)
const config: SiteConfig = await this.configLoader.load(configPath)
if (channel.xmltv_id) {
const found: ApiChannel = channels.first(
(_channel: ApiChannel) => _channel.id === channel.xmltv_id
)
@ -49,6 +50,9 @@ export class QueueCreator {
channel.logo = found.logo
channel.name = found.name
}
} else {
channel.xmltv_id = channel.site_id
}
const days = this.options.days || config.days || 1
const currDate = new DateTime(process.env.CURR_DATE || new Date().toISOString())