1
0
mirror of https://github.com/algora-io/tv.git synced 2025-04-07 06:49:52 +02:00

handle case where media playlist is missing

This commit is contained in:
zafer 2024-09-01 00:41:04 +03:00
parent f86da9fd58
commit 47e5916441

View File

@ -316,8 +316,10 @@ defmodule Algora.Library do
defp get_media_playlist(%Video{} = video) do defp get_media_playlist(%Video{} = video) do
with {:ok, playlist} <- get_playlist(video) do with {:ok, playlist} <- get_playlist(video) do
uri = playlist.items |> Enum.find(&match?(%{uri: _}, &1)) |> then(& &1.uri) case playlist.items |> Enum.find(&match?(%{uri: _}, &1)) do
get_media_playlist(video, uri) nil -> {:error, :not_found}
item -> get_media_playlist(video, item.uri)
end
end end
end end