Add per-disk profiles with video transcoding support
Each disk stores .jukebox/profile.json with copy parameters (dest
folder, overwrite mode, file select, reserve space, auto-copy) and
optional transcoding limits for the target player (codec, resolution,
bitrate, FPS, audio channels, output format).
On copy, video files are probed with ffprobe; if they exceed the
profile limits they are transcoded via ffmpeg (-threads 0 for full
CPU usage), otherwise copied as-is. Scale filter never upscales.
New: internal/disk/profile.go, internal/transcoder/{detect,transcoder}.go
API: GET/PUT /api/disks/profile?mount_path=
UI: disk profile panel in dashboard for known disks
Dockerfile: adds ffmpeg to the runtime image
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,11 +18,12 @@ const (
|
||||
)
|
||||
|
||||
type DiskInfo struct {
|
||||
State DiskState `json:"state"`
|
||||
DiskID string `json:"disk_id"`
|
||||
TotalBytes int64 `json:"total_bytes"`
|
||||
FreeBytes int64 `json:"free_bytes"`
|
||||
MountPath string `json:"mount_path"`
|
||||
State DiskState `json:"state"`
|
||||
DiskID string `json:"disk_id"`
|
||||
TotalBytes int64 `json:"total_bytes"`
|
||||
FreeBytes int64 `json:"free_bytes"`
|
||||
MountPath string `json:"mount_path"`
|
||||
Profile *DiskProfile `json:"profile,omitempty"`
|
||||
}
|
||||
|
||||
const MarkerDir = ".jukebox"
|
||||
@@ -55,6 +56,9 @@ func Probe(mountPath string) (DiskInfo, error) {
|
||||
|
||||
info.DiskID = strings.TrimSpace(string(data))
|
||||
info.State = DiskKnown
|
||||
if p, err := LoadProfile(mountPath); err == nil {
|
||||
info.Profile = p
|
||||
}
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -81,6 +85,7 @@ func InitDisk(mountPath string) (string, error) {
|
||||
if err := os.WriteFile(idPath, []byte(id), 0o644); err != nil {
|
||||
return "", err
|
||||
}
|
||||
_ = SaveProfile(mountPath, DefaultProfile())
|
||||
return id, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user