Browse Source

fix: size in bytes of the audio file

danilo silva 4 years ago
parent
commit
a4cfdfcdf6

+ 1 - 0
lib/podcast_feed/provider/archive/parser.ex

@@ -97,6 +97,7 @@ defmodule PodcastFeed.Provider.Archive.Parser do
       pubDate: file |> Map.get("mtime") |> Integer.parse() |> elem(0) |> DateTime.from_unix!(:second),
       link: Format.compile(@download_url, identifier: identifier, filename: filename) |> URI.encode(),
       length: (file |> Map.get("length") |> Float.parse() |> elem(0)) * 100 |> trunc(),
+      size: file |> Map.get("size"),
       summary: "",
       # image: "", #FIXME:! take the image from other files
       keywords: file |> Map.take(["album", "artist", "genre"]) |> Map.values(),

+ 1 - 1
lib/podcast_feed_web/templates/feed/feed.xml.eex

@@ -35,7 +35,7 @@
       <link><%= item.link %></link>
       <pubDate><%= item.pubDate |> Calendar.DateTime.Format.rfc2822 %></pubDate>
       <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>
       <itunes:duration><%= item.length |> format_length %></itunes:duration>
       <itunes:summary><%= item.summary %></itunes:summary>