From 81ad4aa209823cad7394e4789800b4e264a479ec Mon Sep 17 00:00:00 2001 From: Martyn Ranyard Date: Sat, 28 Dec 2024 14:54:25 +0000 Subject: [PATCH] ytdl-sub Signed-off-by: Martyn Ranyard --- apps-kustomized/ytdl-sub/configmap.yaml | 74 ++++++++++++++++++++++++ apps-kustomized/ytdl-sub/deploy.yaml | 77 +++++++++++++++++++++++++ apps-kustomized/ytdl-sub/pvc-smb.yaml | 11 ++++ apps-kustomized/ytdl-sub/svc.yaml | 15 +++++ 4 files changed, 177 insertions(+) create mode 100644 apps-kustomized/ytdl-sub/configmap.yaml create mode 100644 apps-kustomized/ytdl-sub/deploy.yaml create mode 100644 apps-kustomized/ytdl-sub/pvc-smb.yaml create mode 100644 apps-kustomized/ytdl-sub/svc.yaml diff --git a/apps-kustomized/ytdl-sub/configmap.yaml b/apps-kustomized/ytdl-sub/configmap.yaml new file mode 100644 index 0000000..082e123 --- /dev/null +++ b/apps-kustomized/ytdl-sub/configmap.yaml @@ -0,0 +1,74 @@ +apiVersion: v1 +data: + config.yaml: | + configuration: + working_directory: ".ytdl-sub-working-directory" + presets: + TV Shows: + preset: + - "Jellyfin TV Show by Date" + - "Max 1080p" + embed_thumbnail: True + throttle_protection: + sleep_per_download_s: + min: 2.2 + max: 10.8 + sleep_per_subscription_s: + min: 9.0 + max: 14.1 + max_downloads_per_subscription: + min: 10 + max: 36 + ytdl_options: + source_address: '0.0.0.0' + cookiefile: /config/cookies.txt + date_range: + after: "now-1year" + chapters: + # Embedded Chapter Fields + embed_chapters: True + allow_chapters_from_comments: False + remove_chapters_regex: + - "Intro" + - "Outro" + # Sponsorblock Fields + sponsorblock_categories: + - "outro" + - "selfpromo" + - "preview" + - "interaction" + - "sponsor" + - "music_offtopic" + - "intro" + remove_sponsorblock_categories: "sponsor" + TV Shows Fortnight: + preset: + - "TV Shows" + date_range: + after: "now-14days" + + subscriptions.yaml: | + __preset__: + overrides: + tv_show_directory: "/youtube/tv_shows" + music_directory: "/youtube/tv_shows" + + "TV Shows": + = Documentaries: + "Technogy Connections": "https://www.youtube.com/@TechnologyConnections" + + "TV Shows Fortnight": + = Music: + "Rick Beato": "https://www.youtube.com/@RickBeato" + run_cron: | + #!/bin/bash + PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + echo 'Cron started, running ytdl-sub...' + cd /config/ + ytdl-sub --config=config.yaml sub subscriptions.yaml + abc: | + 0 */6 * * * /config/ytdl-sub-configs/run_cron +kind: ConfigMap +metadata: + creationTimestamp: null + name: ytdl-sub-config diff --git a/apps-kustomized/ytdl-sub/deploy.yaml b/apps-kustomized/ytdl-sub/deploy.yaml new file mode 100644 index 0000000..84dbcb8 --- /dev/null +++ b/apps-kustomized/ytdl-sub/deploy.yaml @@ -0,0 +1,77 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: ytdl-sub + name: ytdl-sub +spec: + selector: + matchLabels: + app: ytdl-sub + strategy: + type: Recreate + template: + metadata: + labels: + app: ytdl-sub + spec: + containers: + - env: + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: TZ + value: "Europe/Berlin" + - name: DOCKER_MODS + value: "linuxserver/mods:universal-cron" + image: ghcr.io/jmbannon/ytdl-sub:ubuntu-2024.12.27 + imagePullPolicy: Always + name: ytdl-sub + ports: + - containerPort: 8443 + name: http + protocol: TCP + volumeMounts: + - mountPath: /config + name: config + - mountPath: /youtube + name: youtube + initContainers: + - image: busybox + name: copy-config + command: + - /bin/sh + - -c + - "cp /config_src/config.yaml /config/; + cp /config_src/subscriptions.yaml /config/; + cp /secret/cookies.txt /config/; + mkdir /config/ytdl-sub-configs ; + cp /config_src/run_cron /config/ytdl-sub-configs/ ; + chmod +x /config/ytdl-sub-configs/run_cron ; + mkdir /config/crontabs ; + cp /config_src/abc /config/crontabs/ ; + chown -R 1000:1000 /config" + volumeMounts: + - mountPath: /config_src + name: config-src + - mountPath: /config + name: config + - mountPath: /secret + name: cookie + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + terminationGracePeriodSeconds: 30 + volumes: + - name: config + emptyDir: {} + - name: cookie + secret: + secretName: cookie-secret + - name: config-src + configMap: + name: ytdl-sub-config + - name: youtube + persistentVolumeClaim: + claimName: smb-youtube diff --git a/apps-kustomized/ytdl-sub/pvc-smb.yaml b/apps-kustomized/ytdl-sub/pvc-smb.yaml new file mode 100644 index 0000000..ac8f054 --- /dev/null +++ b/apps-kustomized/ytdl-sub/pvc-smb.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: smb-youtube +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + storageClassName: smb-youtube diff --git a/apps-kustomized/ytdl-sub/svc.yaml b/apps-kustomized/ytdl-sub/svc.yaml new file mode 100644 index 0000000..6e560a9 --- /dev/null +++ b/apps-kustomized/ytdl-sub/svc.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + external-dns.alpha.kubernetes.io/hostname: ytdl-sub.martyn.berlin + labels: + app: ytdl-sub + name: ytdl-sub +spec: + ports: + - targetPort: 8989 + port: 80 + selector: + app: ytdl-sub + type: LoadBalancer