From 375ab9115e7d63735f50ace103b92d3dca1aaaae Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 24 Jul 2024 18:24:37 +0300 Subject: [PATCH] Fix yt-dlp cli and docker image --- Dockerfile | 6 ++---- src/client/components/downloaders/yt-dlp.ts | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 579a0bd..2c7588c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,16 +6,14 @@ WORKDIR /musicbot COPY package.json package.json COPY ./.yarnrc.yml ./.yarnrc.yml COPY ./.yarn/releases ./.yarn/releases -# CMD ["/bin/ash"] RUN yarn install FROM node:lts-alpine -RUN apk update && apk add ffmpeg +RUN apk update && apk add ffmpeg python3 COPY --from=zotify /app/dist/zotify /bin/zotify WORKDIR /musicbot COPY build build COPY --from=builder /musicbot/node_modules ./node_modules COPY package.json package.json VOLUME [ "/musicbot/cache" ] -CMD ["node", "--enable-source-maps", "build/index.js"] -# CMD ["/bin/ash"] \ No newline at end of file +CMD ["node", "--enable-source-maps", "build/index.js"] \ No newline at end of file diff --git a/src/client/components/downloaders/yt-dlp.ts b/src/client/components/downloaders/yt-dlp.ts index 2ae5d89..7a1afe2 100644 --- a/src/client/components/downloaders/yt-dlp.ts +++ b/src/client/components/downloaders/yt-dlp.ts @@ -105,7 +105,7 @@ class YtdlpDownloader extends Downloader const { resolve, reject, url } = entry; this.logger.info(`Processing queue, downloading ${url}`); const ts = Date.now(); - exec(`${this.#executable} ${this.#options.join(' ')} -o ${ts}-%(title)s.%(ext)s ${url}`, (error, stdout, stderr) => + exec(`${this.#executable} ${this.#options.join(' ')} -o "${ts}-%(title)s.%(ext)s" ${url}`, (error, stdout, stderr) => { if (error) return reject(error); @@ -123,8 +123,8 @@ class YtdlpDownloader extends Downloader const ext = path.extname(file); const name = file .replace(`${ts}-`, '') - .replace('_', ' ') - .replace(ext, ''); + .replace(ext, '') + .replaceAll('_', ' '); resolve({ filePath: path.resolve('./cache/youtube', file),