aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile3
-rw-r--r--README.md1
-rw-r--r--app/main.py1
-rw-r--r--app/ytdl.py3
4 files changed, 6 insertions, 2 deletions
diff --git a/Dockerfile b/Dockerfile
index 2405d1b..1f19971 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,7 +2,7 @@ FROM node as builder
WORKDIR /metube
COPY ui ./
-RUN npm install && \
+RUN npm ci && \
node_modules/.bin/ng build --prod
@@ -25,6 +25,7 @@ COPY app ./app
COPY --from=builder /metube/dist/metube ./ui/dist/metube
ENV DOWNLOAD_DIR /downloads
+ENV AUDIO_DOWNLOAD_DIR /downloads
VOLUME /downloads
EXPOSE 8081
CMD ["python3", "app/main.py"]
diff --git a/README.md b/README.md
index 3997f46..4942bad 100644
--- a/README.md
+++ b/README.md
@@ -34,6 +34,7 @@ services:
Certain values can be set via environment variables, using the `-e` parameter on the docker command line, or the `environment:` section in docker-compose.
* __DOWNLOAD_DIR__: path to where the downloads will be saved. Defaults to `/downloads` in the docker image, and `.` otherwise.
+* __AUDIO_DOWNLOAD_DIR__: path to where the audio downloads will be saved. Defaults to `/downloads` in the docker image, and `.` otherwise.
* __URL_PREFIX__: base path for the web server (for use when hosting behind a reverse proxy). Defaults to `/`.
* __OUTPUT_TEMPLATE__: the template for the filenames of the downloaded videos, formatted according to [this spec](https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template). Defaults to `%(title)s.%(ext)s`.
diff --git a/app/main.py b/app/main.py
index b8b512d..194bba6 100644
--- a/app/main.py
+++ b/app/main.py
@@ -16,6 +16,7 @@ log = logging.getLogger('main')
class Config:
_DEFAULTS = {
'DOWNLOAD_DIR': '.',
+ 'AUDIO_DOWNLOAD_DIR': '.',
'URL_PREFIX': '',
'OUTPUT_TEMPLATE': '%(title)s.%(ext)s',
}
diff --git a/app/ytdl.py b/app/ytdl.py
index c6b09ff..d29f108 100644
--- a/app/ytdl.py
+++ b/app/ytdl.py
@@ -148,7 +148,8 @@ class DownloadQueue:
elif etype == 'video' or etype.startswith('url') and 'id' in entry:
if entry['id'] not in self.queue:
dl = DownloadInfo(entry['id'], entry['title'], entry.get('webpage_url') or entry['url'])
- self.queue[entry['id']] = Download(self.config.DOWNLOAD_DIR, self.config.OUTPUT_TEMPLATE, quality, dl)
+ dldirectory = self.config.DOWNLOAD_DIR if quality != 'audio' else self.config.AUDIO_DOWNLOAD_DIR
+ self.queue[entry['id']] = Download(dldirectory, self.config.OUTPUT_TEMPLATE, quality, dl)
self.event.set()
await self.notifier.added(dl)
return {'status': 'ok'}
bgstack15