diff --git a/lib/pinchflat/media/media.ex b/lib/pinchflat/media/media.ex index b8a35fa..191b28f 100644 --- a/lib/pinchflat/media/media.ex +++ b/lib/pinchflat/media/media.ex @@ -41,9 +41,10 @@ defmodule Pinchflat.Media do Returns a list of media_items that are redownloadable based on the redownload delay of the media_profile their source belongs to. - The logic is that a media_item is past_redownload_delay if the media_item's - upload_date is at least redownload_delay_days ago AND - `media_downloaded_at` - `redownload_delay_days` is before the media_item's `upload_date`. + The logic is that a media_item is past_redownload_delay if the media_item's uploaded_at is + at least redownload_delay_days ago AND `media_downloaded_at` - `redownload_delay_days` + is before the media_item's `uploaded_at`. + This logic grabs media that we've recently downloaded AND is recently uploaded, but doesn't grab media that we've recently downloaded and was uploaded a long time ago. This also makes things work as expected when downloading media from a source for the @@ -135,7 +136,7 @@ defmodule Pinchflat.Media do Unlike `create_media_item`, this will attempt an update if the media_item already exists. This is so that future indexing can pick up attributes that - we may not have asked for in the past (eg: upload_date) + we may not have asked for in the past (eg: uploaded_at) Returns {:ok, %MediaItem{}} | {:error, %Ecto.Changeset{}} """ diff --git a/lib/pinchflat/metadata/nfo_builder.ex b/lib/pinchflat/metadata/nfo_builder.ex index a2f7aa8..3db237f 100644 --- a/lib/pinchflat/metadata/nfo_builder.ex +++ b/lib/pinchflat/metadata/nfo_builder.ex @@ -38,7 +38,6 @@ defmodule Pinchflat.Metadata.NfoBuilder do end defp build_for_media_item(metadata) do - # TODO: see how this works post-change upload_date = MetadataFileHelpers.parse_upload_date(metadata["upload_date"]) # Cribbed from a combination of the Kodi wiki, ytdl-nfo, and ytdl-sub. # WHO NEEDS A FANCY XML PARSER ANYWAY?! diff --git a/lib/pinchflat/podcasts/podcast_helpers.ex b/lib/pinchflat/podcasts/podcast_helpers.ex index a40e63b..041107c 100644 --- a/lib/pinchflat/podcasts/podcast_helpers.ex +++ b/lib/pinchflat/podcasts/podcast_helpers.ex @@ -28,7 +28,7 @@ defmodule Pinchflat.Podcasts.PodcastHelpers do MediaQuery.new() |> where(^dynamic(^MediaQuery.for_source(source) and ^MediaQuery.downloaded())) - |> order_by(desc: :upload_date) + |> order_by(desc: :uploaded_at) |> Repo.maybe_limit(limit) |> Repo.all() |> Enum.filter(fn media_item -> File.exists?(media_item.media_filepath) end) diff --git a/lib/pinchflat/podcasts/rss_feed_builder.ex b/lib/pinchflat/podcasts/rss_feed_builder.ex index 34156fe..d5a5aea 100644 --- a/lib/pinchflat/podcasts/rss_feed_builder.ex +++ b/lib/pinchflat/podcasts/rss_feed_builder.ex @@ -7,7 +7,6 @@ defmodule Pinchflat.Podcasts.RssFeedBuilder do import Pinchflat.Utils.XmlUtils, only: [safe: 1] - alias Pinchflat.Utils.DatetimeUtils alias Pinchflat.Podcasts.PodcastHelpers alias PinchflatWeb.Router.Helpers, as: Routes @@ -83,7 +82,7 @@ defmodule Pinchflat.Podcasts.RssFeedBuilder do