Compare commits
3 Commits
043c8b4df3
...
4abd39f884
| Author | SHA1 | Date | |
|---|---|---|---|
| 4abd39f884 | |||
| 266ed86217 | |||
| 0aa9950e18 |
@@ -2,9 +2,9 @@ v2 architecture draft: see `docs/architecture-v2.org`
|
|||||||
|
|
||||||
build and run the docker container
|
build and run the docker container
|
||||||
```
|
```
|
||||||
api_token = [discord bot token]
|
DISCORD_BOT_TOKEN = [discord bot token]
|
||||||
-v [downloads]:/downloads
|
-v [downloads]:/downloads
|
||||||
-v [config]:/config
|
-v [config]:/config
|
||||||
```
|
```
|
||||||
config contains data to persist across container updates, i.e., unraid appdata,
|
config contains data to persist across container updates, i.e., unraid appdata,
|
||||||
such as users.json (authorized users) and yt-dlp's archive.txt
|
such as yt-dlp's archive.txt
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ user@paladin:~/proj/youdis$ curl http://127.0.0.1:8000/jobs/current
|
|||||||
- local dev now falls back to repo-local `.runtime/{config,downloads}` when `/config` or `/downloads` are not writable
|
- local dev now falls back to repo-local `.runtime/{config,downloads}` when `/config` or `/downloads` are not writable
|
||||||
- had to uninstall yt-dlp python pkg from the venv, which resulted in a '403 Forbidden'
|
- had to uninstall yt-dlp python pkg from the venv, which resulted in a '403 Forbidden'
|
||||||
|
|
||||||
* [ ] 2.0.2: update discord bot to use new backend (3)
|
* [X] 2.0.2: update discord bot to use new backend (3)
|
||||||
update the discord bot into a thin frontend that talks to the backend and verify the flow end to end
|
update the discord bot into a thin frontend that talks to the backend and verify the flow end to end
|
||||||
** pm notes
|
** pm notes
|
||||||
- this is the first real frontend proof. once this works cleanly, zulip/xmpp should mostly be adapter work rather than downloader rewrites.
|
- this is the first real frontend proof. once this works cleanly, zulip/xmpp should mostly be adapter work rather than downloader rewrites.
|
||||||
@@ -121,7 +121,7 @@ update the discord bot into a thin frontend that talks to the backend and verify
|
|||||||
- populate .env with dev env defaults
|
- populate .env with dev env defaults
|
||||||
|
|
||||||
** evidence
|
** evidence
|
||||||
- commit:
|
- commit: 5210d2c, 043cb4
|
||||||
- tests: https://youtu.be/20HxMMSqRyg?si=3v7mN2L88c_FxpQR 18m
|
- tests: https://youtu.be/20HxMMSqRyg?si=3v7mN2L88c_FxpQR 18m
|
||||||
1. start backend: `python3 -m uvicorn youdis.main:app --host 127.0.0.1 --port 8000`
|
1. start backend: `python3 -m uvicorn youdis.main:app --host 127.0.0.1 --port 8000`
|
||||||
2. create local env file: `cp .env.example .env`
|
2. create local env file: `cp .env.example .env`
|
||||||
@@ -205,10 +205,10 @@ python ./youdis.py
|
|||||||
- discord adapter is now a thin HTTP client of the backend; it no longer imports or configures yt-dlp
|
- discord adapter is now a thin HTTP client of the backend; it no longer imports or configures yt-dlp
|
||||||
- `YOUDIS_BACKEND_URL` controls which backend the adapter targets
|
- `YOUDIS_BACKEND_URL` controls which backend the adapter targets
|
||||||
- progress updates are currently implemented by polling `/jobs/current` and DMing only when the summary changes
|
- progress updates are currently implemented by polling `/jobs/current` and DMing only when the summary changes
|
||||||
- legacy auth/user-management commands were removed from the active adapter path and should be cleaned up formally in `2.0.3`
|
- legacy auth/user-management commands were removed from the active adapter path
|
||||||
- `.env` is now supported for local/dev convenience, while real environment variables still override it in prod/docker
|
- `.env` is now supported for local/dev convenience, while real environment variables still override it in prod/docker
|
||||||
- submitting via DM doesn't work
|
- command registration required explicit binding plus `@bot.listen()` listeners in this adapter structure
|
||||||
* [ ] 2.0.3: remove deprecated discord-bot functionality (2)
|
* [X] 2.0.3: remove deprecated discord-bot functionality (2)
|
||||||
delete or retire legacy bot behaviors that no longer fit once the backend split is in place
|
delete or retire legacy bot behaviors that no longer fit once the backend split is in place
|
||||||
** pm notes
|
** pm notes
|
||||||
- only remove this after the new path works. this is cleanup, not pioneering work.
|
- only remove this after the new path works. this is cleanup, not pioneering work.
|
||||||
@@ -227,11 +227,20 @@ delete or retire legacy bot behaviors that no longer fit once the backend split
|
|||||||
- deprecated artifacts are clearly removed or marked
|
- deprecated artifacts are clearly removed or marked
|
||||||
|
|
||||||
** evidence
|
** evidence
|
||||||
- commit:
|
- commit: 0aa9950
|
||||||
- tests:
|
- tests:
|
||||||
- datetime:
|
1. `python3 -m py_compile ./youdis.py ./youdis/adapters/discord.py`
|
||||||
|
2. `rg -n "users.json|api_token" README.md unraid-ca-template.xml youdis.py youdis/adapters/discord.py`
|
||||||
|
3. start backend: `python3 -m uvicorn youdis.main:app --host 127.0.0.1 --port 8000`
|
||||||
|
4. start adapter: `python3 ./youdis.py`
|
||||||
|
5. in discord, run `/youtube`, `/status`, and `/interrupt` and confirm the adapter still works after cleanup
|
||||||
|
- datetime: [2026-04-02 Thu 12:09]
|
||||||
|
|
||||||
** notes
|
** notes
|
||||||
|
- active bot path no longer includes local auth or user-management behavior
|
||||||
|
- top-level `youdis.py` remains as a thin launcher so existing operator habits and scripts do not break during the refactor
|
||||||
|
- cleanup updated user-facing deployment artifacts to match the v2 naming and architecture, including `DISCORD_BOT_TOKEN` and removal of `users.json` references
|
||||||
|
- archived planning docs were intentionally left untouched: `pm/tasks.org` is historical and `pm/notes.org` is personal working notes
|
||||||
|
|
||||||
* [ ] 2.0.4: fix automation and build pipeline (3)
|
* [ ] 2.0.4: fix automation and build pipeline (3)
|
||||||
repair and simplify the build/update/deploy path so it matches the new backend-plus-frontend structure
|
repair and simplify the build/update/deploy path so it matches the new backend-plus-frontend structure
|
||||||
@@ -257,3 +266,35 @@ repair and simplify the build/update/deploy path so it matches the new backend-p
|
|||||||
- datetime:
|
- datetime:
|
||||||
|
|
||||||
** notes
|
** notes
|
||||||
|
|
||||||
|
* ==== BACKLOG ====
|
||||||
|
Tasks below this line are inactive and should not be touched.
|
||||||
|
* [ ] X.x.x: clean up discord adapter UI
|
||||||
|
|
||||||
|
** acceptance criteria
|
||||||
|
1. fix interaction pattern so it doesnt time out - prefer "command accepted" or somehting
|
||||||
|
2. remove all intermediate messages between "accepted/running" and "complete" - /status handles this!
|
||||||
|
- discord can also output a "busy" signal, research this
|
||||||
|
3. fix output syntax, we dont need to get crazy with discord cards
|
||||||
|
|
||||||
|
** evidence
|
||||||
|
- commit:
|
||||||
|
- tests:
|
||||||
|
- date:
|
||||||
|
|
||||||
|
** notes
|
||||||
|
|
||||||
|
* [ ] X.x.x: fix youtube -> plex default output
|
||||||
|
|
||||||
|
** acceptance criteria
|
||||||
|
1.
|
||||||
|
-
|
||||||
|
|
||||||
|
** evidence
|
||||||
|
- commit:
|
||||||
|
- tests:
|
||||||
|
- date:
|
||||||
|
|
||||||
|
** notes
|
||||||
|
|
||||||
|
* /
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
<Privileged>false</Privileged>
|
<Privileged>false</Privileged>
|
||||||
<Support>[Unraid Support Thread]</Support>
|
<Support>[Unraid Support Thread]</Support>
|
||||||
<Project>https://github.com/eulaly/youdis</Project>
|
<Project>https://github.com/eulaly/youdis</Project>
|
||||||
<Overview>Discord bot-based wrapper for yt-dlp. Let your friends download videos to your server! Supports playlists, requires a configured Discord bot.</Overview>
|
<Overview>Private yt-dlp worker with a Discord adapter. Submit downloads through Discord while the backend owns yt-dlp execution and job state.</Overview>
|
||||||
<Category>Downloaders: Tools:</Category>
|
<Category>Downloaders: Tools:</Category>
|
||||||
<TemplateURL>https://raw.githubusercontent.com/eulaly/unraid-templates/refs/heads/master/unraid-ca-template.xml</TemplateURL>
|
<TemplateURL>https://raw.githubusercontent.com/eulaly/unraid-templates/refs/heads/master/unraid-ca-template.xml</TemplateURL>
|
||||||
<Icon>https://github.com/eulaly/youdis/blob/c978a2326984efa9670678687ed1a1473478d753/yt_dlp.png</Icon>
|
<Icon>https://github.com/eulaly/youdis/blob/c978a2326984efa9670678687ed1a1473478d753/yt_dlp.png</Icon>
|
||||||
<Config Name="api_token" Target="api_token" Default="" Mode="" Description="Discord bot token" Type="Variable" Display="always" Required="true" Mask="true"/>
|
<Config Name="DISCORD_BOT_TOKEN" Target="DISCORD_BOT_TOKEN" Default="" Mode="" Description="Discord bot token" Type="Variable" Display="always" Required="true" Mask="true"/>
|
||||||
<Config Name="Downloads" Target="/downloads" Default="" Mode="rw" Description="Video download location" Type="Path" Display="always" Required="false"/>
|
<Config Name="Downloads" Target="/downloads" Default="" Mode="rw" Description="Video download location" Type="Path" Display="always" Required="false"/>
|
||||||
<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="false"/>
|
<Config Name="Config" Target="/config" Default="/mnt/user/appdata/youdis/config" Mode="rw" Description="Config location (archive.txt and backend runtime data)" Type="Path" Display="always" Required="false"/>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
"""Launcher shim for the Discord adapter."""
|
||||||
|
|
||||||
from youdis.adapters.discord import main
|
from youdis.adapters.discord import main
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""Discord adapter for interacting with FastAPI backend worker."""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from os import getenv
|
from os import getenv
|
||||||
|
|
||||||
@@ -116,12 +118,6 @@ def ensure_poll_task(ctx: interactions.SlashContext, job_id: str) -> None:
|
|||||||
async def on_startup():
|
async def on_startup():
|
||||||
await get_session()
|
await get_session()
|
||||||
print(f"discord adapter configured for backend {BACKEND_URL}")
|
print(f"discord adapter configured for backend {BACKEND_URL}")
|
||||||
print(f"discord adapter default scope: {DEFAULT_SCOPE}")
|
|
||||||
print(f"discord adapter command cache keys: {sorted(bot._interaction_lookup.keys())}")
|
|
||||||
|
|
||||||
@bot.listen()
|
|
||||||
async def on_ready():
|
|
||||||
print(f"registered commands: {bot.application_commands}")
|
|
||||||
|
|
||||||
@bot.listen()
|
@bot.listen()
|
||||||
async def on_shutdown():
|
async def on_shutdown():
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""FastAPI backend worker managing yt-dlp subprocess jobs and exposing job state."""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from asyncio.subprocess import PIPE, STDOUT
|
from asyncio.subprocess import PIPE, STDOUT
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|||||||
Reference in New Issue
Block a user