1
0
mirror of https://github.com/algora-io/tv.git synced 2025-03-17 20:17:45 +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
with {:ok, playlist} <- get_playlist(video) do
uri = playlist.items |> Enum.find(&match?(%{uri: _}, &1)) |> then(& &1.uri)
get_media_playlist(video, uri)
case playlist.items |> Enum.find(&match?(%{uri: _}, &1)) do
nil -> {:error, :not_found}
item -> get_media_playlist(video, item.uri)
end
end
end