* [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
34 lines
965 B
Elixir
34 lines
965 B
Elixir
defmodule Pinchflat.MediaClient.SourceDetails do
|
|
@moduledoc """
|
|
This is the integration layer for actually working with sources.
|
|
|
|
Technically hardcodes the yt-dlp backend for now, but should leave
|
|
it open-ish for future expansion (just in case).
|
|
"""
|
|
|
|
alias Pinchflat.MediaClient.Backends.YtDlp.VideoCollection, as: YtDlpSource
|
|
|
|
@doc """
|
|
Gets a source's ID and name from its URL, using the given backend.
|
|
|
|
Returns {:ok, map()} | {:error, any, ...}.
|
|
"""
|
|
def get_source_details(source_url, backend \\ :yt_dlp) do
|
|
source_module(backend).get_source_details(source_url)
|
|
end
|
|
|
|
@doc """
|
|
Returns a list of video IDs for the given source URL, using the given backend.
|
|
|
|
Returns {:ok, list(binary())} | {:error, any, ...}.
|
|
"""
|
|
def get_video_ids(source_url, backend \\ :yt_dlp) do
|
|
source_module(backend).get_video_ids(source_url)
|
|
end
|
|
|
|
defp source_module(backend) do
|
|
case backend do
|
|
:yt_dlp -> YtDlpSource
|
|
end
|
|
end
|
|
end
|