Fix yt-dlp cli and docker image

This commit is contained in:
Erik 2024-07-24 18:24:37 +03:00
parent 16ee666c4f
commit 375ab9115e
2 changed files with 5 additions and 7 deletions

View File

@ -6,11 +6,10 @@ WORKDIR /musicbot
COPY package.json package.json COPY package.json package.json
COPY ./.yarnrc.yml ./.yarnrc.yml COPY ./.yarnrc.yml ./.yarnrc.yml
COPY ./.yarn/releases ./.yarn/releases COPY ./.yarn/releases ./.yarn/releases
# CMD ["/bin/ash"]
RUN yarn install RUN yarn install
FROM node:lts-alpine 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 COPY --from=zotify /app/dist/zotify /bin/zotify
WORKDIR /musicbot WORKDIR /musicbot
COPY build build COPY build build
@ -18,4 +17,3 @@ COPY --from=builder /musicbot/node_modules ./node_modules
COPY package.json package.json COPY package.json package.json
VOLUME [ "/musicbot/cache" ] VOLUME [ "/musicbot/cache" ]
CMD ["node", "--enable-source-maps", "build/index.js"] CMD ["node", "--enable-source-maps", "build/index.js"]
# CMD ["/bin/ash"]

View File

@ -105,7 +105,7 @@ class YtdlpDownloader extends Downloader
const { resolve, reject, url } = entry; const { resolve, reject, url } = entry;
this.logger.info(`Processing queue, downloading ${url}`); this.logger.info(`Processing queue, downloading ${url}`);
const ts = Date.now(); 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) if (error)
return reject(error); return reject(error);
@ -123,8 +123,8 @@ class YtdlpDownloader extends Downloader
const ext = path.extname(file); const ext = path.extname(file);
const name = file const name = file
.replace(`${ts}-`, '') .replace(`${ts}-`, '')
.replace('_', ' ') .replace(ext, '')
.replace(ext, ''); .replaceAll('_', ' ');
resolve({ resolve({
filePath: path.resolve('./cache/youtube', file), filePath: path.resolve('./cache/youtube', file),