summaryrefslogtreecommitdiff
path: root/lib/lsg_irc
diff options
context:
space:
mode:
authorhref <href@random.sh>2021-09-01 11:54:11 +0200
committerhref <href@random.sh>2021-09-01 11:54:11 +0200
commite534c13960cd0e92dac8909103924e891e43700a (patch)
treeaff5562d03841d849caa70b3441298277f27e055 /lib/lsg_irc
parentlastfm: fix (diff)
broadcast,np: remove as it is now totally useless
Diffstat (limited to 'lib/lsg_irc')
-rw-r--r--lib/lsg_irc/broadcast_handler.ex45
-rw-r--r--lib/lsg_irc/np_handler.ex40
2 files changed, 0 insertions, 85 deletions
diff --git a/lib/lsg_irc/broadcast_handler.ex b/lib/lsg_irc/broadcast_handler.ex
deleted file mode 100644
index 19c41ea..0000000
--- a/lib/lsg_irc/broadcast_handler.ex
+++ /dev/null
@@ -1,45 +0,0 @@
-defmodule LSG.IRC.BroadcastHandler do
- def irc_doc, do: ""
-
- def start_link(client) do
- GenServer.start_link(__MODULE__, [client])
- end
-
- def init([client]) do
- ExIRC.Client.add_handler client, self
- {:ok, _} = Registry.register(LSG.BroadcastRegistry, "icecast", [])
- {:ok, {client, ["#lsg"], false}}
- end
-
- def handle_info({:icecast, stats = %{live: true}}, s = {client, channels, true}) do
- for c <- channels do
- ExIRC.Client.msg(client, :privmsg, c, "en direct: "<>format_genre(stats.genre) <> stats.np)
- end
- {:noreply, s}
- end
-
- def handle_info({:icecast, stats = %{live: true}}, s = {client, channels, false}) do
- for c <- channels do
- ExIRC.Client.msg(client, :privmsg, c, "115ANS EN DIREK! " <> format_genre(stats.genre) <> stats.np)
- end
- {:noreply, {client, channels, true}}
- end
-
- def handle_info({:icecast, stats = %{live: false}}, s = {client, channels, true}) do
- for c <- channels do
- ExIRC.Client.msg(client, :privmsg, c, "Le direct c'est fini, retour aux Smashing Pumpkins...")
- ExIRC.Client.msg(client, :privmsg, c, "np: " <> stats.np)
- end
- {:noreply, {client, channels, false}}
- end
-
- # Catch-all for messages you don't care about
- def handle_info(msg, state) do
- {:noreply, state}
- end
-
- defp format_genre(nil), do: ""
- defp format_genre(""), do: ""
- defp format_genre(text), do: "[#{text}] "
-
-end
diff --git a/lib/lsg_irc/np_handler.ex b/lib/lsg_irc/np_handler.ex
deleted file mode 100644
index 1a52c75..0000000
--- a/lib/lsg_irc/np_handler.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule LSG.IRC.NpHandler do
- @moduledoc """
- # np
-
- * **!np** chanson/émission actuellement sur le stream de 115ans.net
- """
-
- def short_irc_doc, do: "!np (en ce moment sur 115ans)"
- def irc_doc, do: @moduledoc
- def start_link(client) do
- GenServer.start_link(__MODULE__, [client], name: __MODULE__)
- end
-
- def init([client]) do
- ExIRC.Client.add_handler client, self
- {:ok, _} = Registry.register(LSG.BroadcastRegistry, "icecast", [plugin: __MODULE__])
- {:ok, client}
- end
-
- def handle_info({:received, "!np", _, chan}, client) do
- stats = LSG.IcecastAgent.get
- np = if stats.live do
- "en direct: #{format_genre(stats.genre)}#{stats.np}"
- else
- "np: #{stats.np}"
- end
- ExIRC.Client.msg(client, :privmsg, chan, np)
- {:noreply, client}
- end
-
- # Catch-all for messages you don't care about
- def handle_info(msg, client) do
- {:noreply, client}
- end
-
- defp format_genre(nil), do: ""
- defp format_genre(""), do: ""
- defp format_genre(text), do: "[#{text}] "
-
-end