From 80b3beca5f0610ef3484281dc7fdae2b8c5c4525 Mon Sep 17 00:00:00 2001 From: Ziad Arafat Date: Sat, 28 Nov 2026 18:02:06 -0700 Subject: [PATCH] Allow preloads from ARR movie and TV roots --- README.md | 2 ++ internal/service/service.go | 9 ++++++++- internal/service/service_test.go | 22 ++++++++++++++-------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e9bea72..4e177bb 100644 --- a/README.md +++ b/README.md @@ -74,5 +74,7 @@ Clients in use: the dogebot Discord cog `watch` (`d!watch`, repo github RustyRap `clients/media-preload-client`). Rootless containers on yveltal must use `http://host.containers.internal:8125`, because 10.0.0.38 inside a rootless (pasta) network is the container itself. After an API change, regenerate that client. +The on-demand service accepts both legacy roots and `/arrmedia/Movies`, `/arrmedia/TV`, and `/arrmedia/TV-Spanish`. Dogebot acquisition completion reports an ARR import. Use `d!watch` after Jellyfin indexes the files to queue a VPS preload. + The nightly preload (`edge-preload.timer` on ziadpve, `~/handoffs/homelab/vps-edge/preload.py`) is separate and still works on its own. It could later file its picks through this API instead. diff --git a/internal/service/service.go b/internal/service/service.go index 918e35f..3a37495 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -15,7 +15,14 @@ import ( ) // CachedPrefixes are the folders the VPS cache serves (paths as Jellyfin and webdav see them). -var CachedPrefixes = []string{"/media/Videos/Movies/", "/media2/Videos/tvshows/", "/media2/Videos/mxtvshows/"} +var CachedPrefixes = []string{ + "/media/Videos/Movies/", + "/media2/Videos/tvshows/", + "/media2/Videos/mxtvshows/", + "/arrmedia/Movies/", + "/arrmedia/TV/", + "/arrmedia/TV-Spanish/", +} // Cacheable reports whether a path is inside the cached folders. func Cacheable(path string) bool { diff --git a/internal/service/service_test.go b/internal/service/service_test.go index d190e1d..500a6ff 100644 --- a/internal/service/service_test.go +++ b/internal/service/service_test.go @@ -4,14 +4,20 @@ import "testing" func TestCacheable(t *testing.T) { for p, want := range map[string]bool{ - "/media/Videos/Movies/Movies/Alien (1979)/a.mkv": true, - "/media/Videos/Movies/Arabic Shows/x/e1.mkv": true, - "/media2/Videos/tvshows/Dark Matter/S01E01.mkv": true, - "/media2/Videos/mxtvshows/x.mkv": true, - "/media2/Videos/movies/b.mkv": false, - "/media/Music/MyLibrary/song.flac": false, - "/media2/Videos/tvshows/../../../etc/passwd": false, - "/media2/Videos/tvshowsX/a.mkv": false, + "/media/Videos/Movies/Movies/Alien (1979)/a.mkv": true, + "/media/Videos/Movies/Arabic Shows/x/e1.mkv": true, + "/media2/Videos/tvshows/Dark Matter/S01E01.mkv": true, + "/media2/Videos/mxtvshows/x.mkv": true, + "/media2/Videos/movies/b.mkv": false, + "/arrmedia/Movies/Example (2026)/a.mkv": true, + "/arrmedia/TV/Example/Season 01/a.mkv": true, + "/arrmedia/TV-Spanish/Example/a.mkv": true, + "/arrmedia/TVExtras/a.mkv": false, + "/arrmedia/Music/Example/a.flac": false, + "/arrmedia/TV/../Music/a.flac": false, + "/media/Music/MyLibrary/song.flac": false, + "/media2/Videos/tvshows/../../../etc/passwd": false, + "/media2/Videos/tvshowsX/a.mkv": false, } { if got := Cacheable(p); got != want { t.Errorf("Cacheable(%q) = %v, want %v", p, got, want)