Skip to content

Commit

Permalink
Trim url in input.ffmpeg. Fixes: #3424
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Sep 25, 2023
1 parent 23f4074 commit a2d9b7a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/io/ffmpeg_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class input ?(name = "input.ffmpeg") ~autostart ~self_sync ~poll_delay ~debug
method private start = self#connect
method private stop = self#disconnect
val mutable url = url
method url = url ()
method url = String.trim (url ())
method set_url u = url <- u
method buffer_length = Frame.seconds_of_audio (Generator.length self#buffer)

Expand Down
43 changes: 43 additions & 0 deletions tests/streams/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,49 @@
(:run_test ../run_test.exe))
(action (run %{run_test} ffmpeg-errors.liq liquidsoap %{test_liq} ffmpeg-errors.liq)))

(rule
(alias tree-sitter-parse)
(deps
ffmpeg-trim.liq
../../src/tooling/test-tree-sitter
)
(action
(chdir ../../src/tooling/test-tree-sitter/tree-sitter-liquidsoap
(ignore-stdout
(run npm exec tree-sitter -- parse ../../../../tests/streams/ffmpeg-trim.liq)))))

(rule
(alias fmt)
(deps ffmpeg-trim.liq ../../src/tooling/test-prettier ../../src/tooling/prettier-plugin-liquidsoap/dist/liquidsoap.js)
(action
(progn
(with-stdout-to ffmpeg-trim.liq.prettier
(chdir ../../src/tooling/test-prettier
(run pnpm prettier --config ./config.json ../../../tests/streams/ffmpeg-trim.liq)))
(diff ffmpeg-trim.liq ffmpeg-trim.liq.prettier))))

(rule
(alias citest)
(package liquidsoap)
(deps
ffmpeg-trim.liq
./file1.mp3
./file2.mp3
./file3.mp3
./jingle1.mp3
./jingle2.mp3
./jingle3.mp3
./file1.png
./file2.png
./jingles
./playlist
./huge_playlist
../../src/bin/liquidsoap.exe
(package liquidsoap)
(:test_liq ../test.liq)
(:run_test ../run_test.exe))
(action (run %{run_test} ffmpeg-trim.liq liquidsoap %{test_liq} ffmpeg-trim.liq)))

(rule
(alias tree-sitter-parse)
(deps
Expand Down
13 changes: 13 additions & 0 deletions tests/streams/ffmpeg-trim.liq
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def f() =
def on_error(_) =
test.fail()
end

# Test string.trim on url input.
output.dummy(
input.ffmpeg(on_connect=test.pass, on_error=on_error, " ./file1.mp3\n"),
fallible=true
)
end

test.check(f)

0 comments on commit a2d9b7a

Please sign in to comment.