}
@Scopes(() => ({
- [ ScopeNames.WITH_VIDEO ]: {
+ [ScopeNames.WITH_VIDEO]: {
include: [
{
model: VideoFileModel,
logger.info('Removing duplicated video streaming playlist %s.', videoUUID)
videoStreamingPlaylist.Video.removeStreamingPlaylistFiles(videoStreamingPlaylist, true)
- .catch(err => logger.error('Cannot delete video streaming playlist files of %s.', videoUUID, { err }))
+ .catch(err => logger.error('Cannot delete video streaming playlist files of %s.', videoUUID, { err }))
}
return undefined
},
include: [
{
- attributes: [ ],
+ attributes: [],
model: VideoFileModel,
required: true,
include: [
{
- attributes: [ ],
+ attributes: [],
model: VideoModel,
required: true,
where: {
}
return VideoRedundancyModel.findOne(query)
- .then(r => !!r)
+ .then(r => !!r)
}
static async getVideoSample (p: Bluebird<VideoModel[]>) {
where: {
privacy: VideoPrivacy.PUBLIC,
views: {
- [ Op.gte ]: minViews
+ [Op.gte]: minViews
}
},
include: [
actorId: actor.id,
strategy,
createdAt: {
- [ Op.lt ]: expiredDate
+ [Op.lt]: expiredDate
}
}
}
where: {
actorId: actor.id,
expiresOn: {
- [ Op.lt ]: new Date()
+ [Op.lt]: new Date()
}
}
}
[Op.ne]: actor.id
},
expiresOn: {
- [ Op.lt ]: new Date(),
- [ Op.ne ]: null
+ [Op.lt]: new Date(),
+ [Op.ne]: null
}
}
}
}
static listForApi (options: {
- start: number,
- count: number,
- sort: string,
- target: VideoRedundanciesTarget,
+ start: number
+ count: number
+ sort: string
+ target: VideoRedundanciesTarget
strategy?: string
}) {
const { start, count, sort, target, strategy } = options
- let redundancyWhere: WhereOptions = {}
- let videosWhere: WhereOptions = {}
+ const redundancyWhere: WhereOptions = {}
+ const videosWhere: WhereOptions = {}
let redundancySqlSuffix = ''
if (target === 'my-videos') {
const videoFilterWhere = {
[Op.and]: [
{
- [ Op.or ]: [
+ [Op.or]: [
{
id: {
- [ Op.in ]: literal(
+ [Op.in]: literal(
'(' +
'SELECT "videoId" FROM "videoFile" ' +
'INNER JOIN "videoRedundancy" ON "videoRedundancy"."videoFileId" = "videoFile".id' +
},
{
id: {
- [ Op.in ]: literal(
+ [Op.in]: literal(
'(' +
'select "videoId" FROM "videoStreamingPlaylist" ' +
'INNER JOIN "videoRedundancy" ON "videoRedundancy"."videoStreamingPlaylistId" = "videoStreamingPlaylist".id' +
}
return VideoRedundancyModel.findOne(query)
- .then((r: any) => ({
- totalUsed: parseAggregateResult(r.totalUsed),
- totalVideos: r.totalVideos,
- totalVideoFiles: r.totalVideoFiles
- }))
+ .then((r: any) => ({
+ totalUsed: parseAggregateResult(r.totalUsed),
+ totalVideos: r.totalVideos,
+ totalVideoFiles: r.totalVideoFiles
+ }))
}
static toFormattedJSONStatic (video: MVideoForRedundancyAPI): VideoRedundancy {
- let filesRedundancies: FileRedundancyInformation[] = []
- let streamingPlaylistsRedundancies: StreamingPlaylistRedundancyInformation[] = []
+ const filesRedundancies: FileRedundancyInformation[] = []
+ const streamingPlaylistsRedundancies: StreamingPlaylistRedundancyInformation[] = []
for (const file of video.VideoFiles) {
for (const redundancy of file.RedundancyVideos) {
expires: this.expiresOn ? this.expiresOn.toISOString() : null,
url: {
type: 'Link',
- mediaType: MIMETYPES.VIDEO.EXT_MIMETYPE[ this.VideoFile.extname ] as any,
+ mediaType: MIMETYPES.VIDEO.EXT_MIMETYPE[this.VideoFile.extname] as any,
href: this.fileUrl,
height: this.VideoFile.resolution,
size: this.VideoFile.size,
const notIn = literal(
'(' +
- `SELECT "videoFileId" FROM "videoRedundancy" WHERE "actorId" = ${actor.id} AND "videoFileId" IS NOT NULL` +
+ `SELECT "videoFileId" FROM "videoRedundancy" WHERE "actorId" = ${actor.id} AND "videoFileId" IS NOT NULL` +
')'
)
required: true,
where: {
id: {
- [ Op.notIn ]: notIn
+ [Op.notIn]: notIn
}
}
}