Allow preloads from ARR movie and TV roots

This commit is contained in:
Ziad Arafat committed 2026-11-28 18:02:06 -07:00
1 parent 6add98d9a2
commit 80b3beca5f
3 files changed
+24 -9

No files matched your search

+2
View File
@@ -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.
+8 -1
View File
@@ -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 {
+14 -8
View File
@@ -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)