* Hooked up series directory finding to source metadata runner * Fixed aired NFO tag for episodes * Updated MI NFO builder to take in a filepath * Hooked up NFO generation to the source worker * Added NFO controls to form * Improved the way the source metadata worker updates the source * Consolidated NFO selection options in media profile instead of source
50 lines
1.6 KiB
Elixir
50 lines
1.6 KiB
Elixir
defmodule Pinchflat.Metadata.NfoBuilderTest do
|
|
use Pinchflat.DataCase
|
|
|
|
alias Pinchflat.Metadata.NfoBuilder
|
|
alias Pinchflat.Filesystem.FilesystemHelpers
|
|
|
|
setup do
|
|
filepath = FilesystemHelpers.generate_metadata_tmpfile(:json)
|
|
|
|
on_exit(fn -> File.rm!(filepath) end)
|
|
|
|
{:ok,
|
|
%{
|
|
metadata: render_parsed_metadata(:media_metadata),
|
|
filepath: filepath
|
|
}}
|
|
end
|
|
|
|
describe "build_and_store_for_media_item/2" do
|
|
test "returns the filepath", %{metadata: metadata, filepath: filepath} do
|
|
result = NfoBuilder.build_and_store_for_media_item(filepath, metadata)
|
|
|
|
assert File.exists?(result)
|
|
end
|
|
|
|
test "builds an NFO file", %{metadata: metadata, filepath: filepath} do
|
|
result = NfoBuilder.build_and_store_for_media_item(filepath, metadata)
|
|
nfo = File.read!(result)
|
|
|
|
assert String.contains?(nfo, ~S(<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>))
|
|
assert String.contains?(nfo, "<title>#{metadata["title"]}</title>")
|
|
end
|
|
end
|
|
|
|
describe "build_and_store_for_source/2" do
|
|
test "returns the filepath", %{metadata: metadata, filepath: filepath} do
|
|
result = NfoBuilder.build_and_store_for_source(filepath, metadata)
|
|
|
|
assert File.exists?(result)
|
|
end
|
|
|
|
test "builds an NFO file", %{metadata: metadata, filepath: filepath} do
|
|
result = NfoBuilder.build_and_store_for_source(filepath, metadata)
|
|
nfo = File.read!(result)
|
|
|
|
assert String.contains?(nfo, ~S(<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>))
|
|
assert String.contains?(nfo, "<title>#{metadata["title"]}</title>")
|
|
end
|
|
end
|
|
end
|