* [Enhancement] Adds ability to stop media from re-downloading (#159) * Added column * Added methods for ignoring media items from future download * Added new deletion options to controller and UI * Added controller actions and UI for editing a media item * Added column to sources * Added retention period to form * [WIP] getting retention methods in place * Hooked up retention worker * Added column and UI to prevent automatic deletion * Docs * Removed unused backfill worker * Added edit links to media item tabs on source view * Clarified form wording * Form wording (again)
25 lines
638 B
Elixir
25 lines
638 B
Elixir
defmodule PinchflatWeb.MediaItems.MediaItemHTML do
|
|
use PinchflatWeb, :html
|
|
|
|
embed_templates "media_item_html/*"
|
|
|
|
@doc """
|
|
Renders a media item form.
|
|
"""
|
|
attr :changeset, Ecto.Changeset, required: true
|
|
attr :action, :string, required: true
|
|
|
|
def media_item_form(assigns)
|
|
|
|
def media_file_exists?(media_item) do
|
|
!!media_item.media_filepath and File.exists?(media_item.media_filepath)
|
|
end
|
|
|
|
def media_type(media_item) do
|
|
case Path.extname(media_item.media_filepath) do
|
|
ext when ext in [".mp4", ".webm", ".mkv"] -> :video
|
|
ext when ext in [".mp3", ".m4a"] -> :audio
|
|
_ -> :unknown
|
|
end
|
|
end
|
|
end
|