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,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"]
CMD ["node", "--enable-source-maps", "build/index.js"]

View File

@ -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),