fix: size in bytes of the audio file

This commit is contained in:
danilo silva 2020-05-24 19:54:35 +00:00
parent af312b946a
commit a4cfdfcdf6
2 changed files with 2 additions and 1 deletions

View file

@ -97,6 +97,7 @@ defmodule PodcastFeed.Provider.Archive.Parser do
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)) * 100 |> trunc(),
size: file |> Map.get("size"),
summary: "", summary: "",
# image: "", #FIXME:! take the image from other files # image: "", #FIXME:! take the image from other files
keywords: file |> Map.take(["album", "artist", "genre"]) |> Map.values(), keywords: file |> Map.take(["album", "artist", "genre"]) |> Map.values(),

View file

@ -35,7 +35,7 @@
<link><%= item.link %></link> <link><%= item.link %></link>
<pubDate><%= item.pubDate |> Calendar.DateTime.Format.rfc2822 %></pubDate> <pubDate><%= item.pubDate |> Calendar.DateTime.Format.rfc2822 %></pubDate>
<description><![CDATA[<%= item.description %>]]></description> <description><![CDATA[<%= item.description %>]]></description>
<enclosure url="<%= item.link %>" length="<%= item.length %>" type="audio/mpeg"/> <enclosure url="<%= item.link %>" length="<%= item.size %>" type="audio/mpeg"/>
<guid><%= item.link %></guid> <guid><%= item.link %></guid>
<itunes:duration><%= item.length |> format_length %></itunes:duration> <itunes:duration><%= item.length |> format_length %></itunes:duration>
<itunes:summary><%= item.summary %></itunes:summary> <itunes:summary><%= item.summary %></itunes:summary>