| 1 | amends "../../config/Service.pkl" |
| 2 | |
| 3 | import "../../config/site.pkl" as site |
| 4 | |
| 5 | local passive = site.preview || site.mediaReadOnly |
| 6 | |
| 7 | meta { name = "YTDL" } |
| 8 | |
| 9 | requiredSecrets { |
| 10 | "smtp_host" |
| 11 | "smtp_user" |
| 12 | "smtp_pass" |
| 13 | } |
| 14 | |
| 15 | containers { |
| 16 | ["thumbnails"] { |
| 17 | build = "upscaler" |
| 18 | cpu = if (passive) 200 else 1000 |
| 19 | memory = if (passive) 512 else 2048 |
| 20 | entrypoint = if (passive) "/bin/sh" else null |
| 21 | args = if (passive) new { |
| 22 | "-c" |
| 23 | "python3 /app/upscale.py --check && exec python3 -m http.server 8899 --bind 0.0.0.0 --directory /tmp" |
| 24 | } else new {} |
| 25 | http = if (passive) new { containerPort = 8899 } else null |
| 26 | volumes { |
| 27 | ["/data"] {} |
| 28 | ["/media"] { src = site.mediaRoot; readOnly = site.mediaReadOnly } |
| 29 | } |
| 30 | env { |
| 31 | ["STATE_DIR"] = "/data" |
| 32 | ["INDEP_DIR"] = "/media/\(site.jellyfinFolders["Independent"])" |
| 33 | ["SR_THREADS"] = "4" |
| 34 | } |
| 35 | } |
| 36 | ["archiver"] { |
| 37 | image = "ghcr.io/jmbannon/ytdl-sub@sha256:29f27bc2b405b303d9da07f11f53ba39f7575efb94f98fe4c2c65d40a3e83bdd" |
| 38 | entrypoint = "/bin/sh" |
| 39 | args { |
| 40 | "-c" |
| 41 | if (passive) |
| 42 | "ytdl-sub --config /config-yt/config.yaml inspect --level 1 /yt-config/subscriptions.yaml >/dev/null && exec python3 -m http.server 8899 --bind 0.0.0.0 --directory /tmp" |
| 43 | else |
| 44 | "sh /config-yt/archive-loop.sh" |
| 45 | } |
| 46 | cpu = 200 |
| 47 | memory = if (passive) 256 else 512 |
| 48 | |
| 49 | http = if (passive) new { |
| 50 | containerPort = 8899 |
| 51 | } else null |
| 52 | |
| 53 | volumes { |
| 54 | ["/config"] {} |
| 55 | ["/config-yt"] { config = "config" } |
| 56 | ["/yt-config"] { |
| 57 | src = "\(site.cloverRoot)/Documents/Config/Youtube Downloader" |
| 58 | readOnly = true |
| 59 | } |
| 60 | ["/media"] {} |
| 61 | when (!passive) { |
| 62 | ["/media/jellyfin/Independent"] { |
| 63 | src = "\(site.mediaRoot)/\(site.jellyfinFolders["Independent"])" |
| 64 | readOnly = site.mediaReadOnly |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | env { |
| 70 | ["HOME"] = "/config" |
| 71 | } |
| 72 | } |
| 73 | } |