| 153 | } |
| 154 | |
| 155 | async function removeBrokenLinks() { |
| 156 | const streamsGrouped = streams.groupBy((stream: Stream) => stream.filepath) |
| 157 | for (const filepath of streamsGrouped.keys()) { |
| 158 | let streams: Collection<Stream> = new Collection(streamsGrouped.get(filepath)) |
| 159 | |
| 160 | streams = streams.filter((stream: Stream) => !isBroken(stream)) |
| 161 | |
| 162 | const playlist = new Playlist(streams, { public: false }) |
| 163 | await rootStorage.save(filepath, playlist.toString()) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | async function onFinish(error: Error | null | undefined) { |
| 168 | clearInterval(interval) |