[Enhancement] Allow custom yt-dlp options (#176)

* Added option for yt-dlp config file usage

* renamed yt-dlp config file

* refactored to use a precedence-based approach

* Updated README
This commit is contained in:
Kieran authored and GitHub committed 2024-04-10 20:17:22 -07:00
1 parent 0fcdd1df84
commit 8fbcc8b289
7 files changed
+172 -25

No files matched your search

+11 -7
View File
@@ -32,7 +32,7 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
@impl true
def init(state) do
reset_executing_jobs()
create_blank_cookie_file()
create_blank_yt_dlp_files()
apply_default_settings()
{:ok, state}
@@ -50,15 +50,19 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
Logger.info("Reset #{count} executing jobs")
end
defp create_blank_cookie_file do
defp create_blank_yt_dlp_files do
files = ["cookies.txt", "yt-dlp-configs/base-config.txt"]
base_dir = Application.get_env(:pinchflat, :extras_directory)
filepath = Path.join(base_dir, "cookies.txt")
if !File.exists?(filepath) do
Logger.info("yt-dlp cookie file does not exist - creating it")
Enum.each(files, fn file ->
filepath = Path.join(base_dir, file)
FilesystemUtils.write_p!(filepath, "")
end
if !File.exists?(filepath) do
Logger.info("Creating blank file: #{filepath}")
FilesystemUtils.write_p!(filepath, "")
end
end)
end
defp apply_default_settings do