<%= link to: Routes.podcast_url(@conn, :show, @podcast.slug), title: "#{@podcast.name} on Changelog.com", alt: "#{@podcast.name} Podcast" do %>
-
+
<% end %>
diff --git a/lib/changelog_web/templates/feed/plusplus.xml.eex b/lib/changelog_web/templates/feed/plusplus.xml.eex
index c700e6632b..0866c64b56 100644
--- a/lib/changelog_web/templates/feed/plusplus.xml.eex
+++ b/lib/changelog_web/templates/feed/plusplus.xml.eex
@@ -38,7 +38,7 @@
<%= if episode.type == :full do %>
<%= EpisodeView.number(episode) %>
<% end %>
-
+ <%= TimeView.duration(duration) %>no<%= escaped(episode.subtitle) %>
diff --git a/lib/changelog_web/templates/feed/podcast.xml.eex b/lib/changelog_web/templates/feed/podcast.xml.eex
index 7dcd7b3853..6b524a0e75 100644
--- a/lib/changelog_web/templates/feed/podcast.xml.eex
+++ b/lib/changelog_web/templates/feed/podcast.xml.eex
@@ -55,7 +55,7 @@
<%= render("_show_notes.xml", episode: episode, plusplus: false) %><%= episode.type %>
-
+ <%= TimeView.duration(episode.audio_duration) %>no<%= episode.podcast.keywords %>
diff --git a/lib/changelog_web/views/episode_view.ex b/lib/changelog_web/views/episode_view.ex
index 51c6464861..2cc0e8d54b 100644
--- a/lib/changelog_web/views/episode_view.ex
+++ b/lib/changelog_web/views/episode_view.ex
@@ -12,6 +12,8 @@ defmodule ChangelogWeb.EpisodeView do
UrlKit
}
+ alias Changelog.Files.Cover
+
alias ChangelogWeb.{
Endpoint,
LayoutView,
@@ -70,6 +72,14 @@ defmodule ChangelogWeb.EpisodeView do
defp get_down_with_op3(url, _mode), do: String.replace_prefix(url, "", "https://op3.dev/e/")
+ def cover_url(episode, version \\ :original) do
+ if episode.cover do
+ Cover.url({episode.cover, episode}, version)
+ else
+ PodcastView.cover_url(episode.podcast, version)
+ end
+ end
+
# simplest case, no ++
def plusplus_cta(%{plusplus_file: pp}) when is_nil(pp), do: fallback_cta()
diff --git a/lib/changelog_web/views/podcast_view.ex b/lib/changelog_web/views/podcast_view.ex
index e4c4437f2c..61d752eefe 100644
--- a/lib/changelog_web/views/podcast_view.ex
+++ b/lib/changelog_web/views/podcast_view.ex
@@ -27,28 +27,28 @@ defmodule ChangelogWeb.PodcastView do
end
end
- def cover_path(%{slug: "master"}, version) do
+ def cover_url(podcast, version \\ :original)
+
+ # Special cases for Master, The Changelog & ++
+ def cover_url(%{slug: "master"}, version) do
image = "master-#{version}.png"
url(~p"/images/podcasts/#{image}")
end
- def cover_path(%{slug: "podcast", is_meta: true}, version) do
+ def cover_url(%{slug: "podcast", is_meta: true}, version) do
image = "podcast-#{version}.png"
url(~p"/images/podcasts/#{image}")
end
- def cover_path(%{slug: "plusplus"}, version) do
+ def cover_url(%{slug: "plusplus"}, version) do
image = "plusplus-#{version}.png"
url(~p"/images/podcasts/#{image}")
end
- def cover_path(podcast, version), do: Cover.url({podcast.cover, podcast}, version)
-
- def cover_url(podcast), do: cover_url(podcast, :original)
-
+ # Standard case
def cover_url(podcast, version) do
if podcast.cover do
- cover_path(podcast, version)
+ Cover.url({podcast.cover, podcast}, version)
else
url(~p"/images/defaults/black.png")
end
diff --git a/priv/repo/migrations/20240109164004_add_cover_to_episodes.exs b/priv/repo/migrations/20240109164004_add_cover_to_episodes.exs
new file mode 100644
index 0000000000..9d2a642481
--- /dev/null
+++ b/priv/repo/migrations/20240109164004_add_cover_to_episodes.exs
@@ -0,0 +1,9 @@
+defmodule Changelog.Repo.Migrations.AddCoverFieldsToEpisodes do
+ use Ecto.Migration
+
+ def change do
+ alter table(:episodes) do
+ add :cover, :string
+ end
+ end
+end