-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Working on fetching channel metadata in yt-dlp backend
- Loading branch information
1 parent
4252c27
commit cdd708f
Showing
8 changed files
with
48 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
defmodule Pinchflat.Downloader.Backends.YtDlp.Channel do | ||
@moduledoc """ | ||
Contains utilities for working with a channel's videos | ||
""" | ||
|
||
# TODO: convert to `use` | ||
import Pinchflat.Downloader.Backends.YtDlp.VideoCollection | ||
alias __MODULE__ | ||
|
||
defstruct [:id, :name] | ||
|
||
def new(id, name) do | ||
%__MODULE__{id: id, name: name} | ||
end | ||
|
||
def get_channel_info(channel_url) do | ||
opts = [print: "%(.{channel,channel_id})j", playlist_end: 1] | ||
|
||
case backend_runner().run(channel_url, opts) do | ||
{:ok, output} -> | ||
result = Phoenix.json_library().decode!(output) | ||
|
||
{:ok, Channel.new(result["channel_id"], result["channel"])} | ||
|
||
res -> | ||
res | ||
end | ||
end | ||
|
||
defp backend_runner do | ||
Application.get_env(:pinchflat, :yt_dlp_runner) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters