Compare commits

..

31 Commits

Author SHA1 Message Date
a399a91ab0 fixed typo
All checks were successful
push new builds to gitea, dockerhub / build (push) Successful in 1m27s
2025-08-29 20:22:34 -04:00
ec72c5657b reindex files to force unix line endings in .sh files
All checks were successful
push new builds to gitea, dockerhub / build (push) Successful in 1m26s
2025-08-29 16:24:33 -04:00
f8f625f0bf fix typo
All checks were successful
push new builds to gitea, dockerhub / build (push) Successful in 1m6s
2025-08-29 16:11:29 -04:00
22fb495e0d fix docker syntax
Some checks failed
push new builds to gitea, dockerhub / build (push) Failing after 2m40s
2025-08-29 15:29:03 -04:00
33d5de6a77 update ytdlp on container start; cleanup gitea workflow
Some checks failed
push new builds to gitea, dockerhub / build (push) Failing after 38s
2025-08-29 15:22:10 -04:00
d539915486 cleanup and remove github workflow
Some checks failed
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Failing after 1m6s
2025-08-24 22:42:15 -04:00
f173c64b70 Revert "removed github workflow"
Some checks failed
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Failing after 26s
This reverts commit 750dc265ca.
2025-08-24 22:40:20 -04:00
750dc265ca removed github workflow
Some checks failed
weekly, if new yt-dlp version, build + push containers to docker / build (push) Failing after 27s
2025-08-24 22:29:45 -04:00
846d07f099 fixed gitea api url
Some checks failed
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Failing after 1m7s
2025-08-24 22:25:19 -04:00
adca108376 chagnged to link using api
Some checks failed
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Failing after 1m45s
2025-08-24 22:16:05 -04:00
748e3fb22a gitea vars redux
Some checks failed
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Failing after 58s
2025-08-24 19:00:35 -04:00
0968aa84b8 fixed username
Some checks failed
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Failing after 59s
2025-08-24 17:59:28 -04:00
b74f70c42e added gitea repo variables
Some checks failed
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Failing after 49s
2025-08-24 17:56:31 -04:00
07cdae823a gitea registry /youdis, tags ben/youdis
Some checks failed
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Failing after 2m32s
2025-08-24 17:20:05 -04:00
81619074d7 fixed youdis shortsha syntax
All checks were successful
weekly, if new yt-dlp, build + push container to docker/gitea / build (push) Successful in 2m29s
2025-08-24 15:35:21 -04:00
690f97ed82 consol. dev build tag; push directly to youdis container repo
Some checks failed
build + push containers to gitea (every) and docker (daily) / build (push) Failing after 56s
2025-08-24 15:28:44 -04:00
b772383d14 collapsed to single job
All checks were successful
build + push containers to gitea (every) and docker (daily) / build (push) Successful in 3m2s
2025-08-24 14:57:32 -04:00
53fbcc5a8a fix gitea user 2025-08-24 14:28:34 -04:00
713f316679 fixed: secrets cannot begin with "GITEA_" or "GITHUB_" 2025-08-24 14:24:14 -04:00
08bcc3d3bd split jobs into versioining, dockerhub, gitea 2025-08-23 14:43:48 -04:00
0abf3a5adb added ytdlp/youdis version tags, check youdis:latest before build
Some checks failed
build + push containers to gitea (every) and docker (daily) / docker (push) Has been cancelled
2025-08-23 14:36:30 -04:00
32ed9bc81b update version to 20250823-b37e943
Some checks failed
build + push containers to gitea (every) and docker (daily) / dockerhub (push) Failing after 25s
build + push containers to gitea (every) and docker (daily) / gitea (push) Failing after 15s
2025-08-23 12:15:11 -04:00
b37e943a8a added workflow.txt 2025-08-23 12:15:05 -04:00
7ada5c6bb9 revert docker/login-action v2 since v3 failed
Some checks failed
build + push containers to gitea (every) and docker (daily) / dockerhub (push) Failing after 24s
build + push containers to gitea (every) and docker (daily) / gitea (push) Failing after 16s
2025-08-23 11:35:16 -04:00
d94b63b1f0 split workflow stespt o push every update to gitea
Some checks failed
build + push containers to gitea (every) and docker (daily) / dockerhub (push) Failing after 3m45s
build + push containers to gitea (every) and docker (daily) / gitea (push) Failing after 17s
2025-08-23 11:19:48 -04:00
1d6e9bac6f fixed archive.txt 2025-08-19 16:26:50 -04:00
460efe192a updated yt-dlp[default] --pre to pull nightly 2025-08-19 15:53:15 -04:00
18a95da9b1 fixed userFile FileExistsError 2025-08-19 15:36:37 -04:00
05b05e6725 fixed dockerfile permission issue 2025-08-17 13:39:11 -04:00
a09dbc4687 added create-ytdlp-config.sh 2025-08-16 23:13:47 -04:00
b0c0bb1d21 fix dockerfile syntax error 2025-08-16 21:59:49 -04:00
16 changed files with 371 additions and 346 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.sh text eol=lf

