Add video as a media kind in photos: streaming upload with per-kind limits, ffprobe metadata, poster frame reusing the image variant pipeline, and a playback object (remux when web-compatible, else h264/yuv420p/aac transcode). Video jobs run on a separate pool with a long lease. Frontend gains a video viewer, grid badge/duration and video upload.
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package video
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"galo/internal/config"
|
|
)
|
|
|
|
func TestDetectUnavailable(t *testing.T) {
|
|
tc := Detect(config.Video{
|
|
FFmpegPath: "definitely-missing-ffmpeg-xyz",
|
|
FFprobePath: "definitely-missing-ffprobe-xyz",
|
|
})
|
|
if tc.Available() {
|
|
t.Fatalf("expected unavailable toolchain, got %+v", tc)
|
|
}
|
|
}
|
|
|
|
func TestDetectAvailable(t *testing.T) {
|
|
self, err := os.Executable()
|
|
if err != nil {
|
|
t.Fatalf("executable: %v", err)
|
|
}
|
|
tc := Detect(config.Video{FFmpegPath: self, FFprobePath: self, TempDir: "/tmp"})
|
|
if !tc.Available() {
|
|
t.Fatalf("expected available toolchain, got %+v", tc)
|
|
}
|
|
if tc.FFmpegPath() != self || tc.FFprobePath() != self {
|
|
t.Fatalf("paths = %q %q", tc.FFmpegPath(), tc.FFprobePath())
|
|
}
|
|
if tc.TempDir() != "/tmp" {
|
|
t.Fatalf("temp dir = %q", tc.TempDir())
|
|
}
|
|
}
|
|
|
|
func TestNilToolchain(t *testing.T) {
|
|
var tc *Toolchain
|
|
if tc.Available() {
|
|
t.Fatal("nil toolchain must be unavailable")
|
|
}
|
|
if tc.FFmpegPath() != "" || tc.FFprobePath() != "" || tc.TempDir() != "" {
|
|
t.Fatal("nil toolchain accessors must be empty")
|
|
}
|
|
}
|