1
0
mirror of https://github.com/algora-io/tv.git synced 2025-11-23 21:34:58 +02:00

move thumbnail logic into library context

This commit is contained in:
zafer
2024-05-08 00:19:00 +03:00
parent 454db217d4
commit d8e468f731
2 changed files with 21 additions and 33 deletions

View File

@@ -396,6 +396,21 @@ defmodule Algora.Library do
end
end
def get_thumbnail_url(%Video{} = video) do
video.thumbnail_url || "#{AlgoraWeb.Endpoint.url()}/images/og/default.png"
end
def get_thumbnail_url(%User{} = user) do
case get_latest_video(user) do
# TODO:
nil ->
"#{AlgoraWeb.Endpoint.url()}/images/og/default.png"
video ->
get_thumbnail_url(video)
end
end
def reconcile_livestream(%Video{} = video, stream_key) do
user = Accounts.get_user_by!(stream_key: stream_key)