Skip to content

Commit

Permalink
Use media-download directory everywhere in media-download service
Browse files Browse the repository at this point in the history
  • Loading branch information
philmcmahon committed Jan 6, 2025
1 parent e8a1d03 commit 9634016
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/media-download/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
MediaDownloadJob,
} from '@guardian/transcription-service-common';

const DOWNLOAD_DIRECTORY = '/media-download';
export const MEDIA_DOWNLOAD_WORKING_DIRECTORY = '/media-download';

const uploadToS3 = async (
s3Client: S3Client,
Expand Down Expand Up @@ -143,7 +143,7 @@ const main = async () => {

const metadata = await downloadMedia(
job.url,
DOWNLOAD_DIRECTORY,
MEDIA_DOWNLOAD_WORKING_DIRECTORY,
job.id,
proxyUrl,
);
Expand Down
9 changes: 7 additions & 2 deletions packages/media-download/src/yt-dlp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'node:fs';
import { runSpawnCommand } from '@guardian/transcription-service-backend-common/src/process';
import { logger } from '@guardian/transcription-service-backend-common';
import { MEDIA_DOWNLOAD_WORKING_DIRECTORY } from './index';

export type MediaMetadata = {
title: string;
Expand All @@ -26,7 +27,11 @@ export const startProxyTunnel = async (
port: number,
): Promise<string> => {
try {
fs.writeFileSync('/tmp/media_download', key + '\n', { mode: 0o600 });
fs.writeFileSync(
`${MEDIA_DOWNLOAD_WORKING_DIRECTORY}/media_download`,
key + '\n',
{ mode: 0o600 },
);
const result = await runSpawnCommand(
'startProxyTunnel',
'ssh',
Expand All @@ -42,7 +47,7 @@ export const startProxyTunnel = async (
'-N',
'-f',
'-i',
'/tmp/media_download',
`${MEDIA_DOWNLOAD_WORKING_DIRECTORY}/media_download`,
`media_download@${ip}`,
],
true,
Expand Down

0 comments on commit 9634016

Please sign in to comment.