@php $duration = $value['watched_time'] ?? ($value['entertainment_type'] == 'video' && isset($value->video['duration']) ? $value->video['duration'] : (isset($value->entertainment['duration']) ? $value->entertainment['duration'] : '00:00')); $episode_name = null; $episode_poster_url = null; if ($value['entertainment_type'] == 'tvshow' && isset($value['episode_id']) && $value['episode_id']) { $episode = \Modules\Episode\Models\Episode::where('id', $value['episode_id'])->first(); if ($episode) { $episode_name = $episode->name; $episode_poster_url = $episode->poster_url; } } $name = ($episode_name) ? $episode_name : ($value['name'] ?? ($value['entertainment_type'] == 'video' && isset($value->video['name']) ? $value->video['name'] : (isset($value->entertainment['name']) ? $value->entertainment['name'] : 'Unknown'))); $poster_image = ($episode_poster_url) ? setBaseUrlWithFileName($episode_poster_url) : ($value['poster_image'] ?? ($value['entertainment_type'] == 'video' && isset($value->video['poster_url']) ? setBaseUrlWithFileName($value->video['poster_url']) : (isset($value->entertainment['poster_url']) ? setBaseUrlWithFileName($value->entertainment['poster_url']) : 'default-poster.jpg'))); if (!function_exists('convertSeconds')) { function convertSeconds($time) { [$hours, $minutes, $seconds] = array_map('intval', explode(':', $time)); return $hours * 3600 + $minutes * 60 + $seconds; } } $total_watched_time = $value['total_watched_time'] ?? '00:00:00'; $totalDurationInSeconds = convertSeconds($total_watched_time); $watchedTime = $value['watched_time'] ?? '00:00:00'; $watchedTimeInSeconds = convertSeconds($watchedTime); $progressPercentage = $totalDurationInSeconds > 0 ? ($watchedTimeInSeconds / $totalDurationInSeconds) * 100 : 0; @endphp
@if($value['entertainment_type'] == 'episode' || $value['entertainment_type'] == 'tvshow') @if(isset($value['episode_id']) && $value['episode_id'] != null) movie-card @else movie-card @endif @endif @if($value['entertainment_type'] == 'movie') movie-card @endif @if($value['entertainment_type'] == 'video') movie-card @endif
@if($value['entertainment_type'] == 'episode' || $value['entertainment_type'] == 'tvshow') @if(isset($value['episode_id']) && $value['episode_id'] != null)
{{ $name }}
@else
{{ $name }}
@endif @endif @if($value['entertainment_type'] == 'movie')
{{ $name }}
@endif @if($value['entertainment_type'] == 'video')
{{ $name }}
@endif {{ $duration }}