mirror of
https://github.com/iptv-org/iptv
synced 2025-12-17 10:57:18 -05:00
Update update.ts
This commit is contained in:
@@ -35,9 +35,8 @@ async function main() {
|
|||||||
logger.info('saving...')
|
logger.info('saving...')
|
||||||
const groupedStreams = streams.groupBy((stream: Stream) => stream.filepath)
|
const groupedStreams = streams.groupBy((stream: Stream) => stream.filepath)
|
||||||
for (let filepath of groupedStreams.keys()) {
|
for (let filepath of groupedStreams.keys()) {
|
||||||
const streams = groupedStreams.get(filepath) || []
|
let streams = groupedStreams.get(filepath) || []
|
||||||
|
streams = streams.filter((stream: Stream) => stream.removed === false)
|
||||||
if (!streams.length) return
|
|
||||||
|
|
||||||
const playlist = new Playlist(streams, { public: false })
|
const playlist = new Playlist(streams, { public: false })
|
||||||
await streamsStorage.save(filepath, playlist.toString())
|
await streamsStorage.save(filepath, playlist.toString())
|
||||||
@@ -55,8 +54,9 @@ async function removeStreams(loader: IssueLoader) {
|
|||||||
const data = issue.data
|
const data = issue.data
|
||||||
if (data.missing('stream_url')) return
|
if (data.missing('stream_url')) return
|
||||||
|
|
||||||
const removed = streams.remove((_stream: Stream) => _stream.url === data.get('stream_url'))
|
const found: Stream = streams.first((_stream: Stream) => _stream.url === data.get('stream_url'))
|
||||||
if (removed.notEmpty()) {
|
if (found) {
|
||||||
|
found.removed = true
|
||||||
processedIssues.add(issue.number)
|
processedIssues.add(issue.number)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -93,9 +93,6 @@ async function editStreams(loader: IssueLoader) {
|
|||||||
if (data.has('http_referrer')) stream.httpReferrer = data.get('http_referrer')
|
if (data.has('http_referrer')) stream.httpReferrer = data.get('http_referrer')
|
||||||
if (data.has('channel_name')) stream.name = data.get('channel_name')
|
if (data.has('channel_name')) stream.name = data.get('channel_name')
|
||||||
|
|
||||||
streams.remove((_stream: Stream) => _stream.channel === stream.channel)
|
|
||||||
streams.add(stream)
|
|
||||||
|
|
||||||
processedIssues.add(issue.number)
|
processedIssues.add(issue.number)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user