diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-08 11:07:19 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-08 11:07:19 +0100 |
commit | 9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231 (patch) | |
tree | 3419e23d551937f716612f93747f58f2d381d310 /server/models | |
parent | a23f6c94edee1cb11875585a64dc61f1004c1792 (diff) | |
download | PeerTube-9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231.tar.gz PeerTube-9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231.tar.zst PeerTube-9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231.zip |
Update torrent metadata on video update
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/video/video-playlist-element.ts | 2 | ||||
-rw-r--r-- | server/models/video/video.ts | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/server/models/video/video-playlist-element.ts b/server/models/video/video-playlist-element.ts index 82c832188..a87b2bcae 100644 --- a/server/models/video/video-playlist-element.ts +++ b/server/models/video/video-playlist-element.ts | |||
@@ -276,7 +276,7 @@ export class VideoPlaylistElementModel extends Model<Partial<AttributesOnly<Vide | |||
276 | } | 276 | } |
277 | 277 | ||
278 | const positionQuery = Sequelize.literal(`${newPosition} + "position" - ${firstPosition}`) | 278 | const positionQuery = Sequelize.literal(`${newPosition} + "position" - ${firstPosition}`) |
279 | return VideoPlaylistElementModel.update({ position: positionQuery as any }, query) | 279 | return VideoPlaylistElementModel.update({ position: positionQuery }, query) |
280 | } | 280 | } |
281 | 281 | ||
282 | static increasePositionOf ( | 282 | static increasePositionOf ( |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 1050463d2..801e23f55 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1539,6 +1539,21 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
1539 | return this.VideoChannel.Account.Actor.Server?.isBlocked() || this.VideoChannel.Account.isBlocked() | 1539 | return this.VideoChannel.Account.Actor.Server?.isBlocked() || this.VideoChannel.Account.isBlocked() |
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | getAllFiles () { | ||
1543 | let files: MVideoFile[] = [] | ||
1544 | |||
1545 | if (Array.isArray(this.VideoFiles)) { | ||
1546 | files = files.concat(this.VideoFiles) | ||
1547 | } | ||
1548 | |||
1549 | const hls = this.getHLSPlaylist() | ||
1550 | if (hls) { | ||
1551 | files = files.concat(hls.VideoFiles) | ||
1552 | } | ||
1553 | |||
1554 | return files | ||
1555 | } | ||
1556 | |||
1542 | getQualityFileBy<T extends MVideoWithFile> (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) { | 1557 | getQualityFileBy<T extends MVideoWithFile> (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) { |
1543 | // We first transcode to WebTorrent format, so try this array first | 1558 | // We first transcode to WebTorrent format, so try this array first |
1544 | if (Array.isArray(this.VideoFiles) && this.VideoFiles.length !== 0) { | 1559 | if (Array.isArray(this.VideoFiles) && this.VideoFiles.length !== 0) { |