Remote Sources
远程媒体库
LoFiBox 的远程能力有明确的 source / remote 边界: source 管配置、认证、能力与生命周期;remote 管浏览、搜索、最近项目、收藏和流解析。
支持的源类型
| 类别 | 源类型 | 用途 |
|---|---|---|
| 媒体服务器 | Jellyfin、Emby、OpenSubsonic / Navidrome、Subsonic | 目录、搜索、最近播放、收藏、stream resolve。 |
| 直接流 | Direct URL、Internet Radio、Playlist Manifest | 直播电台、单 URL、M3U/PLS 等清单。 |
| 流媒体协议 | HLS、DASH | 自适应流、直播、远程音频切片。 |
| 文件共享 | SMB、NFS、WebDAV、FTP、SFTP | 远程文件树作为媒体源。 |
| 局域网发现 | DLNA / UPnP | 家庭网络媒体设备浏览与播放。 |
配置 source profile
profile 保存非秘密配置,例如 kind、id、name、base_url、username、credential_ref、TLS 策略。 secret 必须进入 credentials store。
printf '%s' "$JELLYFIN_PASSWORD" | lofibox credentials set jellyfin-home --password-stdin
lofibox source add jellyfin \
--id jellyfin-home \
--name "Home Jellyfin" \
--base-url https://media.local:8096 \
--username vicliu \
--credential-ref jellyfin-home \
--verify-peer true \
--allow-self-signed false
检查连接与能力
添加 profile 后先 probe。auth-status 与 capabilities 适合脚本判断一个远程源是否可用,以及它支持哪些目录和 stream 能力。
lofibox source list --json
lofibox source show jellyfin-home --json
lofibox source probe jellyfin-home
lofibox source auth-status jellyfin-home --json
lofibox source capabilities jellyfin-home --json
浏览与搜索 remote
remote 命令只在 profile 可连接之后使用。浏览结果和本地库最终都被转换为统一 MediaItem,方便 GUI/TUI/CLI 用同一种方式播放。
lofibox remote browse jellyfin-home
lofibox remote browse jellyfin-home /artists
lofibox remote browse jellyfin-home /albums
lofibox remote browse jellyfin-home /playlists
lofibox remote browse jellyfin-home /stations
lofibox remote recent jellyfin-home
lofibox remote favorites jellyfin-home
lofibox remote search jellyfin-home "outkast"
解析流并播放
resolve / stream-info 返回 redacted URL、codec、bitrate、seekable、live、buffer state 等诊断信息。 播放仍然通过 playback session,不由 remote 命令自己绕过 runtime。
lofibox remote resolve jellyfin-home item-123 --json
lofibox remote stream-info jellyfin-home item-123 --json
lofibox play --source jellyfin-home --item item-123
lofibox now --fields playback.status,playback.title,remote.connection_status --json
安全约束
- remote profile 中保存 credential_ref,不保存明文 password/token。
- CLI 和 TUI 只显示 redacted URL。
- 认证失败返回明确 exit code 和 structured error,便于自动化修复。
- 远程 stream 进入统一 playback pipeline,因此 EQ、lyrics projection、runtime diagnostics 与本地播放保持一致。