Improve episode-level compatability with media center apps (#86)

* 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)
This commit is contained in:
Kieran
2024-03-14 18:30:08 -07:00
committed by GitHub
parent c67278ab5c
commit a135746c97
28 changed files with 710 additions and 179 deletions
+6
View File
@@ -144,6 +144,8 @@ defmodule Pinchflat.Media do
@doc """
Produces a flat list of the filesystem paths for a media_item's downloaded files
NOTE: this can almost certainly be made private
Returns [binary()]
"""
def media_filepaths(media_item) do
@@ -162,6 +164,8 @@ defmodule Pinchflat.Media do
Produces a flat list of the filesystem paths for a media_item's metadata files.
Returns an empty list if the media_item has no metadata.
NOTE: this can almost certainly be made private
Returns [binary()] | []
"""
def metadata_filepaths(media_item) do
@@ -227,6 +231,7 @@ defmodule Pinchflat.Media do
def delete_media_item(%MediaItem{} = media_item, opts \\ []) do
delete_files = Keyword.get(opts, :delete_files, false)
# NOTE: this should delete metadata no matter what
if delete_files do
{:ok, _} = delete_all_attachments(media_item)
end
@@ -242,6 +247,7 @@ defmodule Pinchflat.Media do
MediaItem.changeset(media_item, attrs)
end
# NOTE: refactor this
defp delete_all_attachments(media_item) do
media_item = Repo.preload(media_item, :metadata)