88 Commits

Author SHA1 Message Date
williamp 5465bd4c77 Merge pull request 'release v1.0.4' (#60) from dev into master
Build and Push Docker Image / build-and-push (push) Successful in 5m14s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
Reviewed-on: #60
2026-03-18 02:50:48 +00:00
williamp bdfd612fa0 Merge pull request 'chore(deps): update module github.com/lrstanley/go-ytdlp to v1.3.5' (#59) from renovate/github.com-lrstanley-go-ytdlp-1.x into dev
Build only (for PRs) / build-only (pull_request) Successful in 36s
Reviewed-on: #59
2026-03-18 01:54:56 +00:00
williamp de6e50179a Merge pull request 'chore(deps): update dependency yt-dlp/yt-dlp to v2026.03.17' (#58) from renovate/yt-dlp-yt-dlp-2026.x into dev
Reviewed-on: #58
2026-03-18 01:54:37 +00:00
renovate-bot 38691be66b chore(deps): update module github.com/lrstanley/go-ytdlp to v1.3.5
Build only (for PRs) / build-only (pull_request) Successful in 4m11s
2026-03-18 01:01:26 +00:00
renovate-bot 46bbecb280 chore(deps): update dependency yt-dlp/yt-dlp to v2026.03.17
Build only (for PRs) / build-only (pull_request) Successful in 40s
2026-03-18 00:01:37 +00:00
williamp 772993a596 Merge pull request 'chore(deps): update golang:1.26.1-trixie docker digest to 96b2878' (#57) from renovate/golang-1.26.1-trixie into dev
Reviewed-on: #57
2026-03-17 17:39:14 +00:00
renovate-bot f809b08c37 chore(deps): update golang:1.26.1-trixie docker digest to 96b2878
Build only (for PRs) / build-only (pull_request) Successful in 6m56s
2026-03-17 11:02:10 +00:00
williamp 4f3b30885e Merge pull request 'chore(deps): update debian:13-slim docker digest to 26f98cc' (#55) from renovate/debian-13-slim into dev
Reviewed-on: #55
2026-03-17 03:34:11 +00:00
williamp 6c0316ac28 Merge pull request 'chore(deps): update golang:1.26.1-trixie docker digest to 9c51d8b' (#56) from renovate/golang-1.26.1-trixie into dev
Reviewed-on: #56
2026-03-17 03:33:57 +00:00
renovate-bot 52cc00190b chore(deps): update golang:1.26.1-trixie docker digest to 9c51d8b
Build only (for PRs) / build-only (pull_request) Successful in 6m58s
2026-03-17 02:01:29 +00:00
renovate-bot a7765f90d9 chore(deps): update debian:13-slim docker digest to 26f98cc
Build only (for PRs) / build-only (pull_request) Successful in 3m52s
2026-03-17 00:01:49 +00:00
williamp a0e511b4aa Merge pull request 'release v1.0.3' (#54) from dev into master
Build and Push Docker Image / build-and-push (push) Successful in 5m19s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
Reviewed-on: #54
2026-03-14 12:52:41 +00:00
williamp 7b4d25d484 Merge pull request 'chore(deps): update module github.com/lrstanley/go-ytdlp to v1.3.4' (#53) from renovate/github.com-lrstanley-go-ytdlp-1.x into dev
Build only (for PRs) / build-only (pull_request) Successful in 4m42s
Reviewed-on: #53
2026-03-14 03:40:32 +00:00
renovate-bot b392048ca1 chore(deps): update module github.com/lrstanley/go-ytdlp to v1.3.4
Build only (for PRs) / build-only (pull_request) Successful in 3m47s
2026-03-13 23:01:09 +00:00
williamp b0cb606afe Merge pull request 'chore(deps): update dependency yt-dlp/yt-dlp to v2026.03.13' (#52) from renovate/yt-dlp-yt-dlp-2026.x into dev
Reviewed-on: #52
2026-03-13 17:06:09 +00:00
renovate-bot f303eb3eb8 chore(deps): update dependency yt-dlp/yt-dlp to v2026.03.13
Build only (for PRs) / build-only (pull_request) Successful in 5m8s
2026-03-13 16:01:04 +00:00
williamp e641e1d2a5 Merge pull request 'fix: resolve timeout issues and implement format retrieval retries' (#50) from fix-timeout-and-implement-retries into dev
Reviewed-on: #50
2026-03-13 01:00:21 +00:00
williamp a6dc4e27b9 fix: resolve timeout issues and implement format retrieval retries
Build only (for PRs) / build-only (pull_request) Successful in 3m36s
2026-03-12 20:55:42 -04:00
williamp 509dab5395 Merge pull request 'automate management of loading emote' (#49) from automatic-loading-emote into master
Build and Push Docker Image / build-and-push (push) Successful in 40s
Build and Push Docker Image / deploy-on-green (push) Successful in 6s
Reviewed-on: #49
2026-03-10 01:00:31 +00:00
williamp 6b9934a221 automate management of loading emote
Build only (for PRs) / build-only (pull_request) Successful in 4m52s
2026-03-09 14:25:56 -04:00
williamp adefe2f177 Merge pull request 'optimize codebase' (#48) from code-cleanup into master
Build and Push Docker Image / build-and-push (push) Successful in 14s
Build and Push Docker Image / deploy-on-green (push) Successful in 6s
Reviewed-on: #48
2026-03-09 16:14:21 +00:00
williamp 084b7ed979 optimize codebase
Build only (for PRs) / build-only (pull_request) Successful in 4m43s
main.go:
- Eliminated ~160 lines of duplicate code: Extracted 3 new helper functions at the bottom of the file:
buildVideoMenuOptions([]VideoOption) — builds the Discord select menu options for video formats
buildAudioMenuOptions([]AudioOption) — same for audio
fetchAndShowFormats(s, i, url) — fetches formats, sorts them, builds menus, stores state, and edits the interaction; previously duplicated identically in both the download and download video command handlers
- Fixed time.Sleep ordering bug: The startAsyncDownload goroutine was launched before InteractionRespond with a 100ms sleep to compensate. Now the download is launched after InteractionRespond returns — no sleep needed. Removed "time" import.
- Used helpers in video_select handler: The two inline menu-building loops in that handler now call buildAudioMenuOptions / buildVideoMenuOptions

misc.go:
- Moved regexp.MustCompile(...) to a package-level var urlPattern — previously it recompiled the regex on every call to extractURLFromString
- Simplified the function body to a single return line
2026-03-09 11:10:33 -04:00
williamp 51e1cc5e85 Merge pull request 'chore(deps): update module github.com/lrstanley/go-ytdlp to v1.3.3' (#47) from renovate/github.com-lrstanley-go-ytdlp-1.x into master
Build and Push Docker Image / build-and-push (push) Successful in 5m31s
Build and Push Docker Image / deploy-on-green (push) Successful in 8s
Reviewed-on: #47
2026-03-08 15:55:17 +00:00
williamp d3e6ddebcd remove my fork after my changes were merged upstream
Build only (for PRs) / build-only (pull_request) Successful in 4m27s
2026-03-08 11:50:09 -04:00
renovate-bot 558f95ad9d chore(deps): update module github.com/lrstanley/go-ytdlp to v1.3.3
Build only (for PRs) / build-only (pull_request) Successful in 6m37s
2026-03-08 07:01:17 +00:00
williamp e0de621e41 Merge pull request 'chore(deps): update golang docker tag to v1.26.1' (#43) from renovate/golang-1.x into master
Build and Push Docker Image / build-and-push (push) Successful in 5m18s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
Reviewed-on: #43
2026-03-08 05:15:33 +00:00
williamp 451333860f chore(deps): update go-ytdlp and my fork
Build and Push Docker Image / build-and-push (push) Successful in 7m26s
Build and Push Docker Image / deploy-on-green (push) Successful in 6s
2026-03-07 23:55:40 -05:00
williamp e3b5542b78 add /version command
Build and Push Docker Image / build-and-push (push) Successful in 5m5s
Build and Push Docker Image / deploy-on-green (push) Successful in 6s
2026-03-07 21:14:31 -05:00
williamp aaf3338797 re-introduce context menu command 2026-03-07 21:05:23 -05:00
williamp 8f2bda0b52 chore(actions): change buildkitd url
Build and Push Docker Image / build-and-push (push) Successful in 7m19s
Build and Push Docker Image / deploy-on-green (push) Successful in 6s
2026-03-07 18:56:26 -05:00
williamp 91f2eb39cb chore(actions): change buildkitd url
Build and Push Docker Image / build-and-push (push) Failing after 26s
Build and Push Docker Image / deploy-on-green (push) Has been skipped
2026-03-07 18:35:56 -05:00
williamp 82b867ae9c Merge pull request 'chore(deps): update docker/setup-buildx-action action to v4' (#46) from renovate/docker-setup-buildx-action-4.x into master
Build and Push Docker Image / build-and-push (push) Successful in 7m51s
Build and Push Docker Image / deploy-on-green (push) Successful in 1m18s
Reviewed-on: #46
2026-03-07 15:19:11 +00:00
williamp ebb6c11d49 Merge pull request 'chore(deps): update docker/build-push-action action to v7' (#45) from renovate/docker-build-push-action-7.x into master
Build and Push Docker Image / deploy-on-green (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Has been cancelled
Reviewed-on: #45
2026-03-07 15:19:02 +00:00
renovate-bot d4beb62fdd chore(deps): update docker/setup-buildx-action action to v4
Build only (for PRs) / build-only (pull_request) Successful in 10s
2026-03-07 03:01:29 +00:00
renovate-bot 13d65ef6ce chore(deps): update docker/build-push-action action to v7
Build only (for PRs) / build-only (pull_request) Successful in 10s
2026-03-07 03:01:17 +00:00
renovate-bot 8b1cead3ea chore(deps): update golang docker tag to v1.26.1
Build only (for PRs) / build-only (pull_request) Successful in 9m27s
2026-03-07 02:00:48 +00:00
williamp 4347bf733c fix flake.nix 2026-03-06 20:32:37 -05:00
williamp 5748834af4 fix Dockerfile
Build and Push Docker Image / build-and-push (push) Successful in 16s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
2026-03-06 20:08:45 -05:00
williamp 06d2a5ef01 Deploy and release v1.0.0 (Go Refactor) #30
Build and Push Docker Image / build-and-push (push) Failing after 11s
Build and Push Docker Image / deploy-on-green (push) Has been skipped
2026-03-06 20:06:43 -05:00
williamp bdcd77eff1 rm build-testing to make way for merge
Build only (for PRs) / build-only (pull_request) Successful in 4m59s
2026-03-06 19:52:24 -05:00
williamp 4541559f47 remove RecodeVideo, too resource intensive
Build only (for PRs) / build-only (pull_request) Successful in 3m30s
Build and Push Docker Image / build-and-push (push) Successful in 3m46s
2026-03-06 19:40:11 -05:00
williamp 906ef98bd5 docker: fix more issues with dynamic linking
Build only (for PRs) / build-only (pull_request) Successful in 32s
Build and Push Docker Image / build-and-push (push) Successful in 2m13s
2026-03-06 10:04:19 -05:00
williamp 640c952b20 actions: adjust build-only for new PRs 2026-03-06 10:03:50 -05:00
williamp f30686fd7c start pushing test images
Build only (for PRs) / build-only (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Successful in 7m31s
2026-03-05 23:28:58 -05:00
williamp eceb3b3d76 fix multiarch in ffmpeg stage
Build only (for PRs) / build-only (push) Successful in 27s
2026-03-05 23:18:57 -05:00
williamp 23a27217df actions: fix wording
Build only (for PRs) / build-only (push) Has been cancelled
2026-03-05 22:40:57 -05:00
williamp 82a6421c88 actions: create build-only workflow for testing automated builds and later for PR autochecks
Build only (for PRs) / build-only (push) Failing after 5m7s
2026-03-05 22:37:42 -05:00
williamp c72bc42496 renovate: track yt-dlp version from dockerfiles 2026-03-05 22:25:33 -05:00
williamp 991a5f376f new dockerfile for staged yt-dlp/deno/go builds to distroless container 2026-03-05 22:15:34 -05:00
williamp 13bd3b82db minor UX tweaks 2026-03-05 21:42:56 -05:00
williamp 2c99fbf517 update flake
Build and Push Docker Image / build-and-push (push) Successful in 18s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
2026-03-05 19:36:59 -05:00
williamp 890a0dd5c9 format final video download message 2026-03-05 19:35:13 -05:00
williamp 6fd6160edf use animated loading emote 2026-03-05 19:17:05 -05:00
williamp 43c2fa2f91 update flake 2026-03-05 18:55:23 -05:00
williamp 81968a6811 Merge pull request 'chore(deps): update docker/build-push-action action to v7' (#42) from renovate/docker-build-push-action-7.x into master
Build and Push Docker Image / build-and-push (push) Successful in 13s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
Reviewed-on: #42
2026-03-05 23:44:23 +00:00
renovate-bot 7d83fd8518 chore(deps): update docker/build-push-action action to v7 2026-03-05 22:01:13 +00:00
williamp 7b34919e72 Merge pull request 'chore(deps): update docker/setup-buildx-action action to v4' (#41) from renovate/docker-setup-buildx-action-4.x into master
Build and Push Docker Image / build-and-push (push) Successful in 2m53s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
Reviewed-on: #41
2026-03-05 14:05:38 +00:00
renovate-bot 98fec74ac0 chore(deps): update docker/setup-buildx-action action to v4 2026-03-05 08:01:26 +00:00
williamp 481c8d9bb6 replace progress percentage with actual file size 2026-03-04 23:58:11 -05:00
williamp 3cac63ba82 implement progress bar 2026-03-04 21:06:41 -05:00
williamp b3d779374b have progress messages edit each other 2026-03-04 20:26:31 -05:00
williamp 2269104805 Merge pull request 'chore(deps): update docker/login-action action to v4' (#40) from renovate/docker-login-action-4.x into master
Build and Push Docker Image / build-and-push (push) Successful in 3m5s
Build and Push Docker Image / deploy-on-green (push) Successful in 8s
Reviewed-on: #40
2026-03-04 13:47:45 +00:00
williamp 4bea5e020f Merge pull request 'chore(deps): update dependency discord.py to v2.7.1' (#39) from renovate/discord.py-2.x into master
Build and Push Docker Image / build-and-push (push) Successful in 3m8s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
Reviewed-on: #39
2026-03-04 13:43:27 +00:00
williamp 60803961b3 Merge pull request 'chore(deps): update dependency yt-dlp to v2026.3.3' (#38) from renovate/yt-dlp-2026.x into master
Build and Push Docker Image / deploy-on-green (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Has been cancelled
Reviewed-on: #38
2026-03-04 13:43:10 +00:00
renovate-bot 197e35314a chore(deps): update docker/login-action action to v4 2026-03-04 10:01:13 +00:00
renovate-bot db0c0a3893 chore(deps): update dependency discord.py to v2.7.1 2026-03-03 19:01:27 +00:00
renovate-bot 46fec9b85a chore(deps): update dependency yt-dlp to v2026.3.3 2026-03-03 17:02:19 +00:00
williamp 204404b761 update flake for latest yt-dlp
Build and Push Docker Image / build-and-push (push) Successful in 4m3s
Build and Push Docker Image / deploy-on-green (push) Successful in 11s
2026-03-02 20:10:03 -05:00
williamp 6e7fc73420 Merge pull request 'chore(deps): update dependency python-dotenv to v1.2.2' (#37) from renovate/python-dotenv-1.x into master
Build and Push Docker Image / build-and-push (push) Successful in 2m51s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
Reviewed-on: #37
2026-03-02 16:26:46 +00:00
renovate-bot 67c85aebf9 chore(deps): update dependency python-dotenv to v1.2.2 2026-03-01 16:00:47 +00:00
williamp b9088d932c Merge pull request 'chore(deps): update dependency discord.py to v2.7.0' (#36) from renovate/discord.py-2.x into master
Build and Push Docker Image / build-and-push (push) Successful in 3m39s
Build and Push Docker Image / deploy-on-green (push) Successful in 11s
Reviewed-on: #36
2026-02-28 21:38:46 +00:00
renovate-bot 8c1d044f79 chore(deps): update dependency discord.py to v2.7.0 2026-02-27 19:02:10 +00:00
williamp f688ee035f Merge pull request 'chore(deps): update dependency yt-dlp to v2026.2.21' (#35) from renovate/yt-dlp-2026.x into master
Build and Push Docker Image / build-and-push (push) Successful in 2m41s
Build and Push Docker Image / deploy-on-green (push) Successful in 7s
Reviewed-on: #35
2026-02-21 22:25:02 +00:00
renovate-bot 7fd5d93b6d chore(deps): update dependency yt-dlp to v2026.2.21 2026-02-21 21:01:26 +00:00
williamp 600fde2e71 define static location for yt-dlp binary 2026-02-12 23:27:02 -05:00
williamp a2a0aabb3a downlad into temp folder then move to out folder when done, temp replace with my fork until upstream PR is merged 2026-02-12 23:26:08 -05:00
williamp d7ad90a1d5 actions: add duplicate detection
Build and Push Docker Image / build-and-push (push) Successful in 2m59s
Build and Push Docker Image / deploy-on-green (push) Successful in 8s
2026-02-06 21:45:08 -05:00
williamp ac5abffd74 Merge pull request 'chore(deps): update python docker tag to v3.14.3' (#34) from renovate/python-3.x into master
Build and Push Docker Image / build-and-push (push) Successful in 2m40s
Build and Push Docker Image / deploy-on-green (push) Successful in 9s
Reviewed-on: #34
2026-02-05 00:38:18 +00:00
renovate-bot 1c43c62523 chore(deps): update python docker tag to v3.14.3 2026-02-04 23:00:45 +00:00
williamp bef0a4d593 Merge pull request 'chore(deps): update dependency yt-dlp to v2026.2.4' (#33) from renovate/yt-dlp-2026.x into master
Build and Push Docker Image / build-and-push (push) Successful in 5m17s
Build and Push Docker Image / deploy-on-green (push) Successful in 15s
Reviewed-on: #33
2026-02-04 01:32:58 +00:00
renovate-bot bf7739228f chore(deps): update dependency yt-dlp to v2026.2.4 2026-02-04 01:01:00 +00:00
williamp 270934613f Merge pull request 'chore(deps): update dependency yt-dlp to v2026.1.31' (#32) from renovate/yt-dlp-2026.x into master
Build and Push Docker Image / build-and-push (push) Successful in 6m27s
Build and Push Docker Image / deploy-on-green (push) Successful in 10s
Reviewed-on: #32
2026-02-01 14:55:05 +00:00
renovate-bot 5cea64626c chore(deps): update dependency yt-dlp to v2026.1.31 2026-02-01 01:01:03 +00:00
williamp 70d72759ce Merge pull request 'chore(deps): update dependency yt-dlp to v2026' (#31) from renovate/yt-dlp-2026.x into master
Build and Push Docker Image / build-and-push (push) Successful in 21s
Build and Push Docker Image / deploy-on-green (push) Successful in 9s
Reviewed-on: #31
2026-01-31 19:02:01 +00:00
renovate-bot c537874adb chore(deps): update dependency yt-dlp to v2026 2026-01-29 18:02:10 +00:00
williamp b496d14cf7 flake: add go and yt-dlp for refactor
Build and Push Docker Image / build-and-push (push) Successful in 23s
Build and Push Docker Image / deploy-on-green (push) Successful in 9s
2026-01-26 20:34:04 -05:00
williamp c2de1abfd2 flake: check for existance of python project
Build and Push Docker Image / build-and-push (push) Successful in 18s
Build and Push Docker Image / deploy-on-green (push) Successful in 8s
2026-01-26 20:28:23 -05:00
williamp 635d5d5113 nix dev environment: update flake and add deno
Build and Push Docker Image / build-and-push (push) Successful in 22s
Build and Push Docker Image / deploy-on-green (push) Successful in 8s
2026-01-21 15:42:47 -05:00
14 changed files with 638 additions and 293 deletions
+11 -6
View File
@@ -23,14 +23,14 @@ jobs:
# Set up Docker Buildx for building the image # Set up Docker Buildx for building the image
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v4
with: with:
driver: remote driver: remote
endpoint: 'tcp://buildkitd:1234' endpoint: 'tcp://buildkitd.gitea-runner.svc.cluster.local:1234'
# Log in to the Gitea container registry # Log in to the Gitea container registry
- name: Log in to Gitea Container Registry - name: Log in to Gitea Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v4
with: with:
registry: git.dubyatp.xyz registry: git.dubyatp.xyz
username: williamp username: williamp
@@ -38,7 +38,7 @@ jobs:
# Build and push the Docker image # Build and push the Docker image
- name: Build and Push Docker Image - name: Build and Push Docker Image
uses: docker/build-push-action@v6 uses: docker/build-push-action@v7
with: with:
context: . # Build context (current directory) context: . # Build context (current directory)
file: ./Dockerfile # Path to Dockerfile file: ./Dockerfile # Path to Dockerfile
@@ -75,8 +75,13 @@ jobs:
git config --local user.signingkey ~/.ssh/id_ed25519 git config --local user.signingkey ~/.ssh/id_ed25519
git config --local gpg.format ssh git config --local gpg.format ssh
git config --local commit.gpgsign true git config --local commit.gpgsign true
git commit -a -m "yt-dlp-bot: deploy update to ${{ needs.build-and-push.outputs.sha_short }}"
if [ -n "$(git status --porcelain)" ]; then
git commit -a -m "yt-dlp-bot: deploy update to ${{ needs.build-and-push.outputs.sha_short }}"
else
echo "No changes to commit, skipping..."
fi
exit 0
- name: Push changes - name: Push changes
uses: ad-m/github-push-action@v1.0.0 uses: ad-m/github-push-action@v1.0.0
with: with:
+35
View File
@@ -0,0 +1,35 @@
name: Build only (for PRs)
on:
pull_request:
jobs:
build-only:
runs-on: ubuntu-latest # Use a runner with Docker support
container: ghcr.io/catthehacker/ubuntu:act-latest # Image with Docker pre-installed
outputs:
sha_short: ${{ steps.vars.outputs.sha_short }}
steps:
# Checkout the repository code
- name: Checkout repository
uses: actions/checkout@v6
- name: Set outputs
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
# Set up Docker Buildx for building the image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
driver: remote
endpoint: 'tcp://buildkitd.gitea-runner.svc.cluster.local:1234'
# Build the Docker image
- name: Build Docker Image
uses: docker/build-push-action@v7
with:
context: . # Build context (current directory)
file: ./Dockerfile # Path to Dockerfile
platforms: "linux/amd64,linux/arm64"
+91 -6
View File
@@ -1,6 +1,91 @@
FROM python:3.14.2-alpine3.22 # Portions of this Dockerfile are sourced from GPLv3 licensed `yt-dlp slim` by Henrique Almeida (https://github.com/h3nc4/yt-dlp-slim)
COPY ./app /app # Derivations to this Dockerfile in this repository following March 3, 2026 should be considered licensed under this project's MIT license (see ../LICENSE) unless otherwise stated
WORKDIR /app
RUN apk add ffmpeg deno ########################################
RUN pip install -r requirements.txt # Versions
CMD ["python", "/app/main.py"] ARG YT_DLP_VERSION="2026.03.17"
################################################################################
# Deno builder stage
FROM denoland/deno:bin-2.6.6@sha256:9f18d20207f2699595ea26d14e0b7e123cd0cd01100a577bc11f8ca5906c2d81 AS deno-builder
################################################################################
# YT-DLP builder stage
FROM alpine:3.23@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659 AS yt-dlp-builder
ARG YT_DLP_VERSION
ARG TARGETARCH
RUN mkdir -p /rootfs/target /rootfs/tmp /rootfs/bin
ADD "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/SHA2-256SUMS" /SHA2-256SUMS
ADD "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/SHA2-256SUMS.sig" /SHA2-256SUMS.sig
ADD "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xAC0CBBE6848D6A873464AF4E57CF65933B5A7581" "/yt-dlp_pubkey.asc"
RUN apk add --no-cache gnupg && \
gpg --import /yt-dlp_pubkey.asc && \
gpg --verify /SHA2-256SUMS.sig /SHA2-256SUMS
RUN case "$TARGETARCH" in \
amd64) YT_DLP_FILE="yt-dlp_linux" ;; \
arm64) YT_DLP_FILE="yt-dlp_linux_aarch64" ;; \
*) echo "Unsupported architecture: $TARGETARCH" && exit 1 ;; \
esac && \
wget -qO "/${YT_DLP_FILE}" "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/${YT_DLP_FILE}" && \
grep " ${YT_DLP_FILE}$" /SHA2-256SUMS | sha256sum -c - && \
mv "/${YT_DLP_FILE}" /rootfs/bin/yt-dlp && \
chmod 755 /rootfs/bin/yt-dlp && \
chmod 1777 /rootfs/tmp
################################################################################
# FFmpeg builder stage
FROM debian:13-slim@sha256:26f98ccd92fd0a44d6928ce8ff8f4921b4d2f535bfa07555ee5d18f61429cf0c AS ffmpeg-builder
RUN apt-get update && \
apt-get install -y --no-install-recommends ffmpeg
COPY --from=yt-dlp-builder /rootfs/bin/yt-dlp /yt-dlp
RUN mkdir -p /rootfs/bin && \
cp /usr/bin/ffmpeg /usr/bin/ffprobe /rootfs/bin/ && \
{ ldd /usr/bin/ffmpeg; ldd /yt-dlp; } 2>/dev/null | \
grep -o '/[^ ]*' | sort -u | \
xargs -I '{}' cp --parents '{}' /rootfs && \
LIBDIR=$(dirname "$(find /rootfs -name 'libc.so.6' | head -1)") && \
for stub in libutil.so.1 libdl.so.2 libpthread.so.0 librt.so.1; do \
[ -f "${LIBDIR}/${stub}" ] || ln -sf libc.so.6 "${LIBDIR}/${stub}"; \
done
################################################################################
# App builder stage
FROM golang:1.26.1-trixie@sha256:96b28783b99bcd265fbfe0b36a3ac6462416ce6bf1feac85d4c4ff533cbaa473 AS app-builder
COPY app/ /opt/app
WORKDIR /opt/app
RUN go get && go build -o out/yt-dlp-bot
################################################################################
# Final squashed image
FROM scratch AS final
# Copy deno, yt-dlp, and ffmpeg binaries
COPY --from=deno-builder /deno /bin/deno
COPY --from=yt-dlp-builder /rootfs /
COPY --from=ffmpeg-builder /rootfs/ /
# Copy yt-dlp-bot app binary
COPY --from=app-builder /opt/app/out/yt-dlp-bot /bin/
# Copy SSL CA's (needed for Discord)
COPY --from=app-builder /etc/ssl/certs /etc/ssl/certs
WORKDIR /target
ENV XDG_CACHE_HOME=/tmp/.cache
ENV YTDLP_BIN=/bin/yt-dlp
ENTRYPOINT ["/bin/yt-dlp-bot"]
LABEL org.opencontainers.image.title="yt-dlp bot" \
org.opencontainers.image.description="A totally overengineered Discord bot to locally download YouTube videos for private use" \
org.opencontainers.image.authors="William Peebles <me@williamtpeebles.com>" \
org.opencontainers.image.vendor="William Peebles" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.source="https://git.dubyatp.xyz/williamp/yt-dlp-bot"
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+23 -19
View File
@@ -8,7 +8,7 @@ import (
) )
// startAsyncDownload initiates a download in a goroutine and handles progress updates // startAsyncDownload initiates a download in a goroutine and handles progress updates
func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, url, videoFormatID, audioFormatID, outputDir string) { func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, requester, url, videoFormatID, videoFormatName, audioFormatID, audioFormatName, outputDir, tempDir string) {
progressChan := make(chan ProgressUpdate, 1) progressChan := make(chan ProgressUpdate, 1)
resultChan := make(chan DownloadResult, 1) resultChan := make(chan DownloadResult, 1)
@@ -20,7 +20,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, ur
// Handle panic from DownloadVideo // Handle panic from DownloadVideo
resultChan <- DownloadResult{ resultChan <- DownloadResult{
Success: false, Success: false,
Message: fmt.Sprintf("Download failed: %v", r), Message: fmt.Sprintf("❌ **Download Failed**: %v", r),
URL: url, URL: url,
Format: fmt.Sprintf("video: %s, audio: %s", videoFormatID, audioFormatID), Format: fmt.Sprintf("video: %s, audio: %s", videoFormatID, audioFormatID),
Error: fmt.Errorf("%v", r), Error: fmt.Errorf("%v", r),
@@ -29,7 +29,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, ur
}() }()
// Call DownloadVideo (it panics on error instead of returning error) // Call DownloadVideo (it panics on error instead of returning error)
DownloadVideo(outputDir, url, DownloadOptions{ DownloadVideo(outputDir, tempDir, url, DownloadOptions{
EmbedThumbnail: true, EmbedThumbnail: true,
IncludeSubtitles: true, IncludeSubtitles: true,
VideoFormatID: videoFormatID, VideoFormatID: videoFormatID,
@@ -39,7 +39,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, ur
// If we reach here, download was successful // If we reach here, download was successful
resultChan <- DownloadResult{ resultChan <- DownloadResult{
Success: true, Success: true,
Message: "Video Downloaded Successfully!", Message: "✅ **Successfully Downloaded**",
URL: url, URL: url,
Format: fmt.Sprintf("video: %s, audio: %s", videoFormatID, audioFormatID), Format: fmt.Sprintf("video: %s, audio: %s", videoFormatID, audioFormatID),
Error: nil, Error: nil,
@@ -48,9 +48,8 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, ur
// Handle progress and results asynchronously // Handle progress and results asynchronously
go func() { go func() {
// First update the original ephemeral message with "Processing..."
_, err := s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ _, err := s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
Content: ptr(fmt.Sprintf("🔄 Processing download...\nURL: %s\nVideo: %s\nAudio: %s", url, videoFormatID, audioFormatID)), Content: ptr(fmt.Sprintf("%s **Starting Download**", loading_emoji)),
}) })
if err != nil { if err != nil {
log.Printf("Error updating interaction: %v", err) log.Printf("Error updating interaction: %v", err)
@@ -63,36 +62,41 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, ur
progressChan = nil progressChan = nil
continue continue
} }
// Update message w/ phase and real time progress
phaseEmoji := "⏬" var content string
if prog.Phase == "post-processing" { if prog.Phase == "post-processing" {
phaseEmoji = "⚙️" content = fmt.Sprintf("%s **Post Processing**", loading_emoji)
} else {
var progressStr string
if prog.DownloadedBytes > 0 {
progressStr = formatBytes(prog.DownloadedBytes) + " downloaded"
} else {
progressStr = "starting..."
}
content = fmt.Sprintf("%s **Downloading Video**: %s", loading_emoji, progressStr)
} }
content := fmt.Sprintf("%s %s\n%s @ %s [eta: %s]\n📄 %s",
phaseEmoji,
prog.Phase,
prog.Status,
prog.Percent,
prog.ETA,
prog.Filename)
_, err := s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ _, err := s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
Content: ptr(content), Content: ptr(content),
}) })
if err != nil { if err != nil {
log.Printf("Error updating progress: %v", err) log.Printf("Error updating progress: %v", err)
} }
case result := <-resultChan: case result := <-resultChan:
// Handle completion
if result.Success { if result.Success {
_, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
Content: ptr("✅ **Successfully Downloaded**"),
})
_, err = s.FollowupMessageCreate(i.Interaction, false, &discordgo.WebhookParams{ _, err = s.FollowupMessageCreate(i.Interaction, false, &discordgo.WebhookParams{
Content: "📥 Video downloaded: " + result.URL, Content: fmt.Sprintf("## Video Downloaded \n**URL**: %s \n**Quality**: %s + %s \n**Requested By**: <@%s> \n", result.URL, videoFormatName, audioFormatName, requester),
}) })
if err != nil { if err != nil {
log.Printf("Error updating interaction: %v", err) log.Printf("Error updating interaction: %v", err)
} }
} else { } else {
_, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ _, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
Content: ptr("❌ Download failed: " + result.Message), Content: ptr("❌ **Download Failed**: " + result.Message),
}) })
if err != nil { if err != nil {
log.Printf("Error updating interaction: %v", err) log.Printf("Error updating interaction: %v", err)
+5 -5
View File
@@ -4,14 +4,14 @@ go 1.25.2
require ( require (
github.com/bwmarrin/discordgo v0.29.0 github.com/bwmarrin/discordgo v0.29.0
github.com/lrstanley/go-ytdlp v1.2.7 github.com/lrstanley/go-ytdlp v1.3.5
) )
require ( require (
github.com/ProtonMail/go-crypto v1.3.0 // indirect github.com/ProtonMail/go-crypto v1.3.0 // indirect
github.com/cloudflare/circl v1.6.1 // indirect github.com/cloudflare/circl v1.6.3 // indirect
github.com/gorilla/websocket v1.4.2 // indirect github.com/gorilla/websocket v1.4.2 // indirect
github.com/ulikunitz/xz v0.5.13 // indirect github.com/ulikunitz/xz v0.5.15 // indirect
golang.org/x/crypto v0.41.0 // indirect golang.org/x/crypto v0.48.0 // indirect
golang.org/x/sys v0.35.0 // indirect golang.org/x/sys v0.41.0 // indirect
) )
+26 -2
View File
@@ -4,19 +4,43 @@ github.com/bwmarrin/discordgo v0.29.0 h1:FmWeXFaKUwrcL3Cx65c20bTRW+vOb6k8AnaP+Eg
github.com/bwmarrin/discordgo v0.29.0/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY= github.com/bwmarrin/discordgo v0.29.0/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dubyatp/go-ytdlp v0.0.0-20260213041320-010f95f0f1d3 h1:tGzvzV6fSzybhIpwU+wjvjOSq8RBNtHENm+G03E+mgo=
github.com/dubyatp/go-ytdlp v0.0.0-20260213041320-010f95f0f1d3/go.mod h1:38IL64XM6gULrWtKTiR0+TTNCVbxesNSbTyaFG2CGTI=
github.com/dubyatp/go-ytdlp v0.0.0-20260308044557-db32b29c1590 h1:27d1UwjlfuF/kwHj98B6UP30D1d7mvk/bmnDQ0xKX1s=
github.com/dubyatp/go-ytdlp v0.0.0-20260308044557-db32b29c1590/go.mod h1:VgjnTrvkTf+23JuySjyPq1iQ8ijSovBtTPpXH5XrLtI=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/lrstanley/go-ytdlp v1.2.7 h1:YNDvKkd0OCJSZLZePZvJwcirBCfL8Yw3eCwrTCE5w7Q= github.com/lrstanley/go-ytdlp v1.3.3 h1:Y9kJcdTwskPWDiwONMIl501Dhi+OrTF7HHY6J6+Lbco=
github.com/lrstanley/go-ytdlp v1.2.7/go.mod h1:38IL64XM6gULrWtKTiR0+TTNCVbxesNSbTyaFG2CGTI= github.com/lrstanley/go-ytdlp v1.3.3/go.mod h1:VgjnTrvkTf+23JuySjyPq1iQ8ijSovBtTPpXH5XrLtI=
github.com/lrstanley/go-ytdlp v1.3.4 h1:x3ppgdeN3FbguT5ifc6ISrgjYN10+dVUAbprA7/dYrk=
github.com/lrstanley/go-ytdlp v1.3.4/go.mod h1:VgjnTrvkTf+23JuySjyPq1iQ8ijSovBtTPpXH5XrLtI=
github.com/lrstanley/go-ytdlp v1.3.5 h1:eT+29mK3Lp+XPMQOH25+jVerrrjifYW1o3IkTYJ9SMs=
github.com/lrstanley/go-ytdlp v1.3.5/go.mod h1:VgjnTrvkTf+23JuySjyPq1iQ8ijSovBtTPpXH5XrLtI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/ulikunitz/xz v0.5.13 h1:ar98gWrjf4H1ev05fYP/o29PDZw9DrI3niHtnEqyuXA= github.com/ulikunitz/xz v0.5.13 h1:ar98gWrjf4H1ev05fYP/o29PDZw9DrI3niHtnEqyuXA=
github.com/ulikunitz/xz v0.5.13/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.13/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+280 -212
View File
@@ -6,21 +6,25 @@ import (
"os" "os"
"os/signal" "os/signal"
"sort" "sort"
"strings"
"syscall" "syscall"
"time"
"github.com/bwmarrin/discordgo" "github.com/bwmarrin/discordgo"
) )
func main() { func main() {
out_dir := os.Getenv("OUT_PATH") out_dir := os.Getenv("OUT_PATH")
temp_dir := os.Getenv("TEMP_PATH")
bot_token := os.Getenv("DISCORD_TOKEN") bot_token := os.Getenv("DISCORD_TOKEN")
if out_dir == "" { if out_dir == "" {
panic("No output dir specified") panic("No output dir specified")
} }
if temp_dir == "" {
panic("No temp dir specified")
}
s, err := discordgo.New("Bot " + bot_token) s, err := discordgo.New("Bot " + bot_token)
if err != nil { if err != nil {
log.Fatalf("Invalid bot parameters: %v", err) log.Fatalf("Invalid bot parameters: %v", err)
@@ -49,6 +53,24 @@ func main() {
}, },
}, },
}, },
{
Name: "version",
Description: "Show application version",
DefaultMemberPermissions: &defaultMemberPermissions,
Contexts: &[]discordgo.InteractionContextType{interactionPrivateChannel},
},
{
Name: "download video",
Type: discordgo.MessageApplicationCommand,
IntegrationTypes: &[]discordgo.ApplicationIntegrationType{
discordgo.ApplicationIntegrationUserInstall,
},
Contexts: &[]discordgo.InteractionContextType{
discordgo.InteractionContextBotDM,
discordgo.InteractionContextPrivateChannel,
},
},
} }
var componentHandlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){ var componentHandlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
@@ -88,6 +110,9 @@ func main() {
return return
} }
// Get requester user ID
state.Requester = i.User.ID
// Get selected video format // Get selected video format
selectedValues := i.MessageComponentData().Values selectedValues := i.MessageComponentData().Values
if len(selectedValues) == 0 { if len(selectedValues) == 0 {
@@ -101,59 +126,26 @@ func main() {
return return
} }
// Store selected video format ID // Store selected video format ID and name
state.VideoFormatID = selectedValues[0] state.VideoFormatID = selectedValues[0]
for _, vOpt := range state.FormatOptions.VideoOptions {
if vOpt.FormatID == selectedValues[0] {
label := fmt.Sprintf("%s (%s", vOpt.Resolution, vOpt.Ext)
if vOpt.TBR != nil {
label += fmt.Sprintf(", %.0fkbps", *vOpt.TBR)
}
label += ")"
state.VideoFormatName = label
break
}
}
setInteractionState(i.Interaction.Token, state) setInteractionState(i.Interaction.Token, state)
// Build audio format options // Build audio format options
audioMenuOptions := []discordgo.SelectMenuOption{} audioMenuOptions := buildAudioMenuOptions(state.FormatOptions.AudioOptions)
for _, aOpt := range state.FormatOptions.AudioOptions {
label := aOpt.Format
if aOpt.Language != nil {
label += fmt.Sprintf(" [%s]", *aOpt.Language)
}
if aOpt.TBR != nil {
label += fmt.Sprintf(" (%.0fkbps)", *aOpt.TBR)
}
// Discord has a 100 char limit on labels
if len(label) > 100 {
label = label[:97] + "..."
}
audioMenuOptions = append(audioMenuOptions, discordgo.SelectMenuOption{
Label: label,
Value: aOpt.FormatID,
})
// Discord has a limit of 25 options per select menu
if len(audioMenuOptions) >= 25 {
break
}
}
// Build video format options (to keep them visible but disabled) // Build video format options (to keep them visible but disabled)
videoMenuOptions := []discordgo.SelectMenuOption{} videoMenuOptions := buildVideoMenuOptions(state.FormatOptions.VideoOptions)
for _, vOpt := range state.FormatOptions.VideoOptions {
label := fmt.Sprintf("%s (%s", vOpt.Resolution, vOpt.Ext)
if vOpt.TBR != nil {
label += fmt.Sprintf(", %.0fkbps", *vOpt.TBR)
}
label += ")"
if len(label) > 100 {
label = label[:97] + "..."
}
videoMenuOptions = append(videoMenuOptions, discordgo.SelectMenuOption{
Label: label,
Value: vOpt.FormatID,
})
if len(videoMenuOptions) >= 25 {
break
}
}
// Update components - disable video select, enable audio select // Update components - disable video select, enable audio select
updatedComponents := []discordgo.MessageComponent{ updatedComponents := []discordgo.MessageComponent{
@@ -219,7 +211,7 @@ func main() {
} }
if state == nil { if state == nil {
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource, Type: discordgo.InteractionResponseUpdateMessage,
Data: &discordgo.InteractionResponseData{ Data: &discordgo.InteractionResponseData{
Content: "Error: No video URL found. Please start over with /download.", Content: "Error: No video URL found. Please start over with /download.",
Flags: discordgo.MessageFlagsEphemeral, Flags: discordgo.MessageFlagsEphemeral,
@@ -235,29 +227,34 @@ func main() {
audioFormatID = selectedValues[0] audioFormatID = selectedValues[0]
} }
// Store selected audio format ID // Store selected audio format ID and name
state.AudioFormatID = audioFormatID state.AudioFormatID = audioFormatID
for _, aOpt := range state.FormatOptions.AudioOptions {
if aOpt.FormatID == audioFormatID {
label := aOpt.Format
if aOpt.Language != nil {
label += fmt.Sprintf(" [%s]", *aOpt.Language)
}
if aOpt.TBR != nil {
label += fmt.Sprintf(" (%.0fkbps)", *aOpt.TBR)
}
state.AudioFormatName = label
break
}
}
response := "" response := ""
if state.URL != "" { if state.URL != "" {
// Respond immediately to prevent timeout // Respond immediately to prevent timeout
response = fmt.Sprintf("🚀 Starting download...\nURL: %s\nVideo: %s\nAudio: %s\n\nYou'll receive an update when the download completes!", response = fmt.Sprintf("%s **Starting download**", loading_emoji)
state.URL, state.VideoFormatID, state.AudioFormatID)
// Start async download after responding // Clean up state before responding
go func() {
// Small delay to ensure response is sent first
time.Sleep(100 * time.Millisecond)
startAsyncDownload(s, i, state.URL, state.VideoFormatID, state.AudioFormatID, out_dir)
}()
// Clean up state after starting download
deleteInteractionState(i.Interaction.Token) deleteInteractionState(i.Interaction.Token)
} else { } else {
response = "I don't see a video here :(" response = "I don't see a video here :("
} }
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource, Type: discordgo.InteractionResponseUpdateMessage,
Data: &discordgo.InteractionResponseData{ Data: &discordgo.InteractionResponseData{
Content: response, Content: response,
Flags: discordgo.MessageFlagsEphemeral, Flags: discordgo.MessageFlagsEphemeral,
@@ -266,6 +263,9 @@ func main() {
if err != nil { if err != nil {
log.Printf("Error: %v", err) log.Printf("Error: %v", err)
} }
if state.URL != "" {
go startAsyncDownload(s, i, state.Requester, state.URL, state.VideoFormatID, state.VideoFormatName, state.AudioFormatID, state.AudioFormatName, out_dir, temp_dir)
}
}, },
} }
@@ -295,7 +295,7 @@ func main() {
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource, Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{ Data: &discordgo.InteractionResponseData{
Content: "🔍 Fetching available formats...", Content: fmt.Sprintf("%s Fetching available formats...", loading_emoji),
Flags: discordgo.MessageFlagsEphemeral, Flags: discordgo.MessageFlagsEphemeral,
}, },
}) })
@@ -305,150 +305,57 @@ func main() {
} }
// Fetch formats asynchronously // Fetch formats asynchronously
go func() { go fetchAndShowFormats(s, i, url)
formatOptions, err := GetFormats(url) },
if err != nil { "download video": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
_, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ data := i.ApplicationCommandData()
Content: ptr("❌ Error fetching formats: " + err.Error()), targetMsg, ok := data.Resolved.Messages[data.TargetID]
}) if !ok || targetMsg == nil {
if err != nil { s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
log.Printf("Error updating interaction: %v", err) Type: discordgo.InteractionResponseChannelMessageWithSource,
} Data: &discordgo.InteractionResponseData{
return Content: "Error: Could not find the target message",
} Flags: discordgo.MessageFlagsEphemeral,
// Sort video formats: highest resolution first, then by bitrate
sort.Slice(formatOptions.VideoOptions, func(i, j int) bool {
// Compare by height (descending)
heightI := 0
if formatOptions.VideoOptions[i].Height != nil {
heightI = *formatOptions.VideoOptions[i].Height
}
heightJ := 0
if formatOptions.VideoOptions[j].Height != nil {
heightJ = *formatOptions.VideoOptions[j].Height
}
if heightI != heightJ {
return heightI > heightJ
}
// If heights are equal, compare by TBR (descending)
tbrI := 0.0
if formatOptions.VideoOptions[i].TBR != nil {
tbrI = *formatOptions.VideoOptions[i].TBR
}
tbrJ := 0.0
if formatOptions.VideoOptions[j].TBR != nil {
tbrJ = *formatOptions.VideoOptions[j].TBR
}
return tbrI > tbrJ
})
// Sort audio formats: highest bitrate first
sort.Slice(formatOptions.AudioOptions, func(i, j int) bool {
tbrI := 0.0
if formatOptions.AudioOptions[i].TBR != nil {
tbrI = *formatOptions.AudioOptions[i].TBR
}
tbrJ := 0.0
if formatOptions.AudioOptions[j].TBR != nil {
tbrJ = *formatOptions.AudioOptions[j].TBR
}
return tbrI > tbrJ
})
// Build video format options for Discord select menu
videoMenuOptions := []discordgo.SelectMenuOption{}
for _, vOpt := range formatOptions.VideoOptions {
label := fmt.Sprintf("%s (%s", vOpt.Resolution, vOpt.Ext)
if vOpt.TBR != nil {
label += fmt.Sprintf(", %.0fkbps", *vOpt.TBR)
}
label += ")"
// Discord has a 100 char limit on labels
if len(label) > 100 {
label = label[:97] + "..."
}
videoMenuOptions = append(videoMenuOptions, discordgo.SelectMenuOption{
Label: label,
Value: vOpt.FormatID,
})
// Discord has a limit of 25 options per select menu
if len(videoMenuOptions) >= 25 {
break
}
}
// Build audio format options for Discord select menu
audioMenuOptions := []discordgo.SelectMenuOption{}
for _, aOpt := range formatOptions.AudioOptions {
label := aOpt.Format
if aOpt.Language != nil {
label += fmt.Sprintf(" [%s]", *aOpt.Language)
}
if aOpt.TBR != nil {
label += fmt.Sprintf(" (%.0fkbps)", *aOpt.TBR)
}
// Discord has a 100 char limit on labels
if len(label) > 100 {
label = label[:97] + "..."
}
audioMenuOptions = append(audioMenuOptions, discordgo.SelectMenuOption{
Label: label,
Value: aOpt.FormatID,
})
// Discord has a limit of 25 options per select menu
if len(audioMenuOptions) >= 25 {
break
}
}
// Store format options in interaction state
setInteractionState(i.Interaction.Token, &InteractionState{
URL: url,
FormatOptions: formatOptions,
})
// Update message with format selection menus
_, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
Content: ptr("Select a video format:"),
Components: &[]discordgo.MessageComponent{
discordgo.ActionsRow{
Components: []discordgo.MessageComponent{
discordgo.SelectMenu{
CustomID: "video_select",
Placeholder: "Choose a video format...",
MaxValues: 1,
Options: videoMenuOptions,
},
},
},
discordgo.ActionsRow{
Components: []discordgo.MessageComponent{
discordgo.SelectMenu{
CustomID: "audio_select",
Placeholder: "Choose an audio format...",
MaxValues: 1,
Disabled: true,
Options: audioMenuOptions,
},
},
},
}, },
}) })
if err != nil { return
log.Printf("Error updating interaction: %v", err) }
} url := extractURLFromString(targetMsg.Content)
}() if url == "" {
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "Error: No URL provided",
Flags: discordgo.MessageFlagsEphemeral,
},
})
return
}
// Send initial "fetching formats" response
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: fmt.Sprintf("%s Fetching available formats...", loading_emoji),
Flags: discordgo.MessageFlagsEphemeral,
},
})
if err != nil {
log.Printf("Error: %v", err)
return
}
// Fetch formats asynchronously
go fetchAndShowFormats(s, i, url)
},
"version": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "[yt-dlp-bot](https://git.dubyatp.xyz/williamp/yt-dlp-bot) by dubyatp",
Flags: discordgo.MessageFlagsEphemeral,
},
})
}, },
} }
@@ -458,19 +365,29 @@ func main() {
if h, ok := commandHandlers[i.ApplicationCommandData().Name]; ok { if h, ok := commandHandlers[i.ApplicationCommandData().Name]; ok {
h(s, i) h(s, i)
} }
if h, ok := componentHandlers[i.ApplicationCommandData().Name]; ok {
h(s, i)
}
case discordgo.InteractionMessageComponent: case discordgo.InteractionMessageComponent:
if h, ok := commandHandlers[i.MessageComponentData().CustomID]; ok { customID := i.MessageComponentData().CustomID
h(s, i) if h, ok := componentHandlers[customID]; ok {
}
if h, ok := componentHandlers[i.MessageComponentData().CustomID]; ok {
h(s, i) h(s, i)
} else if strings.HasPrefix(customID, "retry:") {
url := strings.TrimPrefix(customID, "retry:")
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseUpdateMessage,
Data: &discordgo.InteractionResponseData{
Content: fmt.Sprintf("%s Fetching available formats...", loading_emoji),
Components: []discordgo.MessageComponent{},
Flags: discordgo.MessageFlagsEphemeral,
},
})
go fetchAndShowFormats(s, i, url)
} }
} }
}) })
log.Println("Initialize loading emoji")
initLoadingEmoji(s)
log.Println("Adding commands") log.Println("Adding commands")
registeredCommands := make([]*discordgo.ApplicationCommand, len(commands)) registeredCommands := make([]*discordgo.ApplicationCommand, len(commands))
for i, v := range commands { for i, v := range commands {
@@ -488,3 +405,154 @@ func main() {
s.Close() s.Close()
} }
func buildVideoMenuOptions(videoOptions []VideoOption) []discordgo.SelectMenuOption {
opts := make([]discordgo.SelectMenuOption, 0, 25)
for _, vOpt := range videoOptions {
label := fmt.Sprintf("%s (%s", vOpt.Resolution, vOpt.Ext)
if vOpt.TBR != nil {
label += fmt.Sprintf(", %.0fkbps", *vOpt.TBR)
}
label += ")"
if len(label) > 100 {
label = label[:97] + "..."
}
opts = append(opts, discordgo.SelectMenuOption{
Label: label,
Value: vOpt.FormatID,
})
if len(opts) >= 25 {
break
}
}
return opts
}
func buildAudioMenuOptions(audioOptions []AudioOption) []discordgo.SelectMenuOption {
opts := make([]discordgo.SelectMenuOption, 0, 25)
for _, aOpt := range audioOptions {
label := aOpt.Format
if aOpt.Language != nil {
label += fmt.Sprintf(" [%s]", *aOpt.Language)
}
if aOpt.TBR != nil {
label += fmt.Sprintf(" (%.0fkbps)", *aOpt.TBR)
}
if len(label) > 100 {
label = label[:97] + "..."
}
opts = append(opts, discordgo.SelectMenuOption{
Label: label,
Value: aOpt.FormatID,
})
if len(opts) >= 25 {
break
}
}
return opts
}
func fetchAndShowFormats(s *discordgo.Session, i *discordgo.InteractionCreate, url string) {
formatOptions, err := GetFormats(url)
if err != nil {
_, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
Content: ptr("❌ Error fetching formats: " + err.Error()),
Components: &[]discordgo.MessageComponent{
&discordgo.ActionsRow{
Components: []discordgo.MessageComponent{
discordgo.Button{
Label: "Retry",
CustomID: fmt.Sprintf("retry:%s", url),
},
},
},
},
})
if err != nil {
log.Printf("Error updating interaction: %v", err)
}
return
}
// Sort video formats: highest resolution first, then by bitrate
sort.Slice(formatOptions.VideoOptions, func(x, y int) bool {
heightX, heightY := 0, 0
if formatOptions.VideoOptions[x].Height != nil {
heightX = *formatOptions.VideoOptions[x].Height
}
if formatOptions.VideoOptions[y].Height != nil {
heightY = *formatOptions.VideoOptions[y].Height
}
if heightX != heightY {
return heightX > heightY
}
tbrX, tbrY := 0.0, 0.0
if formatOptions.VideoOptions[x].TBR != nil {
tbrX = *formatOptions.VideoOptions[x].TBR
}
if formatOptions.VideoOptions[y].TBR != nil {
tbrY = *formatOptions.VideoOptions[y].TBR
}
return tbrX > tbrY
})
// Sort audio formats: highest bitrate first
sort.Slice(formatOptions.AudioOptions, func(x, y int) bool {
tbrX, tbrY := 0.0, 0.0
if formatOptions.AudioOptions[x].TBR != nil {
tbrX = *formatOptions.AudioOptions[x].TBR
}
if formatOptions.AudioOptions[y].TBR != nil {
tbrY = *formatOptions.AudioOptions[y].TBR
}
return tbrX > tbrY
})
videoMenuOptions := buildVideoMenuOptions(formatOptions.VideoOptions)
audioMenuOptions := buildAudioMenuOptions(formatOptions.AudioOptions)
if len(videoMenuOptions) == 0 || len(audioMenuOptions) == 0 {
_, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
Content: ptr("❌ No separate video/audio streams found for this URL. The source may only provide combined formats."),
})
if err != nil {
log.Printf("Error updating interaction: %v", err)
}
return
}
setInteractionState(i.Interaction.Token, &InteractionState{
URL: url,
FormatOptions: formatOptions,
})
_, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
Content: ptr("Select a video format:"),
Components: &[]discordgo.MessageComponent{
discordgo.ActionsRow{
Components: []discordgo.MessageComponent{
discordgo.SelectMenu{
CustomID: "video_select",
Placeholder: "Choose a video format...",
MaxValues: 1,
Options: videoMenuOptions,
},
},
},
discordgo.ActionsRow{
Components: []discordgo.MessageComponent{
discordgo.SelectMenu{
CustomID: "audio_select",
Placeholder: "Choose an audio format...",
MaxValues: 1,
Disabled: true,
Options: audioMenuOptions,
},
},
},
},
})
if err != nil {
log.Printf("Error updating interaction: %v", err)
}
}
+61
View File
@@ -1,6 +1,67 @@
package main package main
import (
"fmt"
"log"
"regexp"
_ "embed"
"encoding/base64"
"github.com/bwmarrin/discordgo"
)
var loading_emoji string
//go:embed assets/loading.webp
var rawLoadingEmoji []byte
var loadingEmojiBase64 = func() string {
s := "data:image/webp;base64," + base64.StdEncoding.EncodeToString(rawLoadingEmoji)
rawLoadingEmoji = nil
return s
}()
func initLoadingEmoji(s *discordgo.Session) {
emojis, err := s.ApplicationEmojis(s.State.User.ID)
if err != nil {
log.Panic("Cannot get emojis")
}
for _, e := range emojis {
if e.Name == "loading" {
loading_emoji = fmt.Sprintf("<a:%s:%s>", e.Name, e.ID)
return
}
}
e, err := s.ApplicationEmojiCreate(s.State.User.ID, &discordgo.EmojiParams{
Name: "loading",
Image: loadingEmojiBase64,
})
if err != nil {
log.Panicf("Cannot create loading emoji: %s", err)
}
loading_emoji = fmt.Sprintf("<a:%s:%s>", e.Name, e.ID)
}
var urlPattern = regexp.MustCompile(`https?://\S+`)
func extractURLFromString(in_url string) string {
return string(urlPattern.Find([]byte(in_url)))
}
// Helper function to create string pointer // Helper function to create string pointer
func ptr(s string) *string { func ptr(s string) *string {
return &s return &s
} }
func formatBytes(b int) string {
switch {
case b >= 1<<30:
return fmt.Sprintf("%.1f GB", float64(b)/float64(1<<30))
case b >= 1<<20:
return fmt.Sprintf("%.1f MB", float64(b)/float64(1<<20))
case b >= 1<<10:
return fmt.Sprintf("%.1f KB", float64(b)/float64(1<<10))
default:
return fmt.Sprintf("%d B", b)
}
}
+10 -15
View File
@@ -1,11 +1,5 @@
package main package main
import (
"time"
"github.com/lrstanley/go-ytdlp"
)
type DownloadOptions struct { type DownloadOptions struct {
EmbedThumbnail bool EmbedThumbnail bool
IncludeSubtitles bool IncludeSubtitles bool
@@ -35,19 +29,20 @@ type FormatOptions struct {
} }
type ProgressUpdate struct { type ProgressUpdate struct {
Status ytdlp.ProgressStatus Phase string
Percent string DownloadedBytes int
ETA time.Duration Filename string
Filename string
Phase string
} }
// InteractionState holds the state for a specific interaction // InteractionState holds the state for a specific interaction
type InteractionState struct { type InteractionState struct {
URL string Requester string
FormatOptions *FormatOptions URL string
VideoFormatID string FormatOptions *FormatOptions
AudioFormatID string VideoFormatID string
VideoFormatName string
AudioFormatID string
AudioFormatName string
} }
// DownloadResult represents the result of an async download operation // DownloadResult represents the result of an async download operation
+74 -23
View File
@@ -3,17 +3,25 @@ package main
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"os"
"path/filepath"
"sync"
"time" "time"
"github.com/lrstanley/go-ytdlp" "github.com/lrstanley/go-ytdlp"
) )
var ytdlpBinary = os.Getenv("YTDLP_BIN")
func GetFormats(url string) (*FormatOptions, error) { func GetFormats(url string) (*FormatOptions, error) {
dl := ytdlp.New(). dl := ytdlp.New().
SetExecutable(ytdlpBinary).
SkipDownload(). SkipDownload().
DumpJSON() DumpJSON()
result, err := dl.Run(context.TODO(), url) ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
result, err := dl.Run(ctx, url)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -91,36 +99,79 @@ func GetFormats(url string) (*FormatOptions, error) {
return formatOpts, nil return formatOpts, nil
} }
func DownloadVideo(out_dir, url string, opts DownloadOptions, progressChan chan<- ProgressUpdate) { func dirSize(path string) int {
defer close(progressChan) var total int64
filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
if err == nil && !info.IsDir() {
total += info.Size()
}
return nil
})
return int(total)
}
var lastPhase string func DownloadVideo(out_dir, temp_dir, url string, opts DownloadOptions, progressChan chan<- ProgressUpdate) {
var mu sync.Mutex
currentPhase := "downloading"
currentFilename := ""
// Poll the temp directory for actual bytes-on-disk progress.
// The yt-dlp progress callback only tracks phase/filename since
// DownloadedBytes from the callback is unreliable for DASH streams.
var wg sync.WaitGroup
wg.Add(1)
stopPoll := make(chan struct{})
go func() {
defer wg.Done()
ticker := time.NewTicker(500 * time.Millisecond)
defer ticker.Stop()
for {
select {
case <-stopPoll:
return
case <-ticker.C:
mu.Lock()
phase := currentPhase
filename := currentFilename
mu.Unlock()
progressChan <- ProgressUpdate{
Phase: phase,
DownloadedBytes: dirSize(temp_dir),
Filename: filename,
}
}
}
}()
defer func() {
close(stopPoll)
wg.Wait()
close(progressChan)
}()
homePath := "home:" + out_dir
tempPath := "temp:" + temp_dir
dl := ytdlp.New(). dl := ytdlp.New().
SetWorkDir(out_dir). SetExecutable(ytdlpBinary).
RecodeVideo("mp4"). Paths(homePath).
Paths(tempPath).
ProgressFunc(100*time.Millisecond, func(prog ytdlp.ProgressUpdate) { ProgressFunc(100*time.Millisecond, func(prog ytdlp.ProgressUpdate) {
// Detect phase transition -- differentiate "downloading" as the main download if prog.Status == ytdlp.ProgressStatusFinished ||
// and "post processing" when the file name changes, preventing it from appearing "reset" prog.Status == ytdlp.ProgressStatusStarting ||
prog.Status == ytdlp.ProgressStatusError {
return
}
phase := "downloading" phase := "downloading"
if prog.Status == ytdlp.ProgressStatusDownloading && prog.Percent() == 0.0 { if prog.Status == ytdlp.ProgressStatusPostProcessing {
// If we already had progress, it's likely post-processing
if lastPhase == "downloading" {
phase = "post-processing"
}
} else if prog.Status != ytdlp.ProgressStatusDownloading {
phase = "post-processing" phase = "post-processing"
} }
lastPhase = phase mu.Lock()
currentPhase = phase
progressChan <- ProgressUpdate{ currentFilename = prog.Filename
Status: prog.Status, mu.Unlock()
Percent: prog.PercentString(),
ETA: prog.ETA(),
Filename: prog.Filename,
Phase: phase,
}
}). }).
Output("%(title)s.%(ext)s") Output("%(title)s.%(ext)s")
Generated
+3 -3
View File
@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1770537093, "lastModified": 1772674223,
"narHash": "sha256-pF1quXG5wsgtyuPOHcLfYg/ft/QMr8NnX0i6tW2187s=", "narHash": "sha256-/suKbHSaSmuC9UY7G0VRQ3aO+QKqxAQPQ19wG7QNkF8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "fef9403a3e4d31b0a23f0bacebbec52c248fbb51", "rev": "66d9241e3dc2296726dc522e62dbfe89c7b449f3",
"type": "github" "type": "github"
}, },
"original": { "original": {
+2
View File
@@ -46,6 +46,8 @@
.venv/bin/pip install -r ./app/requirements.txt .venv/bin/pip install -r ./app/requirements.txt
source .venv/bin/activate source .venv/bin/activate
fi fi
export YTDLP_BIN=${pkgs.lib.getExe pkgs.yt-dlp}
''; '';
}; };
}); });
+17 -2
View File
@@ -1,3 +1,18 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json" "$schema": "https://docs.renovatebot.com/renovate-schema.json",
} "customManagers": [
{
"description": "Update yt-dlp version in Dockerfiles",
"customType": "regex",
"managerFilePatterns": [
"/^Dockerfile$/"
],
"matchStrings": [
"ARG YT_DLP_VERSION=\"(?<currentValue>.*?)\""
],
"datasourceTemplate": "github-tags",
"depNameTemplate": "yt-dlp/yt-dlp",
"versioningTemplate": "regex:^(?<major>\\d{4})\\.(?<minor>\\d{2})\\.(?<patch>\\d{2})$"
}
]
}