fix: fixing seconds duration of audio
This commit is contained in:
parent
a4cfdfcdf6
commit
cd2359c634
2 changed files with 3 additions and 5 deletions
|
@ -96,7 +96,7 @@ defmodule PodcastFeed.Provider.Archive.Parser do
|
||||||
description: "",
|
description: "",
|
||||||
pubDate: file |> Map.get("mtime") |> Integer.parse() |> elem(0) |> DateTime.from_unix!(:second),
|
pubDate: file |> Map.get("mtime") |> Integer.parse() |> elem(0) |> DateTime.from_unix!(:second),
|
||||||
link: Format.compile(@download_url, identifier: identifier, filename: filename) |> URI.encode(),
|
link: Format.compile(@download_url, identifier: identifier, filename: filename) |> URI.encode(),
|
||||||
length: (file |> Map.get("length") |> Float.parse() |> elem(0)) * 100 |> trunc(),
|
length: (file |> Map.get("length") |> Float.parse() |> elem(0)) |> trunc(),
|
||||||
size: file |> Map.get("size"),
|
size: file |> Map.get("size"),
|
||||||
summary: "",
|
summary: "",
|
||||||
# image: "", #FIXME:! take the image from other files
|
# image: "", #FIXME:! take the image from other files
|
||||||
|
|
|
@ -2,10 +2,8 @@ defmodule PodcastFeedWeb.FeedView do
|
||||||
use PodcastFeedWeb, :view
|
use PodcastFeedWeb, :view
|
||||||
|
|
||||||
def format_length(length) do
|
def format_length(length) do
|
||||||
length |> IO.inspect
|
min = length / 60 |> trunc()
|
||||||
parsed = length / 100 / 60
|
sec = length - (min * 60)
|
||||||
min = parsed |> trunc
|
|
||||||
sec = parsed - min |> Float.floor(2) |> Float.to_string() |> String.split(".") |> Enum.at(1)
|
|
||||||
"#{min}:#{sec}"
|
"#{min}:#{sec}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue