Changeset View
Changeset View
Standalone View
Standalone View
lib/lsg_irc/link_plugin.ex
Context not available. | |||||
## Configuration: | ## Configuration: | ||||
``` | ``` | ||||
config :lsg, Nola.IRC.LinkPlugin, | config :nola, Nola.IRC.LinkPlugin, | ||||
handlers: [ | handlers: [ | ||||
Nola.IRC.LinkPlugin.Youtube: [ | Nola.IRC.LinkPlugin.Youtube: [ | ||||
invidious: true | invidious: true | ||||
Context not available. | |||||
def expand_link(acc=[uri | _]) do | def expand_link(acc=[uri | _]) do | ||||
Logger.debug("link: expanding: #{inspect uri}") | Logger.debug("link: expanding: #{inspect uri}") | ||||
handlers = Keyword.get(Application.get_env(:lsg, __MODULE__, [handlers: []]), :handlers) | handlers = Keyword.get(Application.get_env(:nola, __MODULE__, [handlers: []]), :handlers) | ||||
handler = Enum.reduce_while(handlers, nil, fn({module, opts}, acc) -> | handler = Enum.reduce_while(handlers, nil, fn({module, opts}, acc) -> | ||||
Logger.debug("link: attempt expanding: #{inspect module} for #{inspect uri}") | Logger.debug("link: attempt expanding: #{inspect module} for #{inspect uri}") | ||||
module = Module.concat([module]) | module = Module.concat([module]) | ||||
Context not available. | |||||
length = Map.get(headers, "content-length", "0") | length = Map.get(headers, "content-length", "0") | ||||
{length, _} = Integer.parse(length) | {length, _} = Integer.parse(length) | ||||
handlers = Keyword.get(Application.get_env(:lsg, __MODULE__, [handlers: []]), :handlers) | handlers = Keyword.get(Application.get_env(:nola, __MODULE__, [handlers: []]), :handlers) | ||||
handler = Enum.reduce_while(handlers, false, fn({module, opts}, acc) -> | handler = Enum.reduce_while(handlers, false, fn({module, opts}, acc) -> | ||||
module = Module.concat([module]) | module = Module.concat([module]) | ||||
try do | try do | ||||
Context not available. |