Misc refactors 2024-03-14 (#89)

* Adds method to improve cleanup of empty directories

* resolved bug where source metadata worker could call itself in an infinite loop

* Refactored file deletion for media items

* Removed useless filesystem data worker

* Updated task listing fns to take a record directly

* Refactored the way I call workers

* Improved some tests
This commit is contained in:
Kieran
2024-03-15 17:44:58 -07:00
committed by GitHub
parent a135746c97
commit b633d0f75c
37 changed files with 447 additions and 416 deletions
@@ -62,6 +62,15 @@ defmodule Pinchflat.YtDlp.MediaCollectionTest do
assert_receive {:handler, filename}
assert String.ends_with?(filename, ".json")
end
test "gracefully handles partially failed responses" do
expect(YtDlpRunnerMock, :run, fn _url, _opts, _ot, _addl_opts ->
{:ok, "INVALID\n\n" <> source_attributes_return_fixture() <> "\nINVALID\n"}
end)
assert {:ok, [%Media{media_id: "video1"}, %Media{media_id: "video2"}, %Media{media_id: "video3"}]} =
MediaCollection.get_media_attributes_for_collection(@channel_url)
end
end
describe "get_source_details/1" do