Start integrating playlist support (#13)
* [WIP] updated the output of VideoCollection to include playlists * Updated source's name to collection_name; supported playlist ID/name fetching * Hooked up collection_type to form; refactored enqueue_pending_media_downloads * Added friendly_name to form * Added media profile link to source view * Updates comment
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
defmodule PinchflatWeb.MediaSources.SourceController do
|
||||
use PinchflatWeb, :controller
|
||||
|
||||
alias Pinchflat.Repo
|
||||
alias Pinchflat.Profiles
|
||||
alias Pinchflat.MediaSource
|
||||
alias Pinchflat.MediaSource.Source
|
||||
@@ -30,7 +31,10 @@ defmodule PinchflatWeb.MediaSources.SourceController do
|
||||
end
|
||||
|
||||
def show(conn, %{"id" => id}) do
|
||||
source = MediaSource.get_source!(id)
|
||||
source =
|
||||
id
|
||||
|> MediaSource.get_source!()
|
||||
|> Repo.preload(:media_profile)
|
||||
|
||||
render(conn, :show, source: source)
|
||||
end
|
||||
|
||||
@@ -24,4 +24,11 @@ defmodule PinchflatWeb.MediaSources.SourceHTML do
|
||||
{"Monthly", 30 * 24 * 60}
|
||||
]
|
||||
end
|
||||
|
||||
def friendly_collection_types do
|
||||
[
|
||||
{"Channel", "channel"},
|
||||
{"Playlist", "playlist"}
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
</.header>
|
||||
|
||||
<.table id="sources" rows={@sources} row_click={&JS.navigate(~p"/media_sources/sources/#{&1}")}>
|
||||
<:col :let={source} label="Name"><%= source.name %></:col>
|
||||
<:col :let={source} label="Source"><%= source.collection_id %></:col>
|
||||
<:col :let={source} label="Collection Name"><%= source.collection_name %></:col>
|
||||
<:col :let={source} label="Collection ID"><%= source.collection_id %></:col>
|
||||
<:action :let={source}>
|
||||
<div class="sr-only">
|
||||
<.link navigate={~p"/media_sources/sources/#{source}"}>Show</.link>
|
||||
|
||||
@@ -9,9 +9,18 @@
|
||||
</.header>
|
||||
|
||||
<.list>
|
||||
<:item title="Source Name"><%= @source.name %></:item>
|
||||
<:item title="Source ID"><%= @source.collection_id %></:item>
|
||||
<:item title="Original URL"><%= @source.original_url %></:item>
|
||||
<:item title="media_profile">
|
||||
<.link href={~p"/media_profiles/#{@source.media_profile}"}>
|
||||
<%= @source.media_profile.name %>
|
||||
</.link>
|
||||
</:item>
|
||||
|
||||
<:item
|
||||
:for={attr <- ~w(collection_type collection_name collection_id original_url friendly_name)a}
|
||||
title={attr}
|
||||
>
|
||||
<%= Map.get(@source, attr) %>
|
||||
</:item>
|
||||
</.list>
|
||||
|
||||
<.back navigate={~p"/media_sources/sources"}>Back to sources</.back>
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
Oops, something went wrong! Please check the errors below.
|
||||
</.error>
|
||||
|
||||
<.input field={f[:friendly_name]} type="text" label="Friendly Name" />
|
||||
|
||||
<.input
|
||||
field={f[:media_profile_id]}
|
||||
options={Enum.map(@media_profiles, &{&1.name, &1.id})}
|
||||
@@ -10,7 +12,13 @@
|
||||
label="Media Profile"
|
||||
/>
|
||||
|
||||
<.input field={f[:collection_type]} type="text" label="Collection Type" />
|
||||
<.input
|
||||
field={f[:collection_type]}
|
||||
options={friendly_collection_types()}
|
||||
type="select"
|
||||
label="Collection Type"
|
||||
/>
|
||||
|
||||
<.input field={f[:original_url]} type="text" label="Source URL" />
|
||||
|
||||
<.input
|
||||
|
||||
Reference in New Issue
Block a user