aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/DashUploadUtils.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts
index f272e109f..85e197e25 100644
--- a/src/server/DashUploadUtils.ts
+++ b/src/server/DashUploadUtils.ts
@@ -108,18 +108,18 @@ export namespace DashUploadUtils {
res({
source: {
size: 0,
- path: videoId,
+ path: videoId.replace(/^-/, '__'),
name: videoId,
type: '',
- toJSON: () => ({ name: videoId, path: videoId }),
+ toJSON: () => ({ name: videoId, path: videoId.replace(/^-/, '__') }),
},
result: { name: 'failed youtube query', message: `Could not upload YouTube video (${videoId}). Error: ${error.message}` },
});
} else {
- exec('youtube-dl -o ' + (videoId + '.mp4') + ' ' + videoId + ' --get-duration', (error: any, stdout: any, stderr: any) => {
+ exec('youtube-dl -o ' + (videoId.replace(/^-/, '__') + '.mp4') + " 'https://www.youtube.com/watch?v=" + videoId + "' --get-duration", (error: any, stdout: any, stderr: any) => {
const time = Array.from(stdout.trim().split(':')).reverse();
const duration = (time.length > 2 ? Number(time[2]) * 1000 * 60 : 0) + (time.length > 1 ? Number(time[1]) * 60 : 0) + (time.length > 0 ? Number(time[0]) : 0);
- const data = { size: 0, path: videoId + '.mp4', name: videoId, type: 'video/mp4' };
+ const data = { size: 0, path: videoId.replace(/^-/, '__') + '.mp4', name: videoId, type: 'video/mp4' };
const file = { ...data, toJSON: () => ({ ...data, filename: data.path.replace(/.*\//, ''), mtime: duration.toString(), mime: '', toJson: () => undefined as any }) };
res(MoveParsedFile(file, Directory.videos));
});