mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Update data in DB when regenerate thumbnails
This commit is contained in:
parent
ca87329289
commit
a0eeb45f14
6 changed files with 52 additions and 27 deletions
|
@ -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: {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue