1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-11-23 22:24:44 +02:00

Allow Video converter extensions #977

This commit is contained in:
Patrik J. Braun
2025-11-01 18:21:01 +01:00
parent 3cf1359f2e
commit fc9f3fc6c1
3 changed files with 16 additions and 4 deletions

View File

@@ -139,6 +139,7 @@ App CLI options:
--Search-listMetafiles Search also returns with metafiles from directories that contain a media file of the matched search result. (default: true) --Search-listMetafiles Search also returns with metafiles from directories that contain a media file of the matched search result. (default: true)
--Sharing-enabled Enables sharing. (default: true) --Sharing-enabled Enables sharing. (default: true)
--Sharing-passwordRequired Requires password protected sharing links. (default: false) --Sharing-passwordRequired Requires password protected sharing links. (default: false)
--Sharing-sharingKeyLength The longer the keys are, the harder they are to guess. Changing this number won't invalidate existing sharing. (default: 8)
--Sharing-updateTimeout After creating a sharing link, it can be updated for this long. (default: 300000) --Sharing-updateTimeout After creating a sharing link, it can be updated for this long. (default: 300000)
--Map-enabled (default: true) --Map-enabled (default: true)
--Map-useImageMarkers Map will use thumbnail images as markers instead of the default pin. (default: true) --Map-useImageMarkers Map will use thumbnail images as markers instead of the default pin. (default: true)
@@ -170,7 +171,7 @@ App CLI options:
--Indexing-excludeFolderList Folders to exclude from indexing. If an entry starts with '/' it is treated as an absolute path. If it doesn't start with '/' but contains a '/', the path is relative to the image directory. If it doesn't contain a '/', any folder with this name will be excluded. (default: [".Trash-1000",".dtrash","$RECYCLE.BIN"]) --Indexing-excludeFolderList Folders to exclude from indexing. If an entry starts with '/' it is treated as an absolute path. If it doesn't start with '/' but contains a '/', the path is relative to the image directory. If it doesn't contain a '/', any folder with this name will be excluded. (default: [".Trash-1000",".dtrash","$RECYCLE.BIN"])
--Indexing-excludeFileList Files that mark a folder to be excluded from indexing. Any folder that contains a file with this name will be excluded from indexing. (default: []) --Indexing-excludeFileList Files that mark a folder to be excluded from indexing. Any folder that contains a file with this name will be excluded from indexing. (default: [])
--AlbumCover-SearchQuery Filters the sub-folders with this search query. If filter results no photo, the app will search again without the filter. (default: {"type":100,"text":""}) --AlbumCover-SearchQuery Filters the sub-folders with this search query. If filter results no photo, the app will search again without the filter. (default: {"type":100,"text":""})
--AlbumCover-Sorting If multiple cover is available sorts them by these methods and selects the first one. (default: [{"method":30,"ascending":false},{"method":20,"ascending":false},{"method":40,"ascending":false}]) --AlbumCover-Sorting If multiple cover is available sorts them by these methods and selects the first one. Using random sorting does not allow to use any other sorting method. (default: [{"method":30,"ascending":false},{"method":20,"ascending":false},{"method":40,"ascending":false}])
--Duplicates-listingLimit Maximum number of duplicates to list. (default: 1000) --Duplicates-listingLimit Maximum number of duplicates to list. (default: 1000)
--Messaging-Email-emailFrom Some services do not allow sending from random e-mail addresses. Set this accordingly. (default: 'noreply@pigallery2.com') --Messaging-Email-emailFrom Some services do not allow sending from random e-mail addresses. Set this accordingly. (default: 'noreply@pigallery2.com')
--Messaging-Email-smtp-host SMTP host server (default: '') --Messaging-Email-smtp-host SMTP host server (default: '')
@@ -298,6 +299,7 @@ Environmental variables:
Search-listMetafiles Search also returns with metafiles from directories that contain a media file of the matched search result. (default: true) Search-listMetafiles Search also returns with metafiles from directories that contain a media file of the matched search result. (default: true)
Sharing-enabled Enables sharing. (default: true) Sharing-enabled Enables sharing. (default: true)
Sharing-passwordRequired Requires password protected sharing links. (default: false) Sharing-passwordRequired Requires password protected sharing links. (default: false)
Sharing-sharingKeyLength The longer the keys are, the harder they are to guess. Changing this number won't invalidate existing sharing. (default: 8)
Sharing-updateTimeout After creating a sharing link, it can be updated for this long. (default: 300000) Sharing-updateTimeout After creating a sharing link, it can be updated for this long. (default: 300000)
Map-enabled (default: true) Map-enabled (default: true)
Map-useImageMarkers Map will use thumbnail images as markers instead of the default pin. (default: true) Map-useImageMarkers Map will use thumbnail images as markers instead of the default pin. (default: true)
@@ -334,7 +336,7 @@ Environmental variables:
Indexing-excludeFolderList Folders to exclude from indexing. If an entry starts with '/' it is treated as an absolute path. If it doesn't start with '/' but contains a '/', the path is relative to the image directory. If it doesn't contain a '/', any folder with this name will be excluded. (default: [".Trash-1000",".dtrash","$RECYCLE.BIN"]) Indexing-excludeFolderList Folders to exclude from indexing. If an entry starts with '/' it is treated as an absolute path. If it doesn't start with '/' but contains a '/', the path is relative to the image directory. If it doesn't contain a '/', any folder with this name will be excluded. (default: [".Trash-1000",".dtrash","$RECYCLE.BIN"])
Indexing-excludeFileList Files that mark a folder to be excluded from indexing. Any folder that contains a file with this name will be excluded from indexing. (default: []) Indexing-excludeFileList Files that mark a folder to be excluded from indexing. Any folder that contains a file with this name will be excluded from indexing. (default: [])
AlbumCover-SearchQuery Filters the sub-folders with this search query. If filter results no photo, the app will search again without the filter. (default: {"type":100,"text":""}) AlbumCover-SearchQuery Filters the sub-folders with this search query. If filter results no photo, the app will search again without the filter. (default: {"type":100,"text":""})
AlbumCover-Sorting If multiple cover is available sorts them by these methods and selects the first one. (default: [{"method":30,"ascending":false},{"method":20,"ascending":false},{"method":40,"ascending":false}]) AlbumCover-Sorting If multiple cover is available sorts them by these methods and selects the first one. Using random sorting does not allow to use any other sorting method. (default: [{"method":30,"ascending":false},{"method":20,"ascending":false},{"method":40,"ascending":false}])
Duplicates-listingLimit Maximum number of duplicates to list. (default: 1000) Duplicates-listingLimit Maximum number of duplicates to list. (default: 1000)
Messaging-Email-emailFrom Some services do not allow sending from random e-mail addresses. Set this accordingly. (default: 'noreply@pigallery2.com') Messaging-Email-emailFrom Some services do not allow sending from random e-mail addresses. Set this accordingly. (default: 'noreply@pigallery2.com')
Messaging-Email-smtp-host SMTP host server (default: '') Messaging-Email-smtp-host SMTP host server (default: '')
@@ -686,6 +688,8 @@ Environmental variables:
"enabled": true, "enabled": true,
"//[passwordRequired]": "Requires password protected sharing links.", "//[passwordRequired]": "Requires password protected sharing links.",
"passwordRequired": false, "passwordRequired": false,
"//[sharingKeyLength]": "The longer the keys are, the harder they are to guess. Changing this number won't invalidate existing sharing.",
"sharingKeyLength": 8,
"//[updateTimeout]": "After creating a sharing link, it can be updated for this long.", "//[updateTimeout]": "After creating a sharing link, it can be updated for this long.",
"updateTimeout": 300000 "updateTimeout": 300000
}, },
@@ -984,7 +988,7 @@ Environmental variables:
"type": 100, "type": 100,
"text": "" "text": ""
}, },
"//[Sorting]": "If multiple cover is available sorts them by these methods and selects the first one.", "//[Sorting]": "If multiple cover is available sorts them by these methods and selects the first one. Using random sorting does not allow to use any other sorting method.",
"Sorting": [ "Sorting": [
{ {
"method": "Rating", "method": "Rating",

View File

@@ -19,6 +19,7 @@ import {DirectoryScanSettings} from '../fileaccess/DiskManager';
import {SessionContext} from '../SessionContext'; import {SessionContext} from '../SessionContext';
import {IClientMediaButtonConfig} from '../../../common/entities/extension/IClientUIConfig'; import {IClientMediaButtonConfig} from '../../../common/entities/extension/IClientUIConfig';
import {MediaEntity} from '../database/enitites/MediaEntity'; import {MediaEntity} from '../database/enitites/MediaEntity';
import {VideoConverterInput} from '../fileaccess/VideoConverterWorker';
export type IExtensionBeforeEventHandler<I extends unknown[], O> = (input: I, event: { stopPropagation: boolean }) => Promise<I | O>; export type IExtensionBeforeEventHandler<I extends unknown[], O> = (input: I, event: { stopPropagation: boolean }) => Promise<I | O>;
@@ -59,6 +60,12 @@ export interface IExtensionEvents {
*/ */
invalidateDirectoryCache: IExtensionEvent<[ParentDirectoryDTO], void>; invalidateDirectoryCache: IExtensionEvent<[ParentDirectoryDTO], void>;
}, },
VideoConverter:{
/**
* Converts videos with ffmpeg
*/
convert: IExtensionEvent<[VideoConverterInput], void>
},
ImageRenderer: { ImageRenderer: {
/** /**
* Renders a thumbnail or photo * Renders a thumbnail or photo

View File

@@ -3,6 +3,7 @@ import {promises as fsp} from 'fs';
import {FfmpegCommand} from 'fluent-ffmpeg'; import {FfmpegCommand} from 'fluent-ffmpeg';
import {FFmpegFactory} from '../FFmpegFactory'; import {FFmpegFactory} from '../FFmpegFactory';
import {FFmpegPresets, videoCodecType, videoFormatType, videoResolutionType,} from '../../../common/config/private/PrivateConfig'; import {FFmpegPresets, videoCodecType, videoFormatType, videoResolutionType,} from '../../../common/config/private/PrivateConfig';
import {ExtensionDecorator} from '../extension/ExtensionDecorator';
export interface VideoConverterInput { export interface VideoConverterInput {
videoPath: string; videoPath: string;
@@ -25,6 +26,7 @@ export interface VideoConverterInput {
export class VideoConverterWorker { export class VideoConverterWorker {
private static ffmpeg = FFmpegFactory.get(); private static ffmpeg = FFmpegFactory.get();
@ExtensionDecorator(e => e.gallery.VideoConverter.convert)
public static async convert(input: VideoConverterInput): Promise<void> { public static async convert(input: VideoConverterInput): Promise<void> {
const origPath = input.output.path; const origPath = input.output.path;
input.output.path = origPath + '.part'; input.output.path = origPath + '.part';
@@ -90,7 +92,6 @@ export class VideoConverterWorker {
if (input.output.customOptions) { if (input.output.customOptions) {
command.addOption(input.output.customOptions); command.addOption(input.output.customOptions);
} }
// set output format to force // set output format to force
command command
.format(input.output.format) .format(input.output.format)