added gitlab workflow and unraid CA template
This commit is contained in:
38
.github/workflows/docker-build.yaml
vendored
Normal file
38
.github/workflows/docker-build.yaml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
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
|
||||
if: steps.current.outputs.version != steps.latest.outputs.version
|
||||
run: echo ${{ steps.latest.outputs.version }} > version.txt
|
||||
|
||||
- name: Build and push docker image
|
||||
if: steps.current.outputs.version != steps.latest.outputs.version
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
tags: eulaly/youdis:latest,eulaly/youdis:${{ steps.latest.outputs.version }}
|
||||
BIN
.gitignore
vendored
BIN
.gitignore
vendored
Binary file not shown.
@@ -5,7 +5,6 @@ RUN apk update && \
|
||||
apk add --no-cache build-base ffmpeg && \
|
||||
rm -rf /var/cache/apk/*
|
||||
COPY requirements.txt requirements.txt
|
||||
COPY data.json data.json
|
||||
RUN python3 -m pip install --no-cache-dir -r requirements.txt
|
||||
COPY youdis.py youdis.py
|
||||
CMD ["python3", "youdis.py"]
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
27
unraid-ca-template.xml
Normal file
27
unraid-ca-template.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<Container version="2">
|
||||
<Name>youdis</Name>
|
||||
<Repository>spoonvacuum/youdis</Repository>
|
||||
<Registry>https://hub.docker.com/r/spoonvacuum/youdis/</Registry>
|
||||
<Network>bridge</Network>
|
||||
<MyIP/>
|
||||
<Shell>sh</Shell>
|
||||
<Privileged>false</Privileged>
|
||||
<Support>https://github.com/eulaly/youdis</Support>
|
||||
<Project>https://github.com/eulaly/youdis</Project>
|
||||
<Overview>Discord bot-based wrapper for yt-dlp. Supports playlists. Requires a configured Discord bot.</Overview>
|
||||
<Category>Downloaders: Tools:</Category>
|
||||
<WebUI/>
|
||||
<TemplateURL/>
|
||||
<Icon>https://raw.githubusercontent.com/yt-dlp/yt-dlp/master/.github/banner.svg</Icon>
|
||||
<ExtraParams/>
|
||||
<PostArgs/>
|
||||
<CPUset/>
|
||||
<DateInstalled>1737955166</DateInstalled>
|
||||
<DonateText/>
|
||||
<DonateLink/>
|
||||
<Requires/>
|
||||
<Config Name="api_token" Target="api_token" Default="" Mode="" Description="Discord bot token" Type="Variable" Display="always" Required="true" Mask="true"/>
|
||||
<Config Name="Downloads" Target="/downloads" Default="/mnt/user/downloads/youtube" Mode="rw" Description="Video download location" Type="Path" Display="always" Required="true"/>
|
||||
<Config Name="Config" Target="/config" Default="/mnt/user/appdata/youdis/config" Mode="rw" Description="Config location (archive.txt, users.json)" Type="Path" Display="always" Required="true"/>
|
||||
</Container>
|
||||
12
youdis.py
12
youdis.py
@@ -14,8 +14,10 @@ import json
|
||||
import asyncio
|
||||
import threading
|
||||
|
||||
user_file = '/config/users.json'
|
||||
|
||||
bot = interactions.Client(intents=interactions.Intents.DEFAULT,default_scope=2147491904)
|
||||
with open('./data.json', 'r') as f:
|
||||
with open(user_file, 'r') as f:
|
||||
authorized_users = json.load(f).get('authorized_users')
|
||||
print(f'authorized_users:{authorized_users}')
|
||||
title = ''
|
||||
@@ -61,12 +63,12 @@ async def youtube(ctx: interactions.SlashContext, url:str):
|
||||
'format':'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best',
|
||||
'fragment_tries': 10,
|
||||
'restrictfilenames':True,
|
||||
'paths': {'home':'/unraid'},
|
||||
'paths': {'home':'/downloads'},
|
||||
'retries':10,
|
||||
'writeinfojson':False,
|
||||
'allow_playlist_files':True,
|
||||
'noplaylist':True,
|
||||
'download_archive':'/unraid/archive.txt',
|
||||
'download_archive':'/config/archive.txt',
|
||||
'progress_hooks':[hook],
|
||||
'outtmpl': '%(uploader)s/%(playlist_title)s/%(playlist_index)s%(playlist_index& - )s%(title)s.%(ext)s',
|
||||
'outtmpl_na_placeholder':'',
|
||||
@@ -75,7 +77,7 @@ async def youtube(ctx: interactions.SlashContext, url:str):
|
||||
if ctx.author.id not in authorized_users:
|
||||
if ctx.author.id == 127831327012683776:
|
||||
await ctx.author.send('potato stop')
|
||||
await ctx.author.send('you are not authorized to use this command. message Ben to be added.')
|
||||
await ctx.author.send('you are not authorized to use this command. message my owner to be added.')
|
||||
return
|
||||
else:
|
||||
await ctx.channel.send(f'Downloading from <{url}>. Status updates via DM.')
|
||||
@@ -112,7 +114,7 @@ async def _interrupt(ctx):
|
||||
async def _adduser(ctx: interactions.SlashContext, user:interactions.OptionType.USER):
|
||||
if str(user.id) not in authorized_users:
|
||||
authorized_users.append(str(user.id))
|
||||
with open('./data.json','w') as f: #overwrite file - fix later if other params come up
|
||||
with open(user_file,'w') as f: #overwrite file - fix later if other params come up
|
||||
json.dump({'authorized_users':authorized_users})
|
||||
print('react:checkmark')
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
19
yt-dlp.conf
19
yt-dlp.conf
@@ -1,19 +0,0 @@
|
||||
# yt-dlp configuration file
|
||||
# order matters. yt-dlp always reads this conf
|
||||
# and runs the first -o that matches the condition
|
||||
|
||||
# Save videos as MP4
|
||||
-f bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best
|
||||
|
||||
# Restrict filenames to be Windows-safe
|
||||
--restrict-filenames
|
||||
|
||||
--match-filter "channel != null"
|
||||
-o a:/youtube/%(uploader)s/%(title)s.%ext(s)
|
||||
|
||||
# Output template for playlists
|
||||
--match-filter "playlist_title != null"
|
||||
-o a:/youtube/%(uploader)s-%(playlist_title)s/%(playlist_index)s-%(title)s.%(ext)s
|
||||
|
||||
# Default output template
|
||||
-o %(title)s.%(ext)s
|
||||
Reference in New Issue
Block a user