+ static loadWithVideoByFilename (filename: string, thumbnailType: ThumbnailType): Promise<MThumbnailVideo> {
+ const query = {
+ where: {
+ filename,
+ type: thumbnailType
+ },
+ include: [
+ {
+ model: VideoModel.unscoped(),
+ required: true
+ }
+ ]
+ }
+
+ return ThumbnailModel.findOne(query)
+ }
+
+ static buildPath (type: ThumbnailType, filename: string) {
+ const directory = ThumbnailModel.types[type].directory
+
+ return join(directory, filename)