mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
improve ffmpeg manifest progress rendering
This commit is contained in:
@@ -231,3 +231,32 @@ func TestStreamManifestWithFFmpegFailureRemovesPartialFile(t *testing.T) {
|
||||
t.Fatalf("expected no partial file after ffmpeg failure, stat err=%v", statErr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFFmpegDurationLine(t *testing.T) {
|
||||
totalMS, ok := parseFFmpegDurationLine(" Duration: 00:04:52.57, start: 0.000000, bitrate: 975 kb/s")
|
||||
if !ok {
|
||||
t.Fatalf("expected duration parse to succeed")
|
||||
}
|
||||
if want := int64(292570); totalMS != want {
|
||||
t.Fatalf("unexpected duration ms: got=%d want=%d", totalMS, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFFmpegOutTime(t *testing.T) {
|
||||
currentMS, ok := parseFFmpegOutTime("out_time=00:01:02.340000")
|
||||
if !ok {
|
||||
t.Fatalf("expected out_time parse to succeed")
|
||||
}
|
||||
if want := int64(62340); currentMS != want {
|
||||
t.Fatalf("unexpected out_time ms: got=%d want=%d", currentMS, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseClockDurationMSInvalid(t *testing.T) {
|
||||
if _, ok := parseClockDurationMS("bad"); ok {
|
||||
t.Fatalf("expected invalid duration to fail")
|
||||
}
|
||||
if _, ok := parseClockDurationMS("00:12"); ok {
|
||||
t.Fatalf("expected short duration to fail")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user