Update editor.js

This commit is contained in:
Aleksandr Statciuk 2022-06-18 19:38:45 +03:00
parent 44f9f84e75
commit a2ad1f56ab

View file

@ -22,7 +22,7 @@ async function main() {
channels = result.channels channels = result.channels
await api.channels.load() await api.channels.load()
for (const channel of channels) { for (const channel of channels) {
if (channel.xmltv_id) continue if (channel.id) continue
let choices = await getOptions(channel) let choices = await getOptions(channel)
const question = { const question = {
name: 'option', name: 'option',
@ -35,17 +35,17 @@ async function main() {
switch (selected.option) { switch (selected.option) {
case 'Overwrite...': case 'Overwrite...':
const input = await getInput(channel) const input = await getInput(channel)
channel.xmltv_id = input.xmltv_id channel.id = input.xmltv_id
break break
case 'Skip...': case 'Skip...':
channel.xmltv_id = '-' channel.id = '-'
break break
default: default:
const [name, xmltv_id] = selected.option const [name, xmltv_id] = selected.option
.replace(/ \[.*\]/, '') .replace(/ \[.*\]/, '')
.split('|') .split('|')
.map(i => i.trim().replace(newLabel, '')) .map(i => i.trim().replace(newLabel, ''))
channel.xmltv_id = xmltv_id channel.id = xmltv_id
break break
} }
}) })