Allow subtitle downloading (#11)
* Added subtitle options to media profile model * Updated media profile form * Adds subtitle-based options in options builder * Updates metadata parser to include subtitles * Adds subtitle_filepaths to media_item * renamed video_filepath to media_filepath * Added more fields to media profile show page
This commit is contained in:
@@ -8,9 +8,24 @@ defmodule Pinchflat.Profiles.MediaProfile do
|
||||
|
||||
alias Pinchflat.MediaSource.Channel
|
||||
|
||||
@allowed_fields ~w(
|
||||
name
|
||||
output_path_template
|
||||
download_subs
|
||||
download_auto_subs
|
||||
embed_subs
|
||||
sub_langs
|
||||
)a
|
||||
|
||||
@required_fields ~w(name output_path_template)a
|
||||
|
||||
schema "media_profiles" do
|
||||
field :name, :string
|
||||
field :output_path_template, :string
|
||||
field :download_subs, :boolean, default: true
|
||||
field :download_auto_subs, :boolean, default: true
|
||||
field :embed_subs, :boolean, default: true
|
||||
field :sub_langs, :string, default: "en"
|
||||
|
||||
has_many :channels, Channel
|
||||
|
||||
@@ -20,8 +35,8 @@ defmodule Pinchflat.Profiles.MediaProfile do
|
||||
@doc false
|
||||
def changeset(media_profile, attrs) do
|
||||
media_profile
|
||||
|> cast(attrs, [:name, :output_path_template])
|
||||
|> validate_required([:name, :output_path_template])
|
||||
|> cast(attrs, @allowed_fields)
|
||||
|> validate_required(@required_fields)
|
||||
|> unique_constraint(:name)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user