diff options
author | Alex Shnitman <alexta69@gmail.com> | 2022-01-26 08:25:53 +0200 |
---|---|---|
committer | Alex Shnitman <alexta69@gmail.com> | 2022-01-26 08:25:53 +0200 |
commit | 7b94a4fabdd6a5636e5ead94085699bdd5cf0a7f (patch) | |
tree | 29675e1b1b1cca22bc8fe0bf531347853b0941b4 | |
parent | use LTS node version (diff) | |
download | metube-7b94a4fabdd6a5636e5ead94085699bdd5cf0a7f.tar.gz metube-7b94a4fabdd6a5636e5ead94085699bdd5cf0a7f.tar.bz2 metube-7b94a4fabdd6a5636e5ead94085699bdd5cf0a7f.zip |
change default path of queue persistence files (closes #110)
-rw-r--r-- | Dockerfile | 3 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | app/ytdl.py | 5 |
3 files changed, 7 insertions, 6 deletions
@@ -25,8 +25,7 @@ COPY app ./app COPY --from=builder /metube/dist/metube ./ui/dist/metube
ENV DOWNLOAD_DIR /downloads
-ENV STATE_DIR /state
+ENV STATE_DIR /downloads/.metube
VOLUME /downloads
-VOLUME /state
EXPOSE 8081
CMD ["python3", "app/main.py"]
@@ -10,7 +10,7 @@ Web GUI for youtube-dl (using the [yt-dlp](https://github.com/yt-dlp/yt-dlp) for ## Run using Docker
```bash
-docker run -d -p 8081:8081 -v /path/to/downloads:/downloads -v /path/to/state:/state --user 1001:1001 alexta69/metube
+docker run -d -p 8081:8081 -v /path/to/downloads:/downloads --user 1001:1001 alexta69/metube
```
## Run using docker-compose
@@ -27,7 +27,6 @@ services: - "8081:8081"
volumes:
- /path/to/downloads:/downloads
- - /path/to/state:/state # optional, if you want download queue persistence between re-creations of the container
```
## Configuration via environment variables
@@ -35,7 +34,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 persistence files will be saved. Defaults to `/state` in the docker image, and `.` otherwise.
+* __STATE_DIR__: path to where the queue persistence files will be saved. Defaults to `/downloads/.metube` 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/ytdl.py b/app/ytdl.py index deb745c..6e406b0 100644 --- a/app/ytdl.py +++ b/app/ytdl.py @@ -136,9 +136,12 @@ class Download: class PersistentQueue:
def __init__(self, path):
- self.path = path
+ pdir = os.path.dirname(path)
+ if not os.path.isdir(pdir):
+ os.mkdir(pdir)
with shelve.open(path, 'c'):
pass
+ self.path = path
self.dict = OrderedDict()
def load(self):
|