From a0eeb45f14bab539f505861cad8f5d42d9ba30cb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 8 Apr 2021 10:35:49 +0200 Subject: Update data in DB when regenerate thumbnails --- server/models/account/actor-image.ts | 5 +++++ server/models/video/video.ts | 9 --------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'server/models') diff --git a/server/models/account/actor-image.ts b/server/models/account/actor-image.ts index b779e3cf6..f7438991a 100644 --- a/server/models/account/actor-image.ts +++ b/server/models/account/actor-image.ts @@ -1,6 +1,7 @@ import { remove } from 'fs-extra' import { join } from 'path' import { AfterDestroy, AllowNull, Column, CreatedAt, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' +import { v4 as uuidv4 } from 'uuid' import { MActorImageFormattable } from '@server/types/models' import { ActorImageType } from '@shared/models' import { ActorImage } from '../../../shared/models/actors/actor-image.model' @@ -53,6 +54,10 @@ export class ActorImageModel extends Model { .catch(err => logger.error('Cannot remove actor image file %s.', instance.filename, err)) } + static generateFilename () { + return uuidv4() + '.jpg' + } + static loadByName (filename: string) { const query = { where: { diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 086269921..b10c6e38e 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -24,7 +24,6 @@ import { Table, UpdatedAt } from 'sequelize-typescript' -import { v4 as uuidv4 } from 'uuid' import { buildNSFWFilter } from '@server/helpers/express-utils' import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video' import { LiveManager } from '@server/lib/live-manager' @@ -1871,20 +1870,12 @@ export class VideoModel extends Model { this.Thumbnails.push(savedThumbnail) } - generateThumbnailName () { - return uuidv4() + '.jpg' - } - getMiniature () { if (Array.isArray(this.Thumbnails) === false) return undefined return this.Thumbnails.find(t => t.type === ThumbnailType.MINIATURE) } - generatePreviewName () { - return uuidv4() + '.jpg' - } - hasPreview () { return !!this.getPreview() } -- cgit v1.2.3