videos.html 5.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {% load humanize %}
  2. <br>
  3. {% if videos_details and videos.count != 0 %}
  4. <h5>{{ videos_details }}, Results: {{ videos.count }}</h5>
  5. <br>
  6. {% endif %}
  7. <div class="list-group" id="video-checkboxes">
  8. {% if videos %}
  9. {% for video in videos %}
  10. <li class="list-group-item d-flex justify-content-between align-items-center" style="background-color: #40B3A2">
  11. {% if video.is_unavailable_on_yt and not video.was_deleted_on_yt %}
  12. <div class="d-flex justify-content-between align-items-center">
  13. <div>
  14. <input class="video-checkboxes" style="display: none" type="checkbox" value="{{ video.video_id }}" name="video-id">
  15. </div>
  16. <div class="ms-4" style="max-width: 115px; max-height: 100px;">
  17. <img src="https://i.ytimg.com/vi/9219YrnwDXE/maxresdefault.jpg" class="img-fluid" alt="">
  18. </div>
  19. <div class="ms-4">
  20. <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
  21. {{ video.video_position }}. {{ video.name }}
  22. </a>
  23. <br><br>
  24. </div>
  25. </div>
  26. {% else %}
  27. <div class="d-flex justify-content-between align-items-center" >
  28. <div>
  29. <input class="video-checkboxes" style="display: none" type="checkbox" value="{{ video.video_id }}" name="video-id">
  30. </div>
  31. <div class="ms-4" style="max-width: 115px; max-height: 100px;">
  32. <img src="{% if video.thumbnail_url %}{{ video.thumbnail_url }}{% else %}https://i.ytimg.com/vi/9219YrnwDXE/maxresdefault.jpg{% endif %}" class="img-fluid" alt="">
  33. </div>
  34. <div class="ms-4">
  35. {{ video.video_position }}.
  36. <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.videoid }}&list={{ video.playlist.playlist_id }}" target="_blank">
  37. {{ video.name|truncatewords:"16" }}
  38. </a> by {{ video.channel_name }}<br>
  39. <span class="badge bg-secondary">{{ video.duration }}</span>
  40. {% if video.has_cc %}<span class="badge bg-secondary">CC</span>{% endif %}
  41. {% if video.published_at %}<span class="badge bg-secondary">{{ video.published_at }}</span>{% endif %}
  42. {% if video.view_count %}<span class="badge bg-info">{{ video.view_count|intword|intcomma }} views</span>{% endif %}
  43. {% if video.is_duplicate %}<span class="badge bg-primary">duplicate</span>{% endif %}
  44. {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}<span class="badge bg-dark">UNAVAILABLE</span>{% endif %}
  45. {% if video.video_details_modified %}
  46. <span class="badge bg-danger">UPDATED - {% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}NEWLY ADDED{% endif %}</span>
  47. {% endif %}<br>
  48. <br>
  49. </div>
  50. </div>
  51. <div class="ms-5">
  52. <a class="btn btn-sm btn-info mb-1" type="button" href="https://www.youtube.com/watch?v={{ video.video_id }}" class="btn btn-info me-1" target="_blank"><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
  53. <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
  54. <button class="copy-btn btn btn-success mb-1" data-clipboard-target="#video-{{ video.video_id }}">
  55. <i class="far fa-copy" aria-hidden="true"></i>
  56. </button>
  57. <button class="btn btn-sm btn-primary mb-1" 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>
  58. <button class="btn btn-sm btn-warning mb-1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasForVideoNotes" aria-controls="offcanvasBottom" hx-get="{% url 'video_notes' playlist.playlist_id video.video_id %}" hx-trigger="click" hx-target="#video-notes">Notes</button>
  59. <button class="btn btn-sm btn-dark mb-1" type="button" hx-get="{% url 'mark_video_favorite' playlist.playlist_id video.video_id %}" hx-target="#video-{{ forloop.counter }}-fav">
  60. <div id="video-{{ forloop.counter }}-fav">
  61. {% if video.is_favorite %}
  62. <i class="fas fa-heart"></i>
  63. {% else %}
  64. <i class="far fa-heart"></i>
  65. {% endif %}
  66. </div>
  67. </button>
  68. {% if playlist.marked_as == "watching" %}
  69. <button class="btn btn-sm btn-light mb-1" type="button">
  70. <i class="far fa-check-circle"></i>
  71. </button>
  72. {% endif %}
  73. </div>
  74. {% endif %}
  75. </li>
  76. {% endfor %}
  77. {% else %}
  78. <h3>{{ display_text }}</h3>
  79. {% endif %}
  80. </div>