From 536598cfafab1c5e24e881db1c528489f804fb6b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 16 May 2019 16:55:34 +0200 Subject: Add audio support in upload --- server/models/video/thumbnail.ts | 8 +++++--- server/models/video/video-file.ts | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'server/models/video') diff --git a/server/models/video/thumbnail.ts b/server/models/video/thumbnail.ts index 206e9a3d6..8faf0adba 100644 --- a/server/models/video/thumbnail.ts +++ b/server/models/video/thumbnail.ts @@ -107,10 +107,12 @@ export class ThumbnailModel extends Model { return WEBSERVER.URL + staticPath + this.filename } - removeThumbnail () { + getPath () { const directory = ThumbnailModel.types[this.type].directory - const thumbnailPath = join(directory, this.filename) + return join(directory, this.filename) + } - return remove(thumbnailPath) + removeThumbnail () { + return remove(this.getPath()) } } diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 2203a7aba..05c490759 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts @@ -24,6 +24,7 @@ import { VideoModel } from './video' import { VideoRedundancyModel } from '../redundancy/video-redundancy' import { VideoStreamingPlaylistModel } from './video-streaming-playlist' import { FindOptions, QueryTypes, Transaction } from 'sequelize' +import { MIMETYPES } from '../../initializers/constants' @Table({ tableName: 'videoFile', @@ -161,6 +162,10 @@ export class VideoFileModel extends Model { })) } + isAudio () { + return !!MIMETYPES.AUDIO.EXT_MIMETYPE[this.extname] + } + hasSameUniqueKeysThan (other: VideoFileModel) { return this.fps === other.fps && this.resolution === other.resolution && -- cgit v1.2.3