MCPcopy
hub / github.com/iptv-org/iptv / removeStream

Function removeStream

scripts/commands/playlist/update.ts:108–142  ·  view source on GitHub ↗
(issue: Issue)

Source from the content-addressed store, hash-verified

106}
107
108async function removeStream(issue: Issue) {
109 const log = createThread(issue, 'streams/remove')
110 log.start()
111
112 const data = issue.data
113 if (data.missing('stream_url')) {
114 log.error('The request is missing the "Stream URL"')
115 skippedIssues.add(issue)
116 return
117 }
118
119 const streamUrls = data.getString('stream_url') || ''
120
121 let changed = false
122 streamUrls
123 .split(/\r?\n/)
124 .filter(Boolean)
125 .forEach((link: string) => {
126 const found: Stream = streams.first((_stream: Stream) => _stream.url === link.trim())
127 if (found) {
128 found.removed = true
129 changed = true
130 log.info(`The stream with the URL "${link}" has been removed from the playlists`)
131 } else {
132 log.error(`The stream with the URL "${link}" is missing from the playlists`)
133 }
134 })
135
136 if (changed) {
137 processedIssues.add(issue)
138 } else {
139 log.error('None of the URLs specified in the request were found in the playlists')
140 skippedIssues.add(issue)
141 }
142}
143
144async function editStream(issue: Issue) {
145 const log = createThread(issue, 'streams/edit')

Callers 1

processIssuesFunction · 0.85

Calls 6

createThreadFunction · 0.90
startMethod · 0.80
missingMethod · 0.80
errorMethod · 0.80
getStringMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected