1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Refactor live manager

This commit is contained in:
Chocobozzz 2021-06-16 15:14:41 +02:00
parent fd6584844b
commit 8ebf2a5d5d
No known key found for this signature in database
GPG key ID: 583A612D890159BE
23 changed files with 1255 additions and 886 deletions

View file

@ -0,0 +1,23 @@
import { remove } from 'fs-extra'
import { basename } from 'path'
import { MStreamingPlaylist, MVideo } from '@server/types/models'
import { getHLSDirectory } from '../video-paths'
function buildConcatenatedName (segmentOrPlaylistPath: string) {
const num = basename(segmentOrPlaylistPath).match(/^(\d+)(-|\.)/)
return 'concat-' + num[1] + '.ts'
}
async function cleanupLive (video: MVideo, streamingPlaylist: MStreamingPlaylist) {
const hlsDirectory = getHLSDirectory(video)
await remove(hlsDirectory)
await streamingPlaylist.destroy()
}
export {
cleanupLive,
buildConcatenatedName
}