Skip to content

Commit

Permalink
fix: add subcleaner back
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Buhl <[email protected]>
  • Loading branch information
onedr0p committed Dec 25, 2024
1 parent 492f0bb commit d9fe0d7
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 4 deletions.
31 changes: 27 additions & 4 deletions kubernetes/main/apps/default/bazarr/app/helmrelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,30 @@ spec:
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
securityContext:
securityContext: &securityContext
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: { drop: ["ALL"] }
resources:
requests:
cpu: 10m
limits:
memory: 4Gi
memory: 1Gi
subcleaner:
image:
repository: registry.k8s.io/git-sync/git-sync
tag: v4.4.0@sha256:0330739a707a2969d617e859f096659ab6d149212658ac0ad7e550b59482ebf0
env:
GITSYNC_REPO: https://github.com/KBlixt/subcleaner
GITSYNC_REF: master
GITSYNC_PERIOD: 24h
GITSYNC_ROOT: /subcleaner
resources:
requests:
cpu: 10m
limits:
memory: 128Mi
securityContext: *securityContext
defaultPodOptions:
securityContext:
runAsNonRoot: true
Expand All @@ -80,14 +95,14 @@ spec:
app:
className: internal
hosts:
- host: bazarr.devbu.io
- host: "{{ .Release.Name }}.devbu.io"
paths:
- path: /
service:
identifier: app
port: http
persistence:
add-ons:
subcleaner:
type: emptyDir
cache:
type: emptyDir
Expand All @@ -105,5 +120,13 @@ spec:
path: /mnt/eros/Media
globalMounts:
- path: /media
scripts:
type: configMap
name: bazarr-scripts
defaultMode: 0775
globalMounts:
- path: /scripts/subcleaner.sh
subPath: subcleaner.sh
readOnly: true
tmp:
type: emptyDir
8 changes: 8 additions & 0 deletions kubernetes/main/apps/default/bazarr/app/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ resources:
- ./helmrelease.yaml
- ../../../../../shared/templates/gatus/guarded
- ../../../../../shared/templates/volsync
configMapGenerator:
- name: bazarr-scripts
files:
- subcleaner.sh=./resources/subcleaner.sh
generatorOptions:
disableNameSuffixHash: true
annotations:
kustomize.toolkit.fluxcd.io/substitute: disabled
18 changes: 18 additions & 0 deletions kubernetes/main/apps/default/bazarr/app/resources/subcleaner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

printf "Cleaning subtitles for '%s' ...\n" "$1"
python3 /subcleaner/subcleaner/subcleaner.py "$1" -s

case $1 in
*movies*) section="1";;
*shows*) section="2";;
esac

if [[ -n "$section" ]]; then
printf "Refreshing Plex section '%s' for '%s' ...\n" "$section" "$(dirname "$1")"
/usr/bin/curl -I -X GET -G \
--data-urlencode "path=$(dirname "$1")" \
--data-urlencode "X-Plex-Token=${PLEX_TOKEN}" \
--no-progress-meter \
"http://plex.default.svc.cluster.local:32400/library/sections/${section}/refresh"
fi

0 comments on commit d9fe0d7

Please sign in to comment.