1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Update data in DB when regenerate thumbnails

This commit is contained in:
Chocobozzz 2021-04-08 10:35:49 +02:00
parent ca87329289
commit a0eeb45f14
No known key found for this signature in database
GPG key ID: 583A612D890159BE
6 changed files with 52 additions and 27 deletions

View file

@ -3,6 +3,7 @@ import { maxBy, minBy } from 'lodash'
import * as magnetUtil from 'magnet-uri'
import { basename, join } from 'path'
import { Transaction } from 'sequelize/types'
import { ActorImageModel } from '@server/models/account/actor-image'
import { TrackerModel } from '@server/models/server/tracker'
import { VideoLiveModel } from '@server/models/video/video-live'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
@ -899,7 +900,7 @@ function getPreviewFromIcons (videoObject: VideoObject) {
function getPreviewUrl (previewIcon: ActivityIconObject, video: MVideoWithHost) {
return previewIcon
? previewIcon.url
: buildRemoteVideoBaseUrl(video, join(LAZY_STATIC_PATHS.PREVIEWS, video.generatePreviewName()))
: buildRemoteVideoBaseUrl(video, join(LAZY_STATIC_PATHS.PREVIEWS, ActorImageModel.generateFilename()))
}
function getTrackerUrls (object: VideoObject, video: MVideoWithHost) {

View file

@ -1,4 +1,5 @@
import { join } from 'path'
import { ActorImageModel } from '@server/models/account/actor-image'
import { ThumbnailType } from '../../shared/models/videos/thumbnail.type'
import { generateImageFromVideoFile } from '../helpers/ffmpeg-utils'
import { processImage } from '../helpers/image-utils'
@ -200,7 +201,7 @@ function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, si
: undefined
if (type === ThumbnailType.MINIATURE) {
const filename = video.generateThumbnailName()
const filename = ActorImageModel.generateFilename()
const basePath = CONFIG.STORAGE.THUMBNAILS_DIR
return {
@ -214,7 +215,7 @@ function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, si
}
if (type === ThumbnailType.PREVIEW) {
const filename = video.generatePreviewName()
const filename = ActorImageModel.generateFilename()
const basePath = CONFIG.STORAGE.PREVIEWS_DIR
return {