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
|
|
@ -296,6 +296,34 @@ func runInit(apiURLOverride string) error {
|
|||
}
|
||||
}
|
||||
|
||||
// ── Plex / Jellyfin / Emby refresh hook ────────────────────────
|
||||
// Offer to wire library refreshes if a media server was detected and
|
||||
// none are configured yet. Skipping here is fine — the user can run
|
||||
// `unarr mediaserver setup` later.
|
||||
if len(detected.Servers) > 0 && len(cfg.MediaServers) == 0 {
|
||||
fmt.Println()
|
||||
var configureMS bool
|
||||
err = huh.NewForm(
|
||||
huh.NewGroup(
|
||||
huh.NewConfirm().
|
||||
Title(fmt.Sprintf("Auto-refresh %s on every download?", detected.Servers[0].Name)).
|
||||
Description("New downloads appear on Roku/Apple TV/etc. within seconds, instead of waiting for the next periodic library scan").
|
||||
Affirmative("Yes, configure").
|
||||
Negative("Skip (do it later with 'unarr mediaserver setup')").
|
||||
Value(&configureMS),
|
||||
),
|
||||
).Run()
|
||||
if err == nil && configureMS {
|
||||
fmt.Println()
|
||||
if err := runMediaserverSetup(); err != nil {
|
||||
color.New(color.FgYellow).Printf(" Media server setup failed: %s\n", err)
|
||||
} else {
|
||||
// runMediaserverSetup already saved + updated appCfg.
|
||||
cfg = appCfg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Debrid auto-detection from *arr ─────────────────────────────
|
||||
|
||||
if resp.User.IsPro {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue