I created a small script to play all (20) .mp3 songs from the /music/ with Elixir. I think I'm in love with this syntax, and I love the pattern matching thing, which I didn't used in this stupid script.
elixir
#!/usr/bin/env elixir
Mix.install([
{:floki, "~> 0.37.0"},
{:req, "~> 0.5.5"}
])
songs =
Req.get!("https://lainchan.org/music/")
|> Map.get(:body)
|> Floki.parse()
|> Floki.find("a")
|> Floki.attribute("href")
|> Enum.filter(&String.contains?(&1, "/music/src"))
|> Enum.filter(&String.contains?(&1, ".mp3"))
|> Enum.uniq()
|> Enum.map(&("https://lainchan.org" <> &1))
songs
|> length()
|> dbg()
System.cmd("alacritty", ["-e", "mpv", "--no-video", "--shuffle", "--log-file=uomagaa.log" | songs])
|> dbg()
What do you lainons think about it?