lainchan / λ

(untitled)

hash table · 2024-12-25 12:04
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?
Lain Iwakura · 2025-08-03 18:40
Phoenix made web dev actually fun. If Elixir ever got the same desktop focus it does with web people, i'd probably switch to it for most everything else.