mirror of
https://github.com/iptv-org/epg
synced 2026-04-08 11:52:54 -04:00
Merge branch 'master' of https://github.com/iptv-org/epg into be-fixes
This commit is contained in:
@@ -26,7 +26,8 @@ async function loadData() {
|
||||
data.feedsKeyByStreamId = feeds.keyBy((feed: sdk.Models.Feed) => feed.getStreamId())
|
||||
data.feedsGroupedByChannelId = feeds.groupBy((feed: sdk.Models.Feed) => feed.channel)
|
||||
|
||||
searchIndex = sdk.SearchEngine.createIndex<sdk.Models.Channel>(channels)
|
||||
const searchableData = channels.map((channel: sdk.Models.Channel) => channel.getSearchable())
|
||||
searchIndex = sdk.SearchEngine.createIndex<sdk.Types.ChannelSearchableData>(searchableData.all())
|
||||
}
|
||||
|
||||
async function downloadData() {
|
||||
|
||||
@@ -8,7 +8,6 @@ import { Channel } from '../../models'
|
||||
import nodeCleanup from 'node-cleanup'
|
||||
import * as sdk from '@iptv-org/sdk'
|
||||
import { Command } from 'commander'
|
||||
import readline from 'readline'
|
||||
|
||||
interface ChoiceValue {
|
||||
type: string
|
||||
@@ -21,17 +20,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)
|
||||
@@ -44,6 +32,7 @@ let channelsFromXML = new Collection<Channel>()
|
||||
main(filepath)
|
||||
nodeCleanup(() => {
|
||||
save(filepath, channelsFromXML)
|
||||
if (process.platform === 'win32') process.kill(0)
|
||||
})
|
||||
|
||||
export default async function main(filepath: string) {
|
||||
@@ -85,8 +74,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({
|
||||
@@ -194,7 +182,3 @@ function save(filepath: string, channelsFromXML: Collection<Channel>) {
|
||||
console.log()
|
||||
logger.info(`File '${filepath}' successfully saved`)
|
||||
}
|
||||
|
||||
function escapeRegex(string: string) {
|
||||
return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user