diff --git a/lib/pinchflat/media_source/source.ex b/lib/pinchflat/media_source/source.ex index 1c94d64..ed77c7b 100644 --- a/lib/pinchflat/media_source/source.ex +++ b/lib/pinchflat/media_source/source.ex @@ -7,6 +7,7 @@ defmodule Pinchflat.Sources.Source do import Ecto.Changeset import Pinchflat.Utils.ChangesetUtils + alias Pinchflat.Tasks.Task alias Pinchflat.Media.MediaItem alias Pinchflat.Profiles.MediaProfile @@ -47,6 +48,7 @@ defmodule Pinchflat.Sources.Source do belongs_to :media_profile, MediaProfile + has_many :tasks, Task has_many :media_items, MediaItem, foreign_key: :source_id timestamps(type: :utc_datetime) diff --git a/lib/pinchflat_web/components/custom_components/text_components.ex b/lib/pinchflat_web/components/custom_components/text_components.ex index e362110..6ba9771 100644 --- a/lib/pinchflat_web/components/custom_components/text_components.ex +++ b/lib/pinchflat_web/components/custom_components/text_components.ex @@ -23,7 +23,7 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do attr :href, :string, required: true slot :inner_block - def reference_link(assigns) do + def inline_link(assigns) do ~H""" <.link href={@href} target="_blank" class="text-blue-500 hover:text-blue-300"> <%= render_slot(@inner_block) %> diff --git a/lib/pinchflat_web/controllers/media_items/media_item_controller.ex b/lib/pinchflat_web/controllers/media_items/media_item_controller.ex index 6d705b5..95847dd 100644 --- a/lib/pinchflat_web/controllers/media_items/media_item_controller.ex +++ b/lib/pinchflat_web/controllers/media_items/media_item_controller.ex @@ -1,10 +1,14 @@ defmodule PinchflatWeb.MediaItems.MediaItemController do use PinchflatWeb, :controller + alias Pinchflat.Repo alias Pinchflat.Media def show(conn, %{"id" => id}) do - media_item = Media.get_media_item!(id) + media_item = + id + |> Media.get_media_item!() + |> Repo.preload([:source, tasks: [:job]]) render(conn, :show, media_item: media_item) end diff --git a/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex b/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex index 9c5dce2..95da677 100644 --- a/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex +++ b/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex @@ -8,23 +8,51 @@ -
Nothing Here!
+ <% end %> + +yt-dlp-style
- <.reference_link href="https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#output-template">
+ <.inline_link href="https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#output-template">
<.icon name="hero-arrow-top-right-on-square" class="h-4 w-4" />
- :
+ :
<.inline_code>/%(channel)s/%(duration>%H-%M-%S)s-%(id)s.%(ext)s
Any single-word yt-dlp
option
- <.reference_link href="https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#output-template">
+ <.inline_link href="https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#output-template">
<.icon name="hero-arrow-top-right-on-square" class="h-4 w-4" />
-
+
can be used with the curly braced liquid-style syntax.
This is just a list of the most common options as well as some custom aliases
Nothing Here!
- <% end %> - -Nothing Here!
- <% end %> -Nothing Here!
+ <% end %> + + <:tab title="Downloaded Media"> + <%= if match?([_|_], @downloaded_media) do %> +Nothing Here!
+ <% end %> + + <:tab title="Tasks"> + <%= if match?([_|_], @source.tasks) do %> + <.table rows={@source.tasks} table_class="text-black dark:text-white"> + <:col :let={task} label="Worker"> + <%= task.job.worker %> + + <:col :let={task} label="State"> + <%= task.job.state %> + + <:col :let={task} label="Scheduled At"> + <%= Calendar.strftime(task.job.scheduled_at, "%y-%m-%d %I:%M:%S %p %Z") %> + + + <% else %> +Nothing Here!
+ <% end %> + +