From d310ff388db1ae1c1e75806818ae6185585f58f2 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:41:14 +0300 Subject: [PATCH] Update editor.ts --- scripts/commands/channels/editor.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/commands/channels/editor.ts b/scripts/commands/channels/editor.ts index d94f35a6..ef6ead42 100644 --- a/scripts/commands/channels/editor.ts +++ b/scripts/commands/channels/editor.ts @@ -29,7 +29,7 @@ async function main() { const parser = new ChannelsParser({ storage }) const parsedChannels = await parser.parse(filepath) - options = parsedChannels.map((channel: Channel) => { + options = parsedChannels.map((channel: Channel): { channel: Channel; delete: boolean } => { return { channel, delete: false @@ -41,18 +41,18 @@ async function main() { const channels = new Collection(channelsContent).map(data => new ApiChannel(data)) const buffer = new Dictionary() - options.forEach(async (option: { channel: Channel; delete: boolean }) => { - const channel = option.channel + for (let option of options.all()) { + const channel: Channel = option.channel if (channel.xmltv_id) { if (channel.xmltv_id !== '-') { buffer.set(`${channel.xmltv_id}/${channel.lang}`, true) } - return + continue } const choices = getOptions(channels, channel) const question: QuestionCollection = { name: 'option', - message: 'Choose an option:', + message: `Choose xmltv_id for "${channel.name}" (${channel.site_id}):`, type: 'list', choices, pageSize: 10 @@ -103,7 +103,7 @@ async function main() { } } }) - }) + } } main() @@ -154,7 +154,7 @@ function getOptions(channels: Collection, channel: Channel) { const closed = _channel.closed ? `[closed:${_channel.closed}]` : '' const replacedBy = _channel.replacedBy ? `[replaced_by:${_channel.replacedBy}]` : '' - variants.add(`${_channel.name}${altNames} | ${_channel.id} ${closed}${replacedBy}[api]`) + variants.add(`${_channel.name}${altNames} | ${_channel.id}${closed}${replacedBy}`) }) variants.add('Overwrite') variants.add('Skip')