[Enhancement] Allow overriding output templates on a per-source basis (#179)

* Added output path override to table and download option builder

* Added output template override to UI
This commit is contained in:
Kieran
2024-04-10 22:02:19 -07:00
committed by GitHub
parent 96c65012ca
commit e984c05298
9 changed files with 227 additions and 97 deletions
+22
View File
@@ -35,6 +35,28 @@ defmodule Pinchflat.SourcesTest do
end
end
describe "output_path_template/1" do
test "returns the source's override if present" do
source = source_fixture(%{output_path_template_override: "/override/{{ title }}.{{ ext }}"})
assert Sources.output_path_template(source) == "/override/{{ title }}.{{ ext }}"
end
test "returns the media profile's template if no override is present" do
media_profile = media_profile_fixture(%{output_path_template: "/profile/{{ title }}.{{ ext }}"})
source = source_fixture(%{media_profile_id: media_profile.id})
assert Sources.output_path_template(source) == "/profile/{{ title }}.{{ ext }}"
end
test "Treats empty strings as being blank" do
media_profile = media_profile_fixture(%{output_path_template: "/profile/{{ title }}.{{ ext }}"})
source = source_fixture(%{media_profile_id: media_profile.id, output_path_template_override: " "})
assert Sources.output_path_template(source) == "/profile/{{ title }}.{{ ext }}"
end
end
describe "list_sources/0" do
test "it returns all sources" do
source = source_fixture()