Fix torrent metadata update for hls
This commit is contained in:
parent
2acb622cb8
commit
6ba93fa639
3 changed files with 11 additions and 17 deletions
|
@ -135,7 +135,7 @@ async function run () {
|
||||||
for (const file of (playlist?.VideoFiles || [])) {
|
for (const file of (playlist?.VideoFiles || [])) {
|
||||||
console.log('Updating fragmented torrent file %s of video %s.', file.resolution, video.uuid)
|
console.log('Updating fragmented torrent file %s of video %s.', file.resolution, video.uuid)
|
||||||
|
|
||||||
await updateTorrentMetadata(video, file)
|
await updateTorrentMetadata(playlist, file)
|
||||||
|
|
||||||
await file.save()
|
await file.save()
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,9 +202,18 @@ function updateSchedule (videoInstance: MVideoFullLight, videoInfoToUpdate: Vide
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateTorrentsMetadata (video: MVideoFullLight) {
|
async function updateTorrentsMetadata (video: MVideoFullLight) {
|
||||||
for (const file of video.getAllFiles()) {
|
for (const file of (video.VideoFiles || [])) {
|
||||||
await updateTorrentMetadata(video, file)
|
await updateTorrentMetadata(video, file)
|
||||||
|
|
||||||
await file.save()
|
await file.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hls = video.getHLSPlaylist()
|
||||||
|
if (!hls) return
|
||||||
|
|
||||||
|
for (const file of (hls.VideoFiles || [])) {
|
||||||
|
await updateTorrentMetadata(hls, file)
|
||||||
|
|
||||||
|
await file.save()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1539,21 +1539,6 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
|
||||||
return this.VideoChannel.Account.Actor.Server?.isBlocked() || this.VideoChannel.Account.isBlocked()
|
return this.VideoChannel.Account.Actor.Server?.isBlocked() || this.VideoChannel.Account.isBlocked()
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllFiles () {
|
|
||||||
let files: MVideoFile[] = []
|
|
||||||
|
|
||||||
if (Array.isArray(this.VideoFiles)) {
|
|
||||||
files = files.concat(this.VideoFiles)
|
|
||||||
}
|
|
||||||
|
|
||||||
const hls = this.getHLSPlaylist()
|
|
||||||
if (hls) {
|
|
||||||
files = files.concat(hls.VideoFiles)
|
|
||||||
}
|
|
||||||
|
|
||||||
return files
|
|
||||||
}
|
|
||||||
|
|
||||||
getQualityFileBy<T extends MVideoWithFile> (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) {
|
getQualityFileBy<T extends MVideoWithFile> (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) {
|
||||||
// We first transcode to WebTorrent format, so try this array first
|
// We first transcode to WebTorrent format, so try this array first
|
||||||
if (Array.isArray(this.VideoFiles) && this.VideoFiles.length !== 0) {
|
if (Array.isArray(this.VideoFiles) && this.VideoFiles.length !== 0) {
|
||||||
|
|
Loading…
Reference in a new issue