mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
render manifest ffmpeg progress like standard download bars
This commit is contained in:
@@ -74,7 +74,6 @@ func TestDeezerBlowfishKeyDerivation(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func TestFileDeezerEncrypted(t *testing.T) {
|
||||
trackID := "3135556"
|
||||
plain := make([]byte, deezerBFChunkSize+777)
|
||||
@@ -221,6 +220,36 @@ func TestParseFFmpegDurationLine(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFFmpegDurationBitrateBPS(t *testing.T) {
|
||||
bps, ok := parseFFmpegDurationBitrateBPS(" Duration: 00:04:52.57, start: 0.000000, bitrate: 975 kb/s")
|
||||
if !ok {
|
||||
t.Fatalf("expected bitrate parse to succeed")
|
||||
}
|
||||
if want := int64(975000); bps != want {
|
||||
t.Fatalf("unexpected bitrate: got=%d want=%d", bps, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFFmpegProgressBitrateBPS(t *testing.T) {
|
||||
bps, ok := parseFFmpegProgressBitrateBPS("bitrate=1706.8kbits/s")
|
||||
if !ok {
|
||||
t.Fatalf("expected progress bitrate parse to succeed")
|
||||
}
|
||||
if want := int64(1706800); bps != want {
|
||||
t.Fatalf("unexpected bitrate: got=%d want=%d", bps, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFFmpegTotalSize(t *testing.T) {
|
||||
size, ok := parseFFmpegTotalSize("total_size=1234567")
|
||||
if !ok {
|
||||
t.Fatalf("expected total_size parse to succeed")
|
||||
}
|
||||
if want := int64(1234567); size != want {
|
||||
t.Fatalf("unexpected total_size: got=%d want=%d", size, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFFmpegOutTime(t *testing.T) {
|
||||
currentMS, ok := parseFFmpegOutTime("out_time=00:01:02.340000")
|
||||
if !ok {
|
||||
@@ -240,6 +269,20 @@ func TestParseClockDurationMSInvalid(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEstimateTotalBytesFromBitrate(t *testing.T) {
|
||||
total := estimateTotalBytesFromBitrate(10000, 1600000)
|
||||
if want := int64(2000000); total != want {
|
||||
t.Fatalf("unexpected estimate from bitrate: got=%d want=%d", total, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEstimateTotalBytesFromProgress(t *testing.T) {
|
||||
total := estimateTotalBytesFromProgress(10000, 2500, 500000)
|
||||
if want := int64(2000000); total != want {
|
||||
t.Fatalf("unexpected estimate from progress: got=%d want=%d", total, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildFFmpegStreamArgsAudioOnly(t *testing.T) {
|
||||
args := buildFFmpegStreamArgs("https://example.com/master.m3u8", "/tmp/out.m4a", false)
|
||||
if !containsArgPair(args, "-map", "0:a:0") {
|
||||
|
||||
Reference in New Issue
Block a user