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:
parent
fd6584844b
commit
8ebf2a5d5d
23 changed files with 1255 additions and 886 deletions
23
server/lib/live/live-utils.ts
Normal file
23
server/lib/live/live-utils.ts
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue