(issue: Issue)
| 106 | } |
| 107 | |
| 108 | async 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 | |
| 144 | async function editStream(issue: Issue) { |
| 145 | const log = createThread(issue, 'streams/edit') |
no test coverage detected