View File

@@ -1,7 +1,8 @@
name: Check yt-dlp weekly and rebuild if new name: push new builds to gitea, dockerhub
on: on:
schedule: push:
- cron: '0 0 * * 0' branches: ["master"]
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -10,35 +11,62 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Get current version - name: Get youdis version
id: current id: youdis
run: | run: |
CURRENT=$(cat version.txt || echo "none") YOUDIS_VER=$(cat youdis-version.txt)
echo "version=$CURRENT" >> $GITHUB_OUTPUT if [ -z "$YOUDIS_VER" ]; then
echo "youdis version empty" >&2
- name: Check latest version
id: latest
run: |
LATEST=$(curl -s https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest | jq -r .tag_name || echo "error")
if [ "$LATEST" == "error" ]; then
echo "failed to fetch latest version" >&2
exit 1 exit 1
fi fi
echo "version=$LATEST" >> $GITHUB_OUTPUT echo "youdis-version=$YOUDIS_VER" >> $GITHUB_OUTPUT
echo "shortsha=${GITHUB_SHA::5}" >> $GITHUB_OUTPUT
- name: Update version file if changed - name: Decide if build needed
run: echo ${{ steps.latest.outputs.version }} > version.txt id: check_build
if: ${{ steps.current.outputs.version != steps.latest.outputs.version }} run: |
SHOULD_BUILD=false
if [ "${{ steps.youdis.outputs.youdis-version }}" != "$(docker inspect --format='{{ index .Config.Labels "YOUDIS_VERSION" }}' eulaly/youdis:latest || echo none)" ]; then
SHOULD_BUILD=true
fi
echo "should_build=$SHOULD_BUILD" >> $GITHUB_OUTPUT
- name: Login to Dockerhub - name: Login to Dockerhub
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push docker image - name: Build and push to Dockerhub
if: ${{ steps.check_build.outputs.should_build == 'true' }}
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
push: true push: true
tags: eulaly/youdis:latest,eulaly/youdis:${{ steps.latest.outputs.version }} tags: |
if: ${{ steps.current.outputs.version != steps.latest.outputs.version }} eulaly/youdis:latest
eulaly/youdis:${{ steps.youdis.outputs.shortsha }}
labels: |
YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }}
- name: Login to Gitea
uses: docker/login-action@v3
with:
registry: git.hgsky.me
username: ${{ secrets.USERNAME }}
password: ${{ secrets.YOUDIS_PASSWORD }}
- name: Build and push to Gitea
if: ${{ steps.check_build.outputs.should_build == 'true' }}
uses: docker/build-push-action@v5
with:
push: true
tags: |
git.hgsky.me/ben/youdis:latest
git.hgsky.me/ben/youdis:${{ steps.youdis.outputs.shortsha }}
labels: |
YOUDIS_VERSION=${{ steps.youdis.outputs.youdis-version }}
- name: link container in gitea
run: |
curl -X POST -H "Authorization: token ${{ secrets.SUPER }}" https://git.hgsky.me/api/v1/packages/ben/container/youdis/-/link/youdis

View File

@@ -1,44 +0,0 @@
name: Check yt-dlp and rebuild if new
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get current version
id: current
run: |
CURRENT=$(cat version.txt || echo "none")
echo "version=$CURRENT" >> $GITHUB_OUTPUT
- name: Check latest version
id: latest
run: |
LATEST=$(curl -s https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest | jq -r .tag_name || echo "error")
if [ "$LATEST" == "error" ]; then
echo "failed to fetch latest version" >&2
exit 1
fi
echo "version=$LATEST" >> $GITHUB_OUTPUT
- name: Update version file if changed
run: echo ${{ steps.latest.outputs.version }} > version.txt
if: ${{ steps.current.outputs.version != steps.latest.outputs.version }}
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@v5
with:
push: true
tags: eulaly/youdis:latest,eulaly/youdis:${{ steps.latest.outputs.version }}
if: ${{ steps.current.outputs.version != steps.latest.outputs.version }}

BIN
.gitignore vendored

Binary file not shown.

View File

