diff options
author | bobzel <zzzman@gmail.com> | 2022-09-15 13:05:03 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-09-15 13:05:03 -0400 |
commit | 7be2e01b91fa9f9788a794811a75478699b96867 (patch) | |
tree | 53f3b80621ba9b6b0a37956ed62141acb0f5f9fe | |
parent | c4c509bd2de2936f6094e3b1aa9839ed1287bc80 (diff) |
from last
-rw-r--r-- | src/server/DashUploadUtils.ts | 8 |
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)); }); |