videos.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 %}
  8. <li class="list-group-item d-flex justify-content-between align-items-center bg-transparent" style="background-color: #40B3A2">
  9. {% if video.is_unavailable_on_yt and not video.was_deleted_on_yt %}
  10. <div class="d-flex justify-content-between align-items-center">
  11. <div>
  12. <input class="video-checkboxes" style="display: none" type="checkbox" value="{{ video.video_id }}" name="video-id">
  13. </div>
  14. <div class="ms-4" style="max-width: 115px; max-height: 100px;">
  15. <img src="https://i.ytimg.com/vi/9219YrnwDXE/maxresdefault.jpg" class="img-fluid" alt="">
  16. </div>
  17. <div class="ms-4">
  18. <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
  19. {{ video.video_position }}. {{ video.name }}
  20. </a>
  21. <br><br>
  22. </div>
  23. </div>
  24. {% else %}
  25. <div class="d-flex justify-content-between align-items-center" >
  26. <div>
  27. <input class="video-checkboxes" style="display: none" type="checkbox" value="{{ video.video_id }}" name="video-id">
  28. </div>
  29. <div class="ms-4" style="max-width: 115px; max-height: 100px;">
  30. <img src="{% if video.thumbnail_url %}{{ video.thumbnail_url }}{% else %}https://i.ytimg.com/vi/9219YrnwDXE/maxresdefault.jpg{% endif %}" class="img-fluid" alt="">
  31. </div>
  32. <div class="ms-4">
  33. {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}
  34. {{ video.video_position }}.
  35. <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
  36. {{ video.name|truncatewords:"16" }}
  37. </a>
  38. <br>
  39. <span class="badge bg-dark">VIDEO UNAVAILABLE</span>
  40. {% if video.video_details_modified %}<span class="badge bg-danger">UPDATED - {% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}NEWLY ADDED{% endif %}</span>{% endif %}
  41. <br><br>
  42. {% else %}
  43. {{ video.video_position }}.
  44. <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
  45. {{ video.name|truncatewords:"16" }}
  46. </a> by {{ video.channel_name }} <br>
  47. <span class="badge bg-secondary">{{ video.duration }}</span>
  48. {% if video.has_cc %}<span class="badge bg-secondary">CC</span>{% endif %}
  49. {% if video.published_at %}<span class="badge bg-secondary">{{ video.published_at }}</span>{% endif %}
  50. {% if video.view_count %}<span class="badge bg-info">{{ video.view_count|intword|intcomma }} views</span>{% endif %}
  51. {% if video.is_duplicate %}<span class="badge bg-primary">duplicate</span>{% endif %}
  52. {% if video.video_details_modified %}<span class="badge bg-danger">UPDATED - {% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}NEWLY ADDED{% endif %}</span>{% endif %}<br>
  53. <br>
  54. {% endif %}
  55. </div>
  56. </div>
  57. <div class="ms-5">
  58. {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}
  59. <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>
  60. <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">
  61. <div id="video-{{ forloop.counter }}-fav">
  62. {% if video.is_favorite %}
  63. <i class="fas fa-heart"></i>
  64. {% else %}
  65. <i class="far fa-heart"></i>
  66. {% endif %}
  67. </div>
  68. </button>
  69. {% else %}
  70. <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>
  71. <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
  72. <button class="copy-btn btn btn-sm btn-success mb-1" data-clipboard-target="#video-{{ video.video_id }}">
  73. <i class="far fa-copy" aria-hidden="true"></i>
  74. </button>
  75. <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>
  76. <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>
  77. <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">
  78. <div id="video-{{ forloop.counter }}-fav">
  79. {% if video.is_favorite %}
  80. <i class="fas fa-heart"></i>
  81. {% else %}
  82. <i class="far fa-heart"></i>
  83. {% endif %}
  84. </div>
  85. </button>
  86. {% if playlist.marked_as == "watching" %}
  87. <button class="btn btn-sm btn-light mb-1" type="button">
  88. <i class="far fa-check-circle"></i>
  89. </button>
  90. {% endif %}
  91. {% endif %}
  92. </div>
  93. {% endif %}
  94. </li>
  95. {% endfor %}
  96. {% else %}
  97. <h3>{{ display_text }}</h3>
  98. {% endif %}
  99. </div>