Skip to content

Commit

Permalink
fix validate errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jygaulier committed Jan 9, 2025
1 parent f4c6643 commit 121fdfd
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions databox/indexer/src/handlers/phraseanet/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {escapePath, escapeSlashes, splitPath} from '../../lib/pathUtils';
import {AttributeDefinition, Tag} from '../../databox/types';
import Twig from 'twig';
import {Logger} from 'winston';
import {DataboxClient} from '../../databox/client.ts';
import {DataboxClient} from '../../databox/client';

export const phraseanetIndexer: IndexIterator<PhraseanetConfig> =
async function* (location, logger, databoxClient, options) {
Expand Down Expand Up @@ -135,7 +135,7 @@ export const phraseanetIndexer: IndexIterator<PhraseanetConfig> =
importStories = true;
}

const sourceCollections = await getSourceCollections(databoxClient, workspaceId, phraseanetDatabox, dm, collectionKeyPrefix, logger);
const sourceCollections = await getSourceCollections(phraseanetDatabox, dm, logger);
const searchParams = {
bases: sourceCollections, // if empty (no collections on config) : search all collections
};
Expand Down Expand Up @@ -234,8 +234,8 @@ export const phraseanetIndexer: IndexIterator<PhraseanetConfig> =
const template = Twig.twig({data: ct});
const paths = (await template.renderAsync({record: r, collection: phraseanetDatabox.collections[r.base_id]}))
.split('\n')
.map(p => p.trim())
.filter(p => p);
.map((p: string) => p.trim())
.filter((p: string) => p);

for (const path of paths) {
const branch = splitPath(path);
Expand Down Expand Up @@ -285,11 +285,8 @@ export const phraseanetIndexer: IndexIterator<PhraseanetConfig> =
};

async function getSourceCollections(
databoxClient: DataboxClient,
workspaceId: string,
phraseanetDatabox: PhraseanetDatabox,
dm: ConfigDataboxMapping,
collectionKeyPrefix: string,
logger: Logger
): Promise<string[]> {
const sourceCollections: string[] = [];
Expand Down Expand Up @@ -736,17 +733,18 @@ function translateVideoSettings(sd: PhraseanetSubdefStruct): object {

function translateVideoSettings_withVcodec(sd: PhraseanetSubdefStruct): object {
// todo : acodec, formats, ...
let format;
let format: string;
switch(sd.options['vcodec'] ?? '') {
case 'libx264':
format = 'video-mp4';
break;
case 'libvpx':
format = 'video-webm';
break;
case 'libtheora':
format = 'video-webm';
break;
case 'libx264':
default:
format = 'video-mp4';
break;
}
const size = sd.options['size'] ?? 100;
let ffmpegModuleOptions: any = {
Expand Down Expand Up @@ -836,7 +834,7 @@ function translateVideoSettings_withIcodec(sd: PhraseanetSubdefStruct): object {
}

function translateVideoSettings_targetImageFrame(sd: PhraseanetSubdefStruct): object {
let format;
let format: string;
switch (sd.options['icodec'] ?? '') {
case 'jpeg':
format = 'image-jpeg';
Expand Down

0 comments on commit 121fdfd

Please sign in to comment.