Skip to content

Commit

Permalink
feat: configurable staging dir
Browse files Browse the repository at this point in the history
  • Loading branch information
birme committed Jul 4, 2024
1 parent 5dd906e commit 33ec90d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ COPY --chown=node:node ["src", "./src"]
RUN npm pkg delete scripts.prepare \
&& npm ci --omit=dev
COPY --from=google/shaka-packager:v3.2.0 /usr/bin/packager /usr/bin/packager
ENV STAGING_DIR=/data
VOLUME [ "/data" ]
CMD [ "npm", "run", "start", "--", "-r" ]
4 changes: 3 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface PackagingConfig {
packageListenerPlugin?: string;
encorePassword?: string;
oscAccessToken?: string;
stagingDir?: string;
}

function readRedisConfig(): RedisConfig {
Expand All @@ -42,7 +43,8 @@ function readPackagingConfig(): PackagingConfig {
concurrency: parseInt(process.env.PACKAGE_CONCURRENCY || '1'),
packageListenerPlugin: process.env.PACKAGE_LISTENER_PLUGIN,
encorePassword: process.env.ENCORE_PASSWORD,
oscAccessToken: process.env.OSC_ACCESS_TOKEN
oscAccessToken: process.env.OSC_ACCESS_TOKEN,
stagingDir: process.env.STAGING_DIR
};
}

Expand Down
7 changes: 3 additions & 4 deletions src/encorePackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export class EncorePackager {
source: this.config.oscAccessToken ? new URL(jobUrl).origin : undefined,
serviceAccessToken,
noImplicitAudio: true,
shakaExecutable: this.config.shakaExecutable
shakaExecutable: this.config.shakaExecutable,
stagingDir: this.config.stagingDir
} as PackageOptions);
console.log(`Finished packaging of job ${job.id} to output folder ${dest}`);
}
Expand Down Expand Up @@ -109,9 +110,7 @@ export function parseInputsFromEncoreJob(job: EncoreJob) {
throw new Error('Encore job has no output');
}
const video = job.output
.filter(
(output) => output.type === 'VideoFile'
)
.filter((output) => output.type === 'VideoFile')
.map((output) => ({ output, videoStream: output.videoStreams?.[0] }));
const audio = job.output
.filter((output) => output.type === 'AudioFile')
Expand Down

0 comments on commit 33ec90d

Please sign in to comment.