Compare commits
12 Commits
2558a7e930
...
master
Author | SHA1 | Date | |
---|---|---|---|
1a61e23204 | |||
319ffd2106 | |||
21f1da5cce | |||
2cb60ef696 | |||
c0a9422fbd
|
|||
dbcc948239 | |||
a4a6941453 | |||
bffe801da5
|
|||
82304688b8
|
|||
3ffb2e4640
|
|||
4986ab5e8d | |||
f5edccae1a |
@@ -9,6 +9,8 @@ jobs:
|
|||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest # Use a runner with Docker support
|
runs-on: ubuntu-latest # Use a runner with Docker support
|
||||||
container: ghcr.io/catthehacker/ubuntu:act-latest # Image with Docker pre-installed
|
container: ghcr.io/catthehacker/ubuntu:act-latest # Image with Docker pre-installed
|
||||||
|
outputs:
|
||||||
|
sha_short: ${{ steps.vars.outputs.sha_short }}
|
||||||
steps:
|
steps:
|
||||||
# Checkout the repository code
|
# Checkout the repository code
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -32,7 +34,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
registry: git.dubyatp.xyz
|
registry: git.dubyatp.xyz
|
||||||
username: williamp
|
username: williamp
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }} # Personal Access Token for authentication
|
password: ${{ secrets.ACTIONS_TOKEN }} # Personal Access Token for authentication
|
||||||
|
|
||||||
# Build and push the Docker image
|
# Build and push the Docker image
|
||||||
- name: Build and Push Docker Image
|
- name: Build and Push Docker Image
|
||||||
@@ -46,3 +48,33 @@ jobs:
|
|||||||
git.dubyatp.xyz/williamp/yt-dlp-bot:latest
|
git.dubyatp.xyz/williamp/yt-dlp-bot:latest
|
||||||
git.dubyatp.xyz/williamp/yt-dlp-bot:${{steps.vars.outputs.sha_short }}
|
git.dubyatp.xyz/williamp/yt-dlp-bot:${{steps.vars.outputs.sha_short }}
|
||||||
# Tags the image with 'latest' and the commit SHA
|
# Tags the image with 'latest' and the commit SHA
|
||||||
|
|
||||||
|
deploy-on-green:
|
||||||
|
needs: build-and-push
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ success() }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout target repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: infrastructure/core-apps
|
||||||
|
token: ${{ secrets.ACTIONS_TOKEN }}
|
||||||
|
ref: main
|
||||||
|
|
||||||
|
- name: Update image tag in deployment.yaml
|
||||||
|
uses: mikefarah/yq@master
|
||||||
|
with:
|
||||||
|
cmd: yq eval '.spec.template.spec.containers[0].image = "git.dubyatp.xyz/williamp/yt-dlp-bot:${{ needs.build-and-push.outputs.sha_short }}"' -i yt-dlp-bot/deployment.yaml
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
run: |
|
||||||
|
git config --local user.email "actions@noreply.dubyatp.xyz"
|
||||||
|
git config --local user.name "actions[bot]"
|
||||||
|
git commit -a -m "yt-dlp-bot: deploy update to ${{ needs.build-and-push.outputs.sha_short }}"
|
||||||
|
|
||||||
|
- name: Push changes
|
||||||
|
uses: ad-m/github-push-action@v0.8.0
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.ACTIONS_TOKEN }}
|
||||||
|
repository: infrastructure/core-apps
|
||||||
|
branch: main
|
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.13.5-alpine3.22
|
FROM python:3.13.6-alpine3.22
|
||||||
COPY ./app /app
|
COPY ./app /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add ffmpeg
|
RUN apk add ffmpeg
|
||||||
|
19
app/main.py
19
app/main.py
@@ -126,16 +126,29 @@ class DownloadVideo(ui.View):
|
|||||||
|
|
||||||
worker_task = asyncio.create_task(progress_worker(msg))
|
worker_task = asyncio.create_task(progress_worker(msg))
|
||||||
|
|
||||||
|
error = None
|
||||||
|
|
||||||
async def progress_callback(percent):
|
async def progress_callback(percent):
|
||||||
await progress_queue.put(percent)
|
await progress_queue.put(percent)
|
||||||
|
|
||||||
await asyncio.to_thread(
|
loop = asyncio.get_running_loop()
|
||||||
ytdlp.download_video, self.url, format_string, out_path, temp_path, progress_callback, asyncio.get_event_loop()
|
def threaded_download():
|
||||||
)
|
nonlocal error
|
||||||
|
try:
|
||||||
|
ytdlp.download_video(
|
||||||
|
self.url, format_string, out_path, temp_path, progress_callback, loop
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
error = e
|
||||||
|
await asyncio.to_thread(threaded_download)
|
||||||
|
|
||||||
stop_event.set()
|
stop_event.set()
|
||||||
await worker_task
|
await worker_task
|
||||||
|
|
||||||
|
if error:
|
||||||
|
await msg.edit(content=f"❌ Download failed: {error}")
|
||||||
|
return
|
||||||
|
|
||||||
# Show completion and summary
|
# Show completion and summary
|
||||||
await msg.edit(content="✅ Download complete!\n"
|
await msg.edit(content="✅ Download complete!\n"
|
||||||
)
|
)
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
discord.py==2.5.2
|
discord.py==2.5.2
|
||||||
python-dotenv==1.1.1
|
python-dotenv==1.1.1
|
||||||
yt-dlp==2025.6.30
|
yt-dlp==2025.8.11
|
@@ -10,7 +10,7 @@ def get_formats(url: str):
|
|||||||
|
|
||||||
for fmt in info['formats']:
|
for fmt in info['formats']:
|
||||||
# Video-only
|
# Video-only
|
||||||
if fmt.get('vcodec') != 'none' and fmt.get('acodec') == 'none':
|
if fmt.get('vcodec') != 'none' and fmt.get('acodec') == 'none' and fmt.get('__needs_testing') == None:
|
||||||
video_options.append({
|
video_options.append({
|
||||||
'height': fmt.get('height'),
|
'height': fmt.get('height'),
|
||||||
'resolution': fmt.get('resolution'),
|
'resolution': fmt.get('resolution'),
|
||||||
@@ -19,7 +19,7 @@ def get_formats(url: str):
|
|||||||
'tbr': fmt.get('tbr'),
|
'tbr': fmt.get('tbr'),
|
||||||
})
|
})
|
||||||
# Audio-only
|
# Audio-only
|
||||||
elif fmt.get('acodec') != 'none' and fmt.get('vcodec') == 'none':
|
elif fmt.get('acodec') != 'none' and fmt.get('vcodec') == 'none' and fmt.get('__needs_testing') == None:
|
||||||
audio_options.append({
|
audio_options.append({
|
||||||
'format': fmt.get('format'),
|
'format': fmt.get('format'),
|
||||||
'format_id': fmt.get('format_id'),
|
'format_id': fmt.get('format_id'),
|
||||||
|
3
renovate.json
Normal file
3
renovate.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||||
|
}
|
Reference in New Issue
Block a user