fix: using the right field for the last update date
This commit is contained in:
parent
3aeb1b501e
commit
209ba2a290
2 changed files with 8 additions and 7 deletions
|
@ -43,12 +43,12 @@ defmodule PodcastFeed.Provider.Archive.Parser do
|
|||
metadata_json |> Poison.decode!()
|
||||
end
|
||||
|
||||
def parse(identifier, %{"metadata" => metadata, "files" => files}, extra) do
|
||||
def parse(identifier, metadata = %{"files" => files}, extra) do
|
||||
extra = files
|
||||
|> fetch_cover(identifier)
|
||||
|> enrich_extra_metadata_with_cover(extra)
|
||||
|
||||
%{podcast: podcast_data(metadata, extra), items: items_data(files, identifier)}
|
||||
%{podcast: podcast_data(metadata, extra), items: items_data(metadata, identifier)}
|
||||
end
|
||||
|
||||
# cover is nil
|
||||
|
@ -62,7 +62,7 @@ defmodule PodcastFeed.Provider.Archive.Parser do
|
|||
# image is already set in the extra_metadata
|
||||
defp enrich_extra_metadata_with_cover(_cover, extra), do: extra
|
||||
|
||||
defp podcast_data(metadata, extra) do
|
||||
defp podcast_data(%{"metadata" => metadata, "item_last_updated" => last_updated}, extra) do
|
||||
%{
|
||||
title: metadata["title"],
|
||||
description: metadata["description"],
|
||||
|
@ -74,7 +74,7 @@ defmodule PodcastFeed.Provider.Archive.Parser do
|
|||
},
|
||||
keywords: metadata["subject"],
|
||||
pubDate: metadata["publicdate"] |> NaiveDateTime.from_iso8601!() |> DateTime.from_naive!("Etc/UTC"),
|
||||
lastBuildDate: metadata["addeddate"] |> NaiveDateTime.from_iso8601!() |> DateTime.from_naive!("Etc/UTC"),
|
||||
lastBuildDate: last_updated |> DateTime.from_unix!(:second),
|
||||
author: metadata["creator"],
|
||||
language: metadata["language"],
|
||||
image: %{
|
||||
|
@ -88,7 +88,8 @@ defmodule PodcastFeed.Provider.Archive.Parser do
|
|||
}
|
||||
end
|
||||
|
||||
defp items_data(files, identifier) do
|
||||
|
||||
defp items_data(%{"files" => files}, identifier) do
|
||||
files
|
||||
|> filter_audio_files()
|
||||
|> Enum.map(fn f -> to_feed_item(f, identifier, files) end)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<description><![CDATA[<%= @podcast.description %>]]></description>
|
||||
<itunes:summary><![CDATA[<%= @podcast.description %>]]></itunes:summary>
|
||||
<itunes:subtitle><![CDATA[<%= Regex.run(~r/\A(.{0,255})(?: |\.|\Z)/, @podcast.description) |> List.last() %>]]></itunes:subtitle>
|
||||
<lastBuildDate><%= @podcast.pubDate |> Calendar.DateTime.Format.rfc2822 %></lastBuildDate>
|
||||
<lastBuildDate><%= @podcast.lastBuildDate |> Calendar.DateTime.Format.rfc2822 %></lastBuildDate>
|
||||
<%= for item <- @items do %>
|
||||
<item>
|
||||
<title><![CDATA[<%= item.title %>]]></title>
|
||||
|
@ -47,4 +47,4 @@
|
|||
</item>
|
||||
<% end %>
|
||||
</channel>
|
||||
</rss>
|
||||
</rss>
|
||||
|
|
Loading…
Reference in a new issue