@@ -11,14 +11,15 @@ import (
1111
1212func TestBuildArgs (t * testing.T ) {
1313 tests := []struct {
14- name string
15- format model.Format
16- quality model.Quality
17- maxHeight int
18- output string
19- videoURL string
20- ytdlArgs []string
21- expect []string
14+ name string
15+ format model.Format
16+ customFormat feed.CustomFormat
17+ quality model.Quality
18+ maxHeight int
19+ output string
20+ videoURL string
21+ ytdlArgs []string
22+ expect []string
2223 }{
2324 {
2425 name : "Audio unknown quality" ,
@@ -101,13 +102,23 @@ func TestBuildArgs(t *testing.T) {
101102 ytdlArgs : []string {"--write-sub" , "--embed-subs" , "--sub-lang" , "en,en-US,en-GB" },
102103 expect : []string {"--format" , "bestvideo[ext=mp4][vcodec^=avc1]+bestaudio[ext=m4a]/best[ext=mp4][vcodec^=avc1]/best[ext=mp4]/best" , "--write-sub" , "--embed-subs" , "--sub-lang" , "en,en-US,en-GB" , "--output" , "/tmp/2" , "http://url1" },
103104 },
105+ {
106+ name : "Custom format" ,
107+ format : model .FormatCustom ,
108+ customFormat : feed.CustomFormat {YouTubeDLFormat : "bestaudio[ext=m4a]" , Extension : "m4a" },
109+ quality : model .QualityHigh ,
110+ output : "/tmp/2" ,
111+ videoURL : "http://url1" ,
112+ expect : []string {"--audio-format" , "m4a" , "--format" , "bestaudio[ext=m4a]" , "--output" , "/tmp/2" , "http://url1" },
113+ },
104114 }
105115
106116 for _ , tst := range tests {
107117 t .Run (tst .name , func (t * testing.T ) {
108118 result := buildArgs (& feed.Config {
109119 Format : tst .format ,
110120 Quality : tst .quality ,
121+ CustomFormat : tst .customFormat ,
111122 MaxHeight : tst .maxHeight ,
112123 YouTubeDLArgs : tst .ytdlArgs ,
113124 }, & model.Episode {
0 commit comments