diff --git a/Dockerfile b/Dockerfile index 1d78d50..924445e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ COPY Pipfile* docker-entrypoint.sh ./ # Install dependencies RUN sed -i 's/\r$//g' docker-entrypoint.sh && \ chmod +x docker-entrypoint.sh && \ - apk add --update ffmpeg aria2 coreutils shadow su-exec curl && \ + apk add --update ffmpeg aria2 coreutils shadow su-exec curl tini && \ apk add --update --virtual .build-deps gcc g++ musl-dev && \ pip install --no-cache-dir pipenv && \ pipenv install --system --deploy --clear && \ @@ -37,4 +37,4 @@ ENV STATE_DIR /downloads/.metube ENV TEMP_DIR /downloads VOLUME /downloads EXPOSE 8081 -CMD [ "./docker-entrypoint.sh" ] +ENTRYPOINT ["/sbin/tini", "-g", "--", "./docker-entrypoint.sh"] diff --git a/Pipfile.lock b/Pipfile.lock index 4f7b46a..063b209 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -878,12 +878,12 @@ }, "yt-dlp": { "hashes": [ - "sha256:589d51ed9f154624a45c1f0ceb3d68d0d1e2031460e8dbc62139be631c20b388", - "sha256:ed204c1b61bc563e134447766d1ab343173540799e13ebb953e887ce7dcf6865" + "sha256:3ed218eaeece55e9d715afd41abc450dc406ee63bf79355169dfde312d38fdb8", + "sha256:f33ca76df2e4db31880f2fe408d44f5058d9f135015b13e50610dfbe78245bea" ], "index": "pypi", "markers": "python_version >= '3.9'", - "version": "==2024.11.4" + "version": "==2025.2.19" } }, "develop": { diff --git a/README.md b/README.md index db22962..abde8f0 100644 --- a/README.md +++ b/README.md @@ -110,12 +110,19 @@ __Firefox:__ contributed by [nanocortex](https://github.com/nanocortex). You can ## iOS Shortcut -[rithask](https://github.com/rithask) has created an iOS shortcut to send the URL to MeTube from Safari. Initially, you'll need to enter the server address and port, but after that, it will be saved and you can just run the shortcut from the share menu in Safari. The address should include the protocol (http/https) and the port, if it's not the default 80/443. For example: `https://metube.example.com` or `http://192.168.1.1:8081`. The shortcut can be found [here](https://www.icloud.com/shortcuts/f1548df15b734418a77a709103bc1dd5). +[rithask](https://github.com/rithask) created an iOS shortcut to send URLs to MeTube from Safari. Enter the MeTube instance address when prompted which will be saved for later use. You can run the shortcut from Safari’s share menu. The shortcut can be downloaded from [this iCloud link](https://www.icloud.com/shortcuts/66627a9f334c467baabdb2769763a1a6). ## iOS Compatibility iOS has strict requirements for video files, requiring h264 or h265 video codec and aac audio codec in MP4 container. This can sometimes be a lower quality than the best quality available. To accommodate iOS requirements, when downloading a MP4 format you can choose "Best (iOS)" to get the best quality formats as compatible as possible with iOS requirements. +To force all downloads to be converted to an iOS compatible codec insert this as an environment variable + +```yaml + environment: + - 'YTDL_OPTIONS={"format": "best", "exec": "ffmpeg -i %(filepath)q -c:v libx264 -c:a aac %(filepath)q.h264.mp4"}' +``` + ## Bookmarklet [kushfest](https://github.com/kushfest) has created a Chrome bookmarklet for sending the currently open webpage to MeTube. Please note that if you're on an HTTPS page, your MeTube instance must be configured with `HTTPS` as `true` in the environment, or be behind an HTTPS reverse proxy (see below) for the bookmarklet to work. diff --git a/app/dl_formats.py b/app/dl_formats.py index 8abd038..5640ca4 100644 --- a/app/dl_formats.py +++ b/app/dl_formats.py @@ -35,7 +35,7 @@ def get_format(format: str, quality: str) -> str: return "bestaudio/best" # video {res} {vfmt} + audio {afmt} {res} {vfmt} vfmt, afmt = ("[ext=mp4]", "[ext=m4a]") if format == "mp4" else ("", "") - vres = f"[height<={quality}]" if quality not in ("best", "best_ios") else "" + vres = f"[height<={quality}]" if quality not in ("best", "best_ios", "worst") else "" vcombo = vres + vfmt if quality == "best_ios": diff --git a/app/main.py b/app/main.py index 2ff3ec2..c7bbfed 100644 --- a/app/main.py +++ b/app/main.py @@ -165,12 +165,14 @@ async def start(request): @routes.get(config.URL_PREFIX + 'history') async def history(request): - history = { 'done': [], 'queue': []} + history = { 'done': [], 'queue': [], 'pending': []} for _ ,v in dqueue.queue.saved_items(): history['queue'].append(v) for _ ,v in dqueue.done.saved_items(): history['done'].append(v) + for _ ,v in dqueue.pending.saved_items(): + history['pending'].append(v) return web.Response(text=serializer.encode(history)) diff --git a/app/ytdl.py b/app/ytdl.py index f169afe..3434358 100644 --- a/app/ytdl.py +++ b/app/ytdl.py @@ -7,6 +7,8 @@ import asyncio import multiprocessing import logging import re + +import yt_dlp.networking.impersonate from dl_formats import get_format, get_opts, AUDIO_FORMATS from datetime import datetime @@ -227,6 +229,7 @@ class DownloadQueue: 'ignore_no_formats_error': True, 'noplaylist': playlist_strict_mode, 'paths': {"home": self.config.DOWNLOAD_DIR, "temp": self.config.TEMP_DIR}, + **({'impersonate': yt_dlp.networking.impersonate.ImpersonateTarget.from_str(self.config.YTDL_OPTIONS['impersonate'])} if 'impersonate' in self.config.YTDL_OPTIONS else {}), **self.config.YTDL_OPTIONS, }).extract_info(url, download=False) diff --git a/ui/ngsw-config.json b/ui/ngsw-config.json index f8bf210..6fa40bf 100644 --- a/ui/ngsw-config.json +++ b/ui/ngsw-config.json @@ -8,7 +8,6 @@ "resources": { "files": [ "/favicon.ico", - "/index.html", "/manifest.webmanifest", "/*.css", "/*.js" diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html index 01719d8..dc5e3bb 100644 --- a/ui/src/app/app.component.html +++ b/ui/src/app/app.component.html @@ -126,6 +126,7 @@