aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErazor2 <jeromewhweb@gmail.com>2022-01-17 18:47:32 +0000
committerErazor2 <jeromewhweb@gmail.com>2022-01-17 18:47:32 +0000
commit1ebf1da076a993be60734d7019ae9a8d98b8c97a (patch)
treeff17132506347f9c01e2d003176355f19706b64b
parentUpdated Readme (diff)
downloadmetube-1ebf1da076a993be60734d7019ae9a8d98b8c97a.tar.gz
metube-1ebf1da076a993be60734d7019ae9a8d98b8c97a.tar.bz2
metube-1ebf1da076a993be60734d7019ae9a8d98b8c97a.zip
Added Env-Var for State-Directory
-rw-r--r--Dockerfile3
-rw-r--r--README.md1
-rw-r--r--app/main.py1
-rw-r--r--app/ytdl.py4
4 files changed, 6 insertions, 3 deletions
diff --git a/Dockerfile b/Dockerfile
index 64c3cea..eab5f53 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,7 +25,8 @@ COPY app ./app
COPY --from=builder /metube/dist/metube ./ui/dist/metube
ENV DOWNLOAD_DIR /downloads
+ENV STATE_DIR /state
VOLUME /downloads
-VOLUME /queue
+VOLUME /state
EXPOSE 8081
CMD ["python3", "app/main.py"]
diff --git a/README.md b/README.md
index 6056dc0..1f3bcdd 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,7 @@ Certain values can be set via environment variables, using the `-e` parameter on
* __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 audio-only downloads will be saved, if you wish to separate them from the video downloads. Defaults to the value of `DOWNLOAD_DIR`.
+* __STATE_DIR__: path to where the queue-state-files will be saved. Defaults to `/state` 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/yt-dlp/yt-dlp/blob/master/README.md#output-template). Defaults to `%(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#L176). 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 f901afc..5d59958 100644
--- a/app/main.py
+++ b/app/main.py
@@ -16,6 +16,7 @@ class Config:
_DEFAULTS = {
'DOWNLOAD_DIR': '.',
'AUDIO_DOWNLOAD_DIR': '%%DOWNLOAD_DIR',
+ 'STATE_DIR': '.',
'URL_PREFIX': '',
'OUTPUT_TEMPLATE': '%(title)s.%(ext)s',
'YTDL_OPTIONS': '{}',
diff --git a/app/ytdl.py b/app/ytdl.py
index c91e4fc..c77347e 100644
--- a/app/ytdl.py
+++ b/app/ytdl.py
@@ -184,8 +184,8 @@ class DownloadQueue:
def __init__(self, config, notifier):
self.config = config
self.notifier = notifier
- self.queue = PersistentQueue('/queue/queue')
- self.done = PersistentQueue('/queue/done', True)
+ self.queue = PersistentQueue(self.config.STATE_DIR + '/queue')
+ self.done = PersistentQueue(self.config.STATE_DIR + '/completed', True)
self.initialized = False
self.imported = False
bgstack15