Update scripts

This commit is contained in:
freearhey
2025-07-20 00:30:29 +03:00
parent 5b16467a64
commit feac6b6191
9 changed files with 41 additions and 38 deletions

View File

@@ -73,7 +73,7 @@ export default async function main(filepath: string) {
logger.info('creating search index...')
const items = channels.map((channel: Channel) => channel.getSearchable()).all()
const searchIndex = sjs.createIndex(items, {
searchable: ['name', 'altNames', 'guideNames', 'streamNames', 'feedFullNames']
searchable: ['name', 'altNames', 'guideNames', 'streamTitles', 'feedFullNames']
})
logger.info('starting...\n')
@@ -100,7 +100,7 @@ async function selectChannel(
feedsGroupedByChannelId: Dictionary,
channelsKeyById: Dictionary
): Promise<string> {
const query = escapeRegex(stream.getName())
const query = escapeRegex(stream.getTitle())
const similarChannels = searchIndex
.search(query)
.map((item: ChannelSearchableData) => channelsKeyById.get(item.id))
@@ -108,7 +108,7 @@ async function selectChannel(
const url = stream.url.length > 50 ? stream.url.slice(0, 50) + '...' : stream.url
const selected: ChoiceValue = await select({
message: `Select channel ID for "${stream.name}" (${url}):`,
message: `Select channel ID for "${stream.title}" (${url}):`,
choices: getChannelChoises(new Collection(similarChannels)),
pageSize: 10
})

View File

@@ -53,7 +53,7 @@ async function main() {
logger.info('sorting links...')
streams = streams.orderBy(
[
(stream: Stream) => stream.name,
(stream: Stream) => stream.title,
(stream: Stream) => stream.getVerticalResolution(),
(stream: Stream) => stream.getLabel(),
(stream: Stream) => stream.url

View File

@@ -129,7 +129,7 @@ async function editStreams({
.withChannel(channelsKeyById)
.withFeed(feedsGroupedByChannelId)
.updateId()
.updateName()
.updateTitle()
.updateFilepath()
}
@@ -173,11 +173,11 @@ async function addStreams({
const directives = data.getArray('directives') || []
const stream = new Stream({
channel: channelId,
feed: feedId,
name: data.getString('channelName') || channel.name,
channelId,
feedId,
title: channel.name,
url: streamUrl,
user_agent: httpUserAgent,
userAgent: httpUserAgent,
referrer: httpReferrer,
directives,
quality,
@@ -185,7 +185,7 @@ async function addStreams({
})
.withChannel(channelsKeyById)
.withFeed(feedsGroupedByChannelId)
.updateName()
.updateTitle()
.updateFilepath()
streams.add(stream)