videos.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {% load humanize %}
  2. <div class="list-group" id="video-checkboxes">
  3. {% for video in videos %}
  4. <li class="list-group-item d-flex justify-content-between align-items-center">
  5. {% if video.is_unavailable_on_yt %}
  6. <a style="background-color: #E73927;" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" class="list-group-item list-group-item-dark">
  7. {{ video.video_position }}. {{ video.name }}
  8. <span class="badge bg-secondary">{{ video.duration }}</span>
  9. </a>
  10. {% else %}
  11. <div class="d-flex justify-content-between align-items-center">
  12. <div>
  13. <input class="video-checkboxes" style="display: none" type="checkbox" value="{{ video.video_id }}" name="video-id">
  14. </div>
  15. <div class="ms-4" style="max-width: 115px; max-height: 100px;">
  16. <img src="{% if video.thumbnail_url %}{{ video.thumbnail_url }}{% else %}https://i.ytimg.com/vi/9219YrnwDXE/maxresdefault.jpg{% endif %}" class="img-fluid" alt="">
  17. </div>
  18. <div class="ms-4">
  19. <a href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">{{ video.video_position }}. {{ video.name }}</a> <br>
  20. <span class="badge bg-secondary">{{ video.duration }}</span>
  21. {% if video.has_cc %}<span class="badge bg-secondary">CC</span>{% endif %}
  22. {% if video.published_at %}<span class="badge bg-secondary">{{ video.published_at }}</span>{% endif %}
  23. {% if video.view_count %}<span class="badge bg-info">{{ video.view_count|intword|intcomma }} views</span>{% endif %}
  24. {% if video.is_duplicate %}<span class="badge bg-primary">duplicate</span>{% endif %}<br>
  25. </div>
  26. </div>
  27. <div>
  28. <a class="btn btn-sm btn-success" type="button" target="_blank" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}">Open</a>
  29. <button class="btn btn-sm btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasWithBackdrop" aria-controls="offcanvasBottom" hx-get="{% url 'video_details' playlist.playlist_id video.video_id %}" hx-trigger="click" hx-target="#video-details">Details</button>
  30. </div>
  31. {% endif %}
  32. {% endfor %}
  33. </li>
  34. </div>