Format urlanalyzer output nicer

This commit is contained in:
Mikko Ahlroth 2013-08-05 21:02:21 +03:00
parent 999c215578
commit b8ac3dcb7b

View file

@ -99,16 +99,20 @@ defmodule Nulform.Plugins.URLAnalyzer do
{status, domain, type, size, title} ->
result = id_str <> "[" <> domain <> "] "
if status == 200 do
if is_number(size) and size > 0 do
size_str = "(" <> human_bytes(size) <> ")"
if String.strip(type) != "" do
result = result <> String.strip(type) <> " "
end
result = result <> type <> " " <> size_str
if is_number(size) and size > 0
# Don't show size for HTML pages, it's always wrong
and not (Enum.any? @parseable_types, fn(x) -> x == type end) do
size_str = "(" <> Nulform.Utilities.human_bytes(size) <> ")"
result = result <> size_str <> " "
end
IO.inspect result
IO.inspect title
if title != "" do
result = result <> " | " <> title
result = result <> "| " <> title
IO.inspect result
end
else