* Add media profile presets (#85) * Added presets for output templates * Added presets for the entire media profile form * Append `-thumb` to thumbnails when downloading (#87) * Appended -thumb to thumbnails when downloading * Added code to compensate for yt-dlp bug * Squash all the commits from the other branch bc I broke things (#88)
36 lines
755 B
Elixir
36 lines
755 B
Elixir
defmodule Pinchflat.Metadata.SourceMetadata do
|
|
@moduledoc """
|
|
The SourceMetadata schema.
|
|
|
|
Look. Don't @ me about Metadata vs. Metadatum. I'm very sensitive.
|
|
"""
|
|
|
|
use Ecto.Schema
|
|
import Ecto.Changeset
|
|
|
|
alias Pinchflat.Sources.Source
|
|
|
|
@allowed_fields ~w(metadata_filepath)a
|
|
@required_fields ~w(metadata_filepath)a
|
|
|
|
schema "source_metadata" do
|
|
field :metadata_filepath, :string
|
|
|
|
belongs_to :source, Source
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
@doc false
|
|
def changeset(source_metadata, attrs) do
|
|
source_metadata
|
|
|> cast(attrs, @allowed_fields)
|
|
|> validate_required(@required_fields)
|
|
|> unique_constraint([:source_id])
|
|
end
|
|
|
|
@doc false
|
|
def filepath_attributes do
|
|
~w(metadata_filepath)a
|
|
end
|
|
end
|