feat(mediaserver): Plex/Jellyfin/Emby auto-refresh + .strm instant mode
Sprint 1 — Auto-refresh after download:
- New [[mediaserver]] TOML section with kind/url/token/sections
- mediaserver.Refresh() fans out to Plex (partial via section ID auto-mapping
from file path prefix) and Jellyfin/Emby (full library scan)
- Manager.OnFinalized callback wired in daemon to trigger refresh after
organize() completes — keeps engine package free of mediaserver dep
- New unarr mediaserver {setup,list,remove,test} commands
- unarr init wizard offers to configure refresh when a server is detected
Sprint 2 — .strm instant mode (cloud + agent):
- Mode strm-to-library handled in daemon dispatch: writes a one-line .strm
file pointing to the cloud-resolved debrid HTTPS URL, then triggers refresh
- engine.WriteStrm + StrmDestForTask mirror organize()'s naming so Plex/Jellyfin
see the expected folder structure (Movies/Title (Year)/, TV Shows/Show/Season XX/)
- Atomic write (temp + rename) so partial files never get indexed
- Reports completed/failed status to the cloud via existing agent client
This commit is contained in:
parent
6955b6144b
commit
6adf1e2c4c
13 changed files with 1065 additions and 16 deletions
|
|
@ -79,7 +79,7 @@ func TestPlexTokenFromPrefs(t *testing.T) {
|
|||
<Preferences PlexOnlineToken="my-secret-token" OldestPreviousVersion="1.0"/>`
|
||||
os.WriteFile(prefsPath, []byte(xml), 0o644)
|
||||
|
||||
token := plexTokenFromPrefs(prefsPath)
|
||||
token := PlexTokenFromPrefs(prefsPath)
|
||||
if token != "my-secret-token" {
|
||||
t.Errorf("token = %q, want my-secret-token", token)
|
||||
}
|
||||
|
|
@ -91,14 +91,14 @@ func TestPlexTokenFromPrefs(t *testing.T) {
|
|||
xml := `<?xml version="1.0"?><Preferences/>`
|
||||
os.WriteFile(prefsPath, []byte(xml), 0o644)
|
||||
|
||||
token := plexTokenFromPrefs(prefsPath)
|
||||
token := PlexTokenFromPrefs(prefsPath)
|
||||
if token != "" {
|
||||
t.Errorf("token = %q, want empty", token)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("file not found", func(t *testing.T) {
|
||||
token := plexTokenFromPrefs("/nonexistent/Preferences.xml")
|
||||
token := PlexTokenFromPrefs("/nonexistent/Preferences.xml")
|
||||
if token != "" {
|
||||
t.Errorf("token = %q, want empty", token)
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ func TestPlexTokenFromPrefs(t *testing.T) {
|
|||
prefsPath := filepath.Join(dir, "Preferences.xml")
|
||||
os.WriteFile(prefsPath, []byte("not xml at all"), 0o644)
|
||||
|
||||
token := plexTokenFromPrefs(prefsPath)
|
||||
token := PlexTokenFromPrefs(prefsPath)
|
||||
if token != "" {
|
||||
t.Errorf("token = %q, want empty", token)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue