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:
parent
ca87329289
commit
a0eeb45f14
6 changed files with 52 additions and 27 deletions
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue