aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/models/activitypub/actor.ts17
-rw-r--r--server/tests/api/videos/video-transcoder.ts4
-rw-r--r--server/tests/cli/optimize-old-videos.ts4
3 files changed, 12 insertions, 13 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index 66a13b857..e539b579c 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -1,6 +1,5 @@
1import { values } from 'lodash' 1import { values } from 'lodash'
2import { extname } from 'path' 2import { extname } from 'path'
3import * as Sequelize from 'sequelize'
4import { 3import {
5 AllowNull, 4 AllowNull,
6 BelongsTo, 5 BelongsTo,
@@ -48,7 +47,7 @@ import {
48 MActorWithInboxes 47 MActorWithInboxes
49} from '../../typings/models' 48} from '../../typings/models'
50import * as Bluebird from 'bluebird' 49import * as Bluebird from 'bluebird'
51import { Op } from 'sequelize' 50import { Op, Transaction } from 'sequelize'
52 51
53enum ScopeNames { 52enum ScopeNames {
54 FULL = 'FULL' 53 FULL = 'FULL'
@@ -285,7 +284,7 @@ export class ActorModel extends Model<ActorModel> {
285 return ActorModel.scope(ScopeNames.FULL).findByPk(id) 284 return ActorModel.scope(ScopeNames.FULL).findByPk(id)
286 } 285 }
287 286
288 static loadFromAccountByVideoId (videoId: number, transaction: Sequelize.Transaction): Bluebird<MActor> { 287 static loadFromAccountByVideoId (videoId: number, transaction: Transaction): Bluebird<MActor> {
289 const query = { 288 const query = {
290 include: [ 289 include: [
291 { 290 {
@@ -329,11 +328,11 @@ export class ActorModel extends Model<ActorModel> {
329 .then(a => !!a) 328 .then(a => !!a)
330 } 329 }
331 330
332 static listByFollowersUrls (followersUrls: string[], transaction?: Sequelize.Transaction): Bluebird<MActorFull[]> { 331 static listByFollowersUrls (followersUrls: string[], transaction?: Transaction): Bluebird<MActorFull[]> {
333 const query = { 332 const query = {
334 where: { 333 where: {
335 followersUrl: { 334 followersUrl: {
336 [ Sequelize.Op.in ]: followersUrls 335 [ Op.in ]: followersUrls
337 } 336 }
338 }, 337 },
339 transaction 338 transaction
@@ -342,7 +341,7 @@ export class ActorModel extends Model<ActorModel> {
342 return ActorModel.scope(ScopeNames.FULL).findAll(query) 341 return ActorModel.scope(ScopeNames.FULL).findAll(query)
343 } 342 }
344 343
345 static loadLocalByName (preferredUsername: string, transaction?: Sequelize.Transaction): Bluebird<MActorFull> { 344 static loadLocalByName (preferredUsername: string, transaction?: Transaction): Bluebird<MActorFull> {
346 const query = { 345 const query = {
347 where: { 346 where: {
348 preferredUsername, 347 preferredUsername,
@@ -373,7 +372,7 @@ export class ActorModel extends Model<ActorModel> {
373 return ActorModel.scope(ScopeNames.FULL).findOne(query) 372 return ActorModel.scope(ScopeNames.FULL).findOne(query)
374 } 373 }
375 374
376 static loadByUrl (url: string, transaction?: Sequelize.Transaction): Bluebird<MActorAccountChannelId> { 375 static loadByUrl (url: string, transaction?: Transaction): Bluebird<MActorAccountChannelId> {
377 const query = { 376 const query = {
378 where: { 377 where: {
379 url 378 url
@@ -396,7 +395,7 @@ export class ActorModel extends Model<ActorModel> {
396 return ActorModel.unscoped().findOne(query) 395 return ActorModel.unscoped().findOne(query)
397 } 396 }
398 397
399 static loadByUrlAndPopulateAccountAndChannel (url: string, transaction?: Sequelize.Transaction): Bluebird<MActorFull> { 398 static loadByUrlAndPopulateAccountAndChannel (url: string, transaction?: Transaction): Bluebird<MActorFull> {
400 const query = { 399 const query = {
401 where: { 400 where: {
402 url 401 url
@@ -483,7 +482,7 @@ export class ActorModel extends Model<ActorModel> {
483 return activityPubContextify(json) 482 return activityPubContextify(json)
484 } 483 }
485 484
486 getFollowerSharedInboxUrls (t: Sequelize.Transaction) { 485 getFollowerSharedInboxUrls (t: Transaction) {
487 const query = { 486 const query = {
488 attributes: [ 'sharedInboxUrl' ], 487 attributes: [ 'sharedInboxUrl' ],
489 include: [ 488 include: [
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 90ade1652..4be74901a 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -292,7 +292,7 @@ describe('Test video transcoding', function () {
292 tempFixturePath = await generateHighBitrateVideo() 292 tempFixturePath = await generateHighBitrateVideo()
293 293
294 const bitrate = await getVideoFileBitrate(tempFixturePath) 294 const bitrate = await getVideoFileBitrate(tempFixturePath)
295 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 60, VIDEO_TRANSCODING_FPS)) 295 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
296 } 296 }
297 297
298 const videoAttributes = { 298 const videoAttributes = {
@@ -331,7 +331,7 @@ describe('Test video transcoding', function () {
331 tempFixturePath = await generateHighBitrateVideo() 331 tempFixturePath = await generateHighBitrateVideo()
332 332
333 const bitrate = await getVideoFileBitrate(tempFixturePath) 333 const bitrate = await getVideoFileBitrate(tempFixturePath)
334 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 60, VIDEO_TRANSCODING_FPS)) 334 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
335 } 335 }
336 336
337 for (const fixture of [ 'video_short.mkv', 'video_short.avi' ]) { 337 for (const fixture of [ 'video_short.mkv', 'video_short.avi' ]) {
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
index fa82f962c..de5d672f5 100644
--- a/server/tests/cli/optimize-old-videos.ts
+++ b/server/tests/cli/optimize-old-videos.ts
@@ -46,7 +46,7 @@ describe('Test optimize old videos', function () {
46 tempFixturePath = await generateHighBitrateVideo() 46 tempFixturePath = await generateHighBitrateVideo()
47 47
48 const bitrate = await getVideoFileBitrate(tempFixturePath) 48 const bitrate = await getVideoFileBitrate(tempFixturePath)
49 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 60, VIDEO_TRANSCODING_FPS)) 49 expect(bitrate).to.be.above(getMaxBitrate(VideoResolution.H_1080P, 25, VIDEO_TRANSCODING_FPS))
50 } 50 }
51 51
52 // Upload two videos for our needs 52 // Upload two videos for our needs
@@ -102,7 +102,7 @@ describe('Test optimize old videos', function () {
102 expect(videosDetails.files).to.have.lengthOf(1) 102 expect(videosDetails.files).to.have.lengthOf(1)
103 const file = videosDetails.files[0] 103 const file = videosDetails.files[0]
104 104
105 expect(file.size).to.be.below(5000000) 105 expect(file.size).to.be.below(8000000)
106 106
107 const path = join(root(), 'test' + servers[0].internalServerNumber, 'videos', video.uuid + '-' + file.resolution.id + '.mp4') 107 const path = join(root(), 'test' + servers[0].internalServerNumber, 'videos', video.uuid + '-' + file.resolution.id + '.mp4')
108 const bitrate = await getVideoFileBitrate(path) 108 const bitrate = await getVideoFileBitrate(path)