@@ -4,10 +4,13 @@ WORKDIR /app
RUN apk update && \ RUN apk update && \
apk add --no-cache build-base ffmpeg && \ apk add --no-cache build-base ffmpeg && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
COPY requirements.txt requirements.txt COPY requirements.txt .
RUN python3 -m pip install --no-cache-dir -r requirements.txt RUN python3 -m pip install --no-cache-dir -r requirements.txt
COPY youdis.py youdis.py
COPY default-yt-dlp.conf /app/default-yt-dlp.conf COPY youdis.py default-yt-dlp.conf update-ytdlp.sh run-youdis.sh /app/
COPY create-ytdlp-conf.sh /app/create-ytdlp-conf.sh RUN chmod +x /app/update-ytdlp.sh /app/run-youdis.sh
ENTRYPOINT ["/app/create-ytdlp-conf.sh"]
CMD ["python3", "youdis.py"] COPY weekly-restart /etc/cron.d/
RUN chmod 0644 /etc/cron.d/weekly-restart
ENTRYPOINT ["/app/run-youdis.sh"]

Binary file not shown.

21
run-youdis.sh Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
set -e
#start crond in bg
crond -l 2
echo "checking for /config/yt-dlp.conf"
#copy yt-dlp.conf if missing
mkdir -p /config
if [ ! -f /config/yt-dlp.conf ]; then
echo "yt-dlp.conf not found, setting default"
cp /app/default-yt-dlp.conf /config/yt-dlp.conf
echo "created yt-dlp.conf"
fi
python3 -m pip install --no-cache-dir --upgrade --pre "yt-dlp[default]"
VERSION=$(python3 -m pip show yt-dlp 2>/dev/null | awk '/Version:/ {print $2}')
echo "updated yt-dlp to $VERSION"
echo "starting youdis"
exec python3 /app/youdis.py

12
update-ytdlp.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
set -e
echo "updating yt-dlp"
echo "killing youdis"
pkill -f youdis.py || true
python3 -m pip install --no-cache-dir --upgrade --pre "yt-dlp[default]"
VERSION=$(python3 -m pip show yt-dlp 2>/dev/null | awk '/Version:/ {print $2}')
echo "updated yt-dlp to $VERSION"
echo "restarting youdis"
python3 /app/youdis.py &

1
weekly-restart Normal file
View File

@@ -0,0 +1 @@
0 3 * * 0 root /app/update-ytdlp.sh

1
youdis-version.txt Normal file
View File

@@ -0,0 +1 @@
20250829-ec72c56

View File

@@ -16,6 +16,7 @@ import asyncio
import threading import threading
userFile = Path('/config/users.json') userFile = Path('/config/users.json')
userFile.touch(exist_ok=True)
bot = interactions.Client(intents=interactions.Intents.DEFAULT,default_scope=2147491904) bot = interactions.Client(intents=interactions.Intents.DEFAULT,default_scope=2147491904)
@@ -24,6 +25,7 @@ try:
with open(userFile, 'x') as f: with open(userFile, 'x') as f:
print(f'users.json not found; saving to {userFile}') print(f'users.json not found; saving to {userFile}')
except FileExistsError: except FileExistsError:
with open(userFile, 'r') as f:
authorized_users = json.load(f).get('authorized_users') authorized_users = json.load(f).get('authorized_users')
print(f'authorized_users:{authorized_users}') print(f'authorized_users:{authorized_users}')
@@ -41,7 +43,7 @@ def create_hook(ctx,loop):
global title global title
status = d.get('status') status = d.get('status')
if status == 'error': if status == 'error':
msg = f'error; video probably already exists' msg = f'error; video probably already exists, have you checked archive.txt'
asyncio.run_coroutine_threadsafe(send_message(ctx,msg),loop) asyncio.run_coroutine_threadsafe(send_message(ctx,msg),loop)
elif d.get('info_dict').get('title') != title: elif d.get('info_dict').get('title') != title:
title = d.get('info_dict').get('title') title = d.get('info_dict').get('title')
@@ -75,7 +77,7 @@ async def youtube(ctx: interactions.SlashContext, url:str):
'writeinfojson':False, 'writeinfojson':False,
'allow_playlist_files':True, 'allow_playlist_files':True,
'noplaylist':True, 'noplaylist':True,
'download_archive':'./config/archive.txt', 'download_archive':'/config/archive.txt',
'progress_hooks':[hook], 'progress_hooks':[hook],
'outtmpl': '%(uploader)s/%(playlist_title)s/%(playlist_index)s%(playlist_index& - )s%(title)s.%(ext)s', 'outtmpl': '%(uploader)s/%(playlist_title)s/%(playlist_index)s%(playlist_index& - )s%(title)s.%(ext)s',
'outtmpl_na_placeholder':'', 'outtmpl_na_placeholder':'',