Update edit.ts
This commit is contained in:
@@ -76,8 +76,7 @@ export default async function main(filepath: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function selectChannel(stream: Stream): Promise<string> {
|
async function selectChannel(stream: Stream): Promise<string> {
|
||||||
const query = escapeRegex(stream.title)
|
const similarChannels = searchChannels(stream.title)
|
||||||
const similarChannels = searchChannels(query)
|
|
||||||
const url = truncate(stream.url, 50)
|
const url = truncate(stream.url, 50)
|
||||||
|
|
||||||
const selected: ChoiceValue = await select({
|
const selected: ChoiceValue = await select({
|
||||||
@@ -184,7 +183,3 @@ function save(filepath: string) {
|
|||||||
storage.saveSync(filepath, playlist.toString())
|
storage.saveSync(filepath, playlist.toString())
|
||||||
logger.info(`\nFile '${filepath}' successfully saved`)
|
logger.info(`\nFile '${filepath}' successfully saved`)
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeRegex(string: string) {
|
|
||||||
return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&')
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user