Skip to content

Commit 0dae52a

Browse files
authored
Automatically update boombox version in livebook (#61)
* Automatically update boombox version in livebook * Use new rtsp_server
1 parent 434bef8 commit 0dae52a

18 files changed

+37
-52
lines changed

examples.livemd

+8-9
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ System.put_env("PATH", "/opt/homebrew/bin:#{System.get_env("PATH")}")
99
# In case of problems installing Nx/EXLA/Bumblebee,
1010
# you can remove them and the Nx backend config below.
1111
# Examples that don't mention them should still work.
12-
Mix.install([
13-
{:boombox, path: __DIR__},
14-
:kino,
15-
:nx,
16-
:exla,
17-
:bumblebee,
18-
:websockex,
19-
:membrane_simple_rtsp_server
20-
])
12+
13+
# MIX_INSTALL_CONFIG_BEGIN
14+
boombox = {:boombox, github: "membraneframework/boombox"}
15+
# This livebook uses boombox from the master branch. If any examples happen to not work, the latest stable version of this livebook
16+
# can be found on https://hexdocs.pm/boombox/examples.html or in the latest github release.
17+
# MIX_INSTALL_CONFIG_END
18+
19+
Mix.install([boombox, :kino, :nx, :exla, :bumblebee, :websockex, :membrane_simple_rtsp_server])
2120

2221
Nx.global_default_backend(EXLA.Backend)
2322
```

mix.exs

+25-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ defmodule Boombox.Mixfile do
1414
deps: deps(),
1515
dialyzer: dialyzer(),
1616
releases: releases(),
17+
aliases: aliases(),
1718

1819
# hex
1920
description: "Boombox",
@@ -63,8 +64,8 @@ defmodule Boombox.Mixfile do
6364
{:membrane_ffmpeg_swresample_plugin, "~> 0.20.0"},
6465
{:membrane_hackney_plugin, "~> 0.11.0"},
6566
{:membrane_ffmpeg_swscale_plugin, "~> 0.16.2"},
67+
{:membrane_simple_rtsp_server, "~> 0.1.4", only: :test},
6668
{:image, "~> 0.54.0"},
67-
{:membrane_simple_rtsp_server, "~> 0.1.3", only: :test},
6869
# {:playwright, "~> 1.49.1-alpha.1", only: :test},
6970
{:playwright,
7071
github: "membraneframework-labs/playwright-elixir",
@@ -102,10 +103,32 @@ defmodule Boombox.Mixfile do
102103
]
103104
end
104105

106+
defp aliases do
107+
[docs: [&generate_docs_examples/1, "docs"]]
108+
end
109+
110+
defp generate_docs_examples(_) do
111+
docs_install_config = "boombox = :boombox"
112+
113+
modified_livebook =
114+
File.read!("examples.livemd")
115+
|> String.replace(
116+
~r/# MIX_INSTALL_CONFIG_BEGIN\n(.|\n)*# MIX_INSTALL_CONFIG_END\n/U,
117+
docs_install_config,
118+
global: false
119+
)
120+
121+
File.write!("#{Mix.Project.build_path()}/examples.livemd", modified_livebook)
122+
end
123+
105124
defp docs do
106125
[
107126
main: "readme",
108-
extras: ["README.md", {"examples.livemd", title: "Examples"}, {"LICENSE", title: "License"}],
127+
extras: [
128+
"README.md",
129+
{"#{Mix.Project.build_path()}/examples.livemd", title: "Examples"},
130+
{"LICENSE", title: "License"}
131+
],
109132
formatters: ["html"],
110133
source_ref: "v#{@version}",
111134
nest_modules_by_prefix: [Boombox]

mix.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"membrane_rtp_vp8_plugin": {:hex, :membrane_rtp_vp8_plugin, "0.9.4", "8eb7e90576e79ccfefe6cf54f982afd8109027b148e17e701e5fbabe485a7b53", [:mix], [{:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_rtp_format, "~> 0.10.0", [hex: :membrane_rtp_format, repo: "hexpm", optional: false]}, {:membrane_vp8_format, "~> 0.4.0 or ~> 0.5.0", [hex: :membrane_vp8_format, repo: "hexpm", optional: false]}], "hexpm", "0fd14c81d3200fc83908f3d72ece3faed207e34c1f59a85b2b7625ec02fb30dd"},
8080
"membrane_rtsp": {:hex, :membrane_rtsp, "0.10.1", "c6cb8549daab155175896f677b049a0f65c3a650e93e603714ec94a836148722", [:mix], [{:bunch, "~> 1.6", [hex: :bunch, repo: "hexpm", optional: false]}, {:ex_sdp, "~> 0.17.0 or ~> 1.0", [hex: :ex_sdp, repo: "hexpm", optional: false]}, {:mockery, "~> 2.3", [hex: :mockery, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.4.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "ff382b38c09150ff43c7ec7a2a62df41b2bab42793633dcc40ef9b6e51ac70b9"},
8181
"membrane_rtsp_plugin": {:hex, :membrane_rtsp_plugin, "0.6.1", "56f11bbd74e47fe7240df44ffc2b17537bc295a4286e08ce3232a905347edfea", [:mix], [{:ex_sdp, "~> 1.1", [hex: :ex_sdp, repo: "hexpm", optional: false]}, {:membrane_aac_plugin, "~> 0.19.0", [hex: :membrane_aac_plugin, repo: "hexpm", optional: false]}, {:membrane_core, "~> 1.1", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_h26x_plugin, "~> 0.10.0", [hex: :membrane_h26x_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_aac_plugin, "~> 0.9.1", [hex: :membrane_rtp_aac_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_h264_plugin, "~> 0.20.0", [hex: :membrane_rtp_h264_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_h265_plugin, "~> 0.5.2", [hex: :membrane_rtp_h265_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_opus_plugin, "~> 0.10.0", [hex: :membrane_rtp_opus_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_plugin, "~> 0.30.0", [hex: :membrane_rtp_plugin, repo: "hexpm", optional: false]}, {:membrane_rtsp, "~> 0.10.0", [hex: :membrane_rtsp, repo: "hexpm", optional: false]}, {:membrane_tcp_plugin, "~> 0.6.0", [hex: :membrane_tcp_plugin, repo: "hexpm", optional: false]}, {:membrane_udp_plugin, "~> 0.14.0", [hex: :membrane_udp_plugin, repo: "hexpm", optional: false]}], "hexpm", "80b6aedd27b4d0e2c99097b5b7d841855ff6fcaf7a11ef85d8e57f7b83a4d8c1"},
82-
"membrane_simple_rtsp_server": {:hex, :membrane_simple_rtsp_server, "0.1.3", "71639ce64f0a7329c9c54620125b4360dd0c285fb9abedce96375b3a1a3216a5", [:mix], [{:ex_sdp, "~> 1.1", [hex: :ex_sdp, repo: "hexpm", optional: false]}, {:membrane_aac_plugin, "~> 0.19.0", [hex: :membrane_aac_plugin, repo: "hexpm", optional: false]}, {:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_file_plugin, "~> 0.17.0", [hex: :membrane_file_plugin, repo: "hexpm", optional: false]}, {:membrane_h26x_plugin, "~> 0.10.0", [hex: :membrane_h26x_plugin, repo: "hexpm", optional: false]}, {:membrane_mp4_plugin, "~> 0.35.0", [hex: :membrane_mp4_plugin, repo: "hexpm", optional: false]}, {:membrane_realtimer_plugin, "~> 0.9.0", [hex: :membrane_realtimer_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_aac_plugin, "~> 0.9.1", [hex: :membrane_rtp_aac_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_h264_plugin, "~> 0.20.0", [hex: :membrane_rtp_h264_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_plugin, "~> 0.30.0", [hex: :membrane_rtp_plugin, repo: "hexpm", optional: false]}, {:membrane_rtsp, "~> 0.10.1", [hex: :membrane_rtsp, repo: "hexpm", optional: false]}, {:membrane_udp_plugin, "~> 0.14.0", [hex: :membrane_udp_plugin, repo: "hexpm", optional: false]}], "hexpm", "6fe538a6100bf1f3a9ccbf383546dd5623958935d3a9e4a3b01219d47be2b8a2"},
82+
"membrane_simple_rtsp_server": {:hex, :membrane_simple_rtsp_server, "0.1.4", "6627dc99456a575548b0726c042683e1a72e3f36ad454df87fda92f0f5262da8", [:mix], [{:ex_sdp, "~> 1.1", [hex: :ex_sdp, repo: "hexpm", optional: false]}, {:membrane_aac_plugin, "~> 0.19.0", [hex: :membrane_aac_plugin, repo: "hexpm", optional: false]}, {:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_file_plugin, "~> 0.17.0", [hex: :membrane_file_plugin, repo: "hexpm", optional: false]}, {:membrane_h26x_plugin, "~> 0.10.0", [hex: :membrane_h26x_plugin, repo: "hexpm", optional: false]}, {:membrane_mp4_plugin, "~> 0.35.0", [hex: :membrane_mp4_plugin, repo: "hexpm", optional: false]}, {:membrane_realtimer_plugin, "~> 0.9.0", [hex: :membrane_realtimer_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_aac_plugin, "~> 0.9.1", [hex: :membrane_rtp_aac_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_h264_plugin, "~> 0.20.0", [hex: :membrane_rtp_h264_plugin, repo: "hexpm", optional: false]}, {:membrane_rtp_plugin, "~> 0.30.0", [hex: :membrane_rtp_plugin, repo: "hexpm", optional: false]}, {:membrane_rtsp, "~> 0.10.1", [hex: :membrane_rtsp, repo: "hexpm", optional: false]}, {:membrane_udp_plugin, "~> 0.14.0", [hex: :membrane_udp_plugin, repo: "hexpm", optional: false]}], "hexpm", "0f447a4d8ef75a78692f879b93229bc00e666f748339cf692c7814da059bc036"},
8383
"membrane_tcp_plugin": {:hex, :membrane_tcp_plugin, "0.6.0", "1f8dba5525504fb2d49070932f24113d1b26c7e5429c700671ed80433ac83f2f", [:mix], [{:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:mockery, "~> 2.3.0", [hex: :mockery, repo: "hexpm", optional: false]}], "hexpm", "820440f5a8181a96cff461ad2d5ed426d47eacfdd7764dd9596dad68ad892d3d"},
8484
"membrane_tee_plugin": {:hex, :membrane_tee_plugin, "0.12.0", "f94989b4080ef4b7937d74c1a14d3379577c7bd4c6d06e5a2bb41c351ad604d4", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "0d61c9ed5e68e5a75d54200e1c6df5739c0bcb52fee0974183ad72446a179887"},
8585
"membrane_telemetry_metrics": {:hex, :membrane_telemetry_metrics, "0.1.1", "57917e72012f9ebe124eab54f29ca74c9d9eb3ae2207f55c95618ee51280eb4f", [:mix], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6.1 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "69392966e6bd51937244758c2b3d835c5ff47d8953d25431a9d37059737afc11"},

test/boombox_test.exs

+3-4
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ defmodule BoomboxTest do
263263
Membrane.SimpleRTSPServer.start_link(@bbb_mp4, port: rtsp_port)
264264

265265
Boombox.run(input: "rtsp://localhost:#{rtsp_port}/", output: output)
266-
Compare.compare(output, "test/fixtures/ref_bun10s_rtsp_aac.mp4")
266+
Compare.compare(output, "test/fixtures/ref_bun10s_aac.mp4")
267267
end
268268

269269
@tag :rtsp_hls
@@ -272,8 +272,7 @@ defmodule BoomboxTest do
272272
Membrane.SimpleRTSPServer.start_link(@bbb_mp4, port: rtsp_port)
273273
manifest_filename = Path.join(tmp, "index.m3u8")
274274
Boombox.run(input: "rtsp://localhost:#{rtsp_port}/", output: manifest_filename)
275-
ref_path = "test/fixtures/ref_bun10s_rtsp_aac_hls"
276-
Compare.compare(tmp, ref_path, format: :hls)
275+
Compare.compare(tmp, "test/fixtures/ref_bun10s_aac_hls", format: :hls)
277276
end
278277

279278
@tag :rtsp_webrtc_mp4
@@ -294,7 +293,7 @@ defmodule BoomboxTest do
294293

295294
Boombox.run(input: {:webrtc, signaling}, output: output)
296295
Task.await(t)
297-
Compare.compare(output, "test/fixtures/ref_bun10s_rtsp_opus_aac.mp4")
296+
Compare.compare(output, "test/fixtures/ref_bun10s_opus_aac.mp4")
298297
end
299298

300299
@tag :mp4_elixir_rotate_mp4

test/fixtures/ref_bun10s_rtsp_aac.mp4

-1.19 MB
Binary file not shown.

test/fixtures/ref_bun10s_rtsp_aac_hls/g3cFdmlkZW8.m3u8

-13
This file was deleted.

test/fixtures/ref_bun10s_rtsp_aac_hls/index.m3u8

-5
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/fixtures/ref_bun10s_rtsp_aac_hls_sc/g3cFdmlkZW8.m3u8

-13
This file was deleted.

test/fixtures/ref_bun10s_rtsp_aac_hls_sc/index.m3u8

-5
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-1.2 MB
Binary file not shown.

0 commit comments

Comments
 (0)