videos.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {% load humanize %}
  2. {% if videos_details and videos.count != 0 %}
  3. <h4 class="mt-3 mb-3"><span class="badge bg-dark text-white">{{ videos_details }}, Results: {{ videos.count }}</span></h4>
  4. {% endif %}
  5. <div class="list-group" id="video-checkboxes">
  6. {% if videos %}
  7. {% for video in videos|slice:"0:50" %}
  8. <li {% if forloop.last and videos.count > 50 %}hx-get="{% url 'load_more_videos' playlist.playlist_id page|default:"1" %}"
  9. hx-trigger="revealed"
  10. hx-swap="afterend" hx-indicator="#load-more-videos-spinner"{% endif %} class="list-group-item d-flex justify-content-between align-items-center bg-transparent" 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. {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}
  36. {{ video.video_position }}.
  37. <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
  38. {{ video.name|truncatewords:"16" }}
  39. </a>
  40. <br>
  41. <span class="badge bg-dark">VIDEO UNAVAILABLE</span>
  42. {% if video.video_details_modified %}<span class="badge bg-danger">{% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}ADDED{% endif %} {{ video.updated_at|naturaltime|upper }}</span>{% endif %}
  43. <br><br>
  44. {% else %}
  45. {{ video.video_position }}.
  46. <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
  47. {{ video.name|truncatewords:"16" }}
  48. </a> by {{ video.channel_name }} <br>
  49. <span class="badge bg-secondary">{{ video.duration }}</span>
  50. {% if video.has_cc %}<span class="badge bg-secondary">CC</span>{% endif %}
  51. {% if video.published_at %}<span class="badge bg-secondary">{{ video.published_at }}</span>{% endif %}
  52. {% if video.view_count %}<span class="badge bg-info">{{ video.view_count|intword|intcomma }} views</span>{% endif %}
  53. {% if video.is_duplicate %}<span class="badge bg-primary">duplicate</span>{% endif %}
  54. {% if video.video_details_modified %}<span class="badge bg-danger">{% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}ADDED{% endif %} {{ video.created_at|naturaltime|upper }}</span>{% endif %}<br>
  55. <br>
  56. {% endif %}
  57. </div>
  58. </div>
  59. <div class="ms-5">
  60. {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}
  61. <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>
  62. <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">
  63. <div id="video-{{ forloop.counter }}-fav">
  64. {% if video.is_favorite %}
  65. <i class="fas fa-heart"></i>
  66. {% else %}
  67. <i class="far fa-heart"></i>
  68. {% endif %}
  69. </div>
  70. </button>
  71. {% else %}
  72. <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>
  73. <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
  74. <button class="copy-btn btn btn-sm btn-success mb-1" data-clipboard-target="#video-{{ video.video_id }}">
  75. <i class="far fa-copy" aria-hidden="true"></i>
  76. </button>
  77. <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"><i class="fas fa-info"></i></button>
  78. <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>
  79. <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">
  80. <div id="video-{{ forloop.counter }}-fav">
  81. {% if video.is_favorite %}
  82. <i class="fas fa-heart"></i>
  83. {% else %}
  84. <i class="far fa-heart"></i>
  85. {% endif %}
  86. </div>
  87. </button>
  88. {% if playlist.marked_as == "watching" %}
  89. <button class="btn btn-sm btn-light mb-1" type="button">
  90. <i class="far fa-check-circle"></i>
  91. </button>
  92. {% endif %}
  93. {% endif %}
  94. </div>
  95. {% endif %}
  96. </li>
  97. {% endfor %}
  98. {% else %}
  99. <h3>{{ display_text }}</h3>
  100. {% endif %}
  101. </div>