mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 17:10:07 -04:00
Fixes linter errors
This commit is contained in:
parent
57e508fc3b
commit
63c86a2b30
393 changed files with 28447 additions and 28443 deletions
|
@ -15,7 +15,7 @@ program
|
||||||
const filepath = program.args[0]
|
const filepath = program.args[0]
|
||||||
const programOptions = program.opts()
|
const programOptions = program.opts()
|
||||||
const defaultCountry = programOptions.country.toLowerCase()
|
const defaultCountry = programOptions.country.toLowerCase()
|
||||||
const newLabel = ` [new]`
|
const newLabel = ' [new]'
|
||||||
|
|
||||||
let options = new Collection()
|
let options = new Collection()
|
||||||
|
|
||||||
|
@ -49,10 +49,10 @@ async function main() {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let choices = getOptions(channels, channel)
|
const choices = getOptions(channels, channel)
|
||||||
const question: QuestionCollection = {
|
const question: QuestionCollection = {
|
||||||
name: 'option',
|
name: 'option',
|
||||||
message: `Choose an option:`,
|
message: 'Choose an option:',
|
||||||
type: 'list',
|
type: 'list',
|
||||||
choices,
|
choices,
|
||||||
pageSize: 10
|
pageSize: 10
|
||||||
|
@ -151,13 +151,13 @@ function getOptions(channels: Collection, channel: Channel) {
|
||||||
variants.add(`${channel.name.trim()} | ${channelId}${newLabel}`)
|
variants.add(`${channel.name.trim()} | ${channelId}${newLabel}`)
|
||||||
similar.forEach((_channel: ApiChannel) => {
|
similar.forEach((_channel: ApiChannel) => {
|
||||||
const altNames = _channel.altNames.notEmpty() ? ` (${_channel.altNames.join(',')})` : ''
|
const altNames = _channel.altNames.notEmpty() ? ` (${_channel.altNames.join(',')})` : ''
|
||||||
const closed = _channel.closed ? `[closed:${_channel.closed}]` : ``
|
const closed = _channel.closed ? `[closed:${_channel.closed}]` : ''
|
||||||
const replacedBy = _channel.replacedBy ? `[replaced_by:${_channel.replacedBy}]` : ''
|
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}[api]`)
|
||||||
})
|
})
|
||||||
variants.add(`Overwrite`)
|
variants.add('Overwrite')
|
||||||
variants.add(`Skip`)
|
variants.add('Skip')
|
||||||
|
|
||||||
return variants.all()
|
return variants.all()
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ function getSimilar(channels: Collection, channelId: string) {
|
||||||
function generateCode(name: string, country: string) {
|
function generateCode(name: string, country: string) {
|
||||||
const channelId: string = transliterate(name)
|
const channelId: string = transliterate(name)
|
||||||
.replace(/\+/gi, 'Plus')
|
.replace(/\+/gi, 'Plus')
|
||||||
.replace(/^\&/gi, 'And')
|
.replace(/^&/gi, 'And')
|
||||||
.replace(/[^a-z\d]+/gi, '')
|
.replace(/[^a-z\d]+/gi, '')
|
||||||
|
|
||||||
return `${channelId}.${country}`
|
return `${channelId}.${country}`
|
||||||
|
|
|
@ -42,7 +42,7 @@ async function main() {
|
||||||
|
|
||||||
let errors: ValidationError[] = []
|
let errors: ValidationError[] = []
|
||||||
|
|
||||||
let files: string[] = await storage.list(options.channels)
|
const files: string[] = await storage.list(options.channels)
|
||||||
for (const filepath of files) {
|
for (const filepath of files) {
|
||||||
const file = new File(filepath)
|
const file = new File(filepath)
|
||||||
if (file.extension() !== 'xml') continue
|
if (file.extension() !== 'xml') continue
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Logger, File, Collection, Storage } from '@freearhey/core'
|
import { Logger, File, Collection, Storage } from '@freearhey/core'
|
||||||
import { ChannelsParser, XML } from '../../core'
|
import { ChannelsParser, XML } from '../../core'
|
||||||
import { Channel } from 'epg-grabber'
|
import { Channel } from 'epg-grabber'
|
||||||
import { Command, OptionValues } from 'commander'
|
import { Command } from 'commander'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
const program = new Command()
|
const program = new Command()
|
||||||
|
@ -36,7 +36,7 @@ async function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const args: {
|
const args: {
|
||||||
[key: string]: any
|
[key: string]: string
|
||||||
} = {}
|
} = {}
|
||||||
|
|
||||||
if (Array.isArray(options.set)) {
|
if (Array.isArray(options.set)) {
|
||||||
|
@ -76,6 +76,10 @@ async function main() {
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
function isPromise(promise: any) {
|
function isPromise(promise: object[] | Promise<object[]>) {
|
||||||
return !!promise && typeof promise.then === 'function'
|
return (
|
||||||
|
!!promise &&
|
||||||
|
typeof promise === 'object' &&
|
||||||
|
typeof (promise as Promise<object[]>).then === 'function'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ async function main() {
|
||||||
let totalFiles = 0
|
let totalFiles = 0
|
||||||
let totalErrors = 0
|
let totalErrors = 0
|
||||||
const storage = new Storage()
|
const storage = new Storage()
|
||||||
let files: string[] = await storage.list(options.channels)
|
const files: string[] = await storage.list(options.channels)
|
||||||
for (const filepath of files) {
|
for (const filepath of files) {
|
||||||
const file = new File(filepath)
|
const file = new File(filepath)
|
||||||
if (file.extension() !== 'xml') continue
|
if (file.extension() !== 'xml') continue
|
||||||
|
|
|
@ -55,7 +55,7 @@ async function main() {
|
||||||
logger.info('config:')
|
logger.info('config:')
|
||||||
logger.tree(options)
|
logger.tree(options)
|
||||||
|
|
||||||
logger.info(`loading channels...`)
|
logger.info('loading channels...')
|
||||||
const storage = new Storage()
|
const storage = new Storage()
|
||||||
const parser = new ChannelsParser({ storage })
|
const parser = new ChannelsParser({ storage })
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ async function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let parsedChannels = new Collection()
|
let parsedChannels = new Collection()
|
||||||
for (let filepath of files) {
|
for (const filepath of files) {
|
||||||
parsedChannels = parsedChannels.concat(await parser.parse(filepath))
|
parsedChannels = parsedChannels.concat(await parser.parse(filepath))
|
||||||
}
|
}
|
||||||
if (options.lang) {
|
if (options.lang) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue