Merge branch 'master' of https://github.com/iptv-org/epg into be-2957-s1

This commit is contained in:
theofficialomega
2026-04-09 00:15:16 +02:00
170 changed files with 40849 additions and 6648 deletions

View File

@@ -7,7 +7,6 @@ import { Storage } from '@freearhey/storage-js'
import { Channel } from '../../models'
import * as sdk from '@iptv-org/sdk'
import { Command } from 'commander'
import readline from 'readline'
interface ChoiceValue {
type: string
@@ -20,17 +19,6 @@ interface Choice {
default?: boolean
}
if (process.platform === 'win32') {
readline
.createInterface({
input: process.stdin,
output: process.stdout
})
.on('SIGINT', function () {
process.emit('SIGINT')
})
}
const program = new Command()
program.argument('<filepath>', 'Path to *.channels.xml file to edit').parse(process.argv)
@@ -43,12 +31,7 @@ let channelsFromXML = new Collection<Channel>()
main(filepath)
process.on('SIGINT', () => {
save(filepath, channelsFromXML)
process.exit(0)
})
process.on('SIGTERM', () => {
save(filepath, channelsFromXML)
process.exit(0)
if (process.platform === 'win32') process.kill(0)
})
export default async function main(filepath: string) {
@@ -90,8 +73,7 @@ export default async function main(filepath: string) {
}
async function selectChannel(channel: epgGrabber.Channel): Promise<string> {
const query = escapeRegex(channel.name)
const similarChannels = searchChannels(query)
const similarChannels = searchChannels(channel.name)
const choices = getChoicesForChannel(similarChannels).all()
const selected: ChoiceValue = await select({
@@ -199,7 +181,3 @@ function save(filepath: string, channelsFromXML: Collection<Channel>) {
console.log()
logger.info(`File '${filepath}' successfully saved`)
}
function escapeRegex(string: string) {
return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&')
}