From e89da396cd05559e579b8b3c3aeebc362e40ac00 Mon Sep 17 00:00:00 2001 From: vaaski Date: Thu, 2 May 2024 12:56:52 +0200 Subject: [PATCH 1/7] add `PUBLIC_HOST_URL` config key --- app/main.py | 1 + ui/src/app/app.component.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index f77181c..3d70aa1 100644 --- a/app/main.py +++ b/app/main.py @@ -24,6 +24,7 @@ class Config: 'DELETE_FILE_ON_TRASHCAN': 'false', 'STATE_DIR': '.', 'URL_PREFIX': '', + 'PUBLIC_HOST_URL': 'download/', 'OUTPUT_TEMPLATE': '%(title)s.%(ext)s', 'OUTPUT_TEMPLATE_CHAPTER': '%(title)s - %(section_number)s %(section_title)s.%(ext)s', 'YTDL_OPTIONS': '{}', diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index deb2760..650a844 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -233,7 +233,7 @@ export class AppComponent implements AfterViewInit { } buildDownloadLink(download: Download) { - let baseDir = 'download/'; + let baseDir = this.downloads.configuration["PUBLIC_HOST_URL"] ?? 'download/'; if (download.quality == 'audio' || download.filename.endsWith('.mp3')) { baseDir = 'audio_download/'; } From b85f2f358bcac29c1916e2186f85e7006c6d7640 Mon Sep 17 00:00:00 2001 From: vaaski Date: Thu, 2 May 2024 13:02:35 +0200 Subject: [PATCH 2/7] add `PUBLIC_HOST_URL` to Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 1d78d50..f75e764 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,6 +35,7 @@ ENV UMASK=022 ENV DOWNLOAD_DIR /downloads ENV STATE_DIR /downloads/.metube ENV TEMP_DIR /downloads +ENV PUBLIC_HOST_URL download/ VOLUME /downloads EXPOSE 8081 CMD [ "./docker-entrypoint.sh" ] From 16b3319786899a6f81728e845a803b79d28b69fb Mon Sep 17 00:00:00 2001 From: vaaski Date: Thu, 2 May 2024 13:08:32 +0200 Subject: [PATCH 3/7] add `PUBLIC_HOST_URL` to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 141253d..0f0682b 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ Certain values can be set via environment variables, using the `-e` parameter on * __Note__: Using a RAM filesystem may prevent downloads from being resumed * __DELETE_FILE_ON_TRASHCAN__: if `true`, downloaded files are deleted on the server, when they are trashed from the "Completed" section of the UI. Defaults to `false`. * __URL_PREFIX__: base path for the web server (for use when hosting behind a reverse proxy). Defaults to `/`. +* __PUBLIC_HOST_URL__: base path for the links shown in the UI. Requires a trailing slash. Defaults to `download/`. * __OUTPUT_TEMPLATE__: the template for the filenames of the downloaded videos, formatted according to [this spec](https://github.com/yt-dlp/yt-dlp/blob/master/README.md#output-template). Defaults to `%(title)s.%(ext)s`. * __OUTPUT_TEMPLATE_CHAPTER__: the template for the filenames of the downloaded videos, when split into chapters via postprocessors. Defaults to `%(title)s - %(section_number)s %(section_title)s.%(ext)s`. * __YTDL_OPTIONS__: Additional options to pass to youtube-dl, in JSON format. [See available options here](https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/YoutubeDL.py#L183). They roughly correspond to command-line options, though some do not have exact equivalents here, for example `--recode-video` has to be specified via `postprocessors`. Also note that dashes are replaced with underscores. From 3440d0adeba363e1bbcc31b72b2479b441ce05b1 Mon Sep 17 00:00:00 2001 From: vaaski Date: Thu, 2 May 2024 13:10:41 +0200 Subject: [PATCH 4/7] add `PUBLIC_HOST_AUDIO_URL` --- Dockerfile | 1 + README.md | 1 + app/main.py | 1 + ui/src/app/app.component.ts | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f75e764..2477d47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,7 @@ ENV DOWNLOAD_DIR /downloads ENV STATE_DIR /downloads/.metube ENV TEMP_DIR /downloads ENV PUBLIC_HOST_URL download/ +ENV PUBLIC_HOST_AUDIO_URL audio_download/ VOLUME /downloads EXPOSE 8081 CMD [ "./docker-entrypoint.sh" ] diff --git a/README.md b/README.md index 0f0682b..51fae9f 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Certain values can be set via environment variables, using the `-e` parameter on * __DELETE_FILE_ON_TRASHCAN__: if `true`, downloaded files are deleted on the server, when they are trashed from the "Completed" section of the UI. Defaults to `false`. * __URL_PREFIX__: base path for the web server (for use when hosting behind a reverse proxy). Defaults to `/`. * __PUBLIC_HOST_URL__: base path for the links shown in the UI. Requires a trailing slash. Defaults to `download/`. +* __PUBLIC_HOST_AUDIO_URL__: same as PUBLIC_HOST_URL but for audio downloads. Defaults to `audio_download/`. * __OUTPUT_TEMPLATE__: the template for the filenames of the downloaded videos, formatted according to [this spec](https://github.com/yt-dlp/yt-dlp/blob/master/README.md#output-template). Defaults to `%(title)s.%(ext)s`. * __OUTPUT_TEMPLATE_CHAPTER__: the template for the filenames of the downloaded videos, when split into chapters via postprocessors. Defaults to `%(title)s - %(section_number)s %(section_title)s.%(ext)s`. * __YTDL_OPTIONS__: Additional options to pass to youtube-dl, in JSON format. [See available options here](https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/YoutubeDL.py#L183). They roughly correspond to command-line options, though some do not have exact equivalents here, for example `--recode-video` has to be specified via `postprocessors`. Also note that dashes are replaced with underscores. diff --git a/app/main.py b/app/main.py index 3d70aa1..3daed83 100644 --- a/app/main.py +++ b/app/main.py @@ -25,6 +25,7 @@ class Config: 'STATE_DIR': '.', 'URL_PREFIX': '', 'PUBLIC_HOST_URL': 'download/', + 'PUBLIC_HOST_AUDIO_URL': 'audio_download/', 'OUTPUT_TEMPLATE': '%(title)s.%(ext)s', 'OUTPUT_TEMPLATE_CHAPTER': '%(title)s - %(section_number)s %(section_title)s.%(ext)s', 'YTDL_OPTIONS': '{}', diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index 650a844..fc3eeb8 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -235,7 +235,7 @@ export class AppComponent implements AfterViewInit { buildDownloadLink(download: Download) { let baseDir = this.downloads.configuration["PUBLIC_HOST_URL"] ?? 'download/'; if (download.quality == 'audio' || download.filename.endsWith('.mp3')) { - baseDir = 'audio_download/'; + baseDir = this.downloads.configuration["PUBLIC_HOST_AUDIO_URL"] ?? 'audio_download/'; } if (download.folder) { From e126e9c8d13800e53a2e1cbf406135b68191f9ed Mon Sep 17 00:00:00 2001 From: vaaski Date: Thu, 2 May 2024 13:49:14 +0200 Subject: [PATCH 5/7] remove duplicated defaults from `Dockerfile` --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2477d47..1d78d50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,8 +35,6 @@ ENV UMASK=022 ENV DOWNLOAD_DIR /downloads ENV STATE_DIR /downloads/.metube ENV TEMP_DIR /downloads -ENV PUBLIC_HOST_URL download/ -ENV PUBLIC_HOST_AUDIO_URL audio_download/ VOLUME /downloads EXPOSE 8081 CMD [ "./docker-entrypoint.sh" ] From b1422e51025174a2b078e27010dc54ab65aa8ffa Mon Sep 17 00:00:00 2001 From: vaaski Date: Thu, 2 May 2024 13:50:00 +0200 Subject: [PATCH 6/7] remove extra defaults in app component --- ui/src/app/app.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index fc3eeb8..8299f5c 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -233,9 +233,9 @@ export class AppComponent implements AfterViewInit { } buildDownloadLink(download: Download) { - let baseDir = this.downloads.configuration["PUBLIC_HOST_URL"] ?? 'download/'; + let baseDir = this.downloads.configuration["PUBLIC_HOST_URL"]'; if (download.quality == 'audio' || download.filename.endsWith('.mp3')) { - baseDir = this.downloads.configuration["PUBLIC_HOST_AUDIO_URL"] ?? 'audio_download/'; + baseDir = this.downloads.configuration["PUBLIC_HOST_AUDIO_URL"]; } if (download.folder) { From 79e34f7592c77371f664e3b3c87eabc31397fd2e Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 2 May 2024 21:22:36 +0300 Subject: [PATCH 7/7] Update PUBLIC_HOST_URL description --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 51fae9f..10cbe89 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,8 @@ Certain values can be set via environment variables, using the `-e` parameter on * __Note__: Using a RAM filesystem may prevent downloads from being resumed * __DELETE_FILE_ON_TRASHCAN__: if `true`, downloaded files are deleted on the server, when they are trashed from the "Completed" section of the UI. Defaults to `false`. * __URL_PREFIX__: base path for the web server (for use when hosting behind a reverse proxy). Defaults to `/`. -* __PUBLIC_HOST_URL__: base path for the links shown in the UI. Requires a trailing slash. Defaults to `download/`. -* __PUBLIC_HOST_AUDIO_URL__: same as PUBLIC_HOST_URL but for audio downloads. Defaults to `audio_download/`. +* __PUBLIC_HOST_URL__: base URL for the download links shown in the UI for completed files. By default MeTube serves them under its own URL. If your download directory is accessible on another URL and you want the download links to be based there, use this variable to set it. +* __PUBLIC_HOST_AUDIO_URL__: same as PUBLIC_HOST_URL but for audio downloads. * __OUTPUT_TEMPLATE__: the template for the filenames of the downloaded videos, formatted according to [this spec](https://github.com/yt-dlp/yt-dlp/blob/master/README.md#output-template). Defaults to `%(title)s.%(ext)s`. * __OUTPUT_TEMPLATE_CHAPTER__: the template for the filenames of the downloaded videos, when split into chapters via postprocessors. Defaults to `%(title)s - %(section_number)s %(section_title)s.%(ext)s`. * __YTDL_OPTIONS__: Additional options to pass to youtube-dl, in JSON format. [See available options here](https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/YoutubeDL.py#L183). They roughly correspond to command-line options, though some do not have exact equivalents here, for example `--recode-video` has to be specified via `postprocessors`. Also note that dashes are replaced with underscores.