playlist_items.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. {% load humanize %}
  2. {% if videos_details and playlist_items %}
  3. <h4 class="mt-3 mb-3"><span class="badge bg-dark text-white">{{ videos_details }}, Results: {{ playlist_items.count }}</span></h4>
  4. {% endif %}
  5. <div class="list-group" id="video-checkboxes">
  6. {% if playlist_items %}
  7. {% for playlist_item in playlist_items|slice:"0:50" %}
  8. <li id="{{ playlist_item.playlist_item_id }}" onclick="selectVideo(this);" {% if forloop.last and playlist_items.count > 50 %}hx-get="{% url 'load_more_videos' playlist.playlist_id order_by|default:"all" 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 playlist_item.video.is_unavailable_on_yt and not playlist_item.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="{{ playlist_item.video.video_id }}" id="video-{{ playlist_item.playlist_item_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. {{ playlist_item.video_position|add:"1" }}.
  21. <a class="link-dark" href="{% url 'video' playlist_item.video.video_id %}">
  22. {{ playlist_item.video.name }}
  23. </a>
  24. <br><br>
  25. </div>
  26. </div>
  27. {% else %}
  28. <div class="d-flex justify-content-between align-items-center" >
  29. <div>
  30. <input class="video-checkboxes" style="display: none" type="checkbox" value="{{ playlist_item.video.video_id }}" id="video-{{ playlist_item.playlist_item_id }}" name="video-id">
  31. </div>
  32. <div class="ms-4" style="max-width: 115px; max-height: 100px;">
  33. <img src="{% if playlist_item.video.thumbnail_url %}{{ playlist_item.video.thumbnail_url }}{% else %}https://i.ytimg.com/vi/9219YrnwDXE/maxresdefault.jpg{% endif %}" class="img-fluid" alt="">
  34. </div>
  35. <div class="ms-4">
  36. {% if playlist_item.video.is_unavailable_on_yt or playlist_item.video.was_deleted_on_yt %}
  37. {{ playlist_item.video_position|add:"1" }}.
  38. <a class="link-dark" href="{% url 'video' playlist_item.video.video_id %}">
  39. {{ playlist_item.video.name|truncatewords:"16" }}
  40. </a>
  41. <br>
  42. <span class="badge bg-dark">VIDEO UNAVAILABLE</span>
  43. {% if playlist_item.video.video_details_modified %}<span class="badge bg-danger">{% if playlist_item.video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}ADDED{% endif %} {{ playlist_item.video.updated_at|naturaltime|upper }}</span>{% endif %}
  44. <br><br>
  45. {% else %}
  46. {{ playlist_item.video_position|add:"1" }}.
  47. <a class="link-dark" href="{% url 'video' playlist_item.video.video_id %}">
  48. {{ playlist_item.video.name|truncatewords:"16" }}
  49. </a> by <a href="{% url 'search' %}?mode=videos&channel={{ playlist_item.video.channel_name }}" style="text-decoration: none; color: black"><span style="border-bottom: 3px #e35959 dashed;"> {{ playlist_item.video.channel_name }}</span></a> <br>
  50. <a style="text-decoration: none" hx-get="{% url 'video_completion_times' playlist_item.video.video_id %}" hx-trigger="click once" hx-target="#{{ playlist_item.playlist_item_id }}-completion-times" data-bs-toggle="collapse" href="#{{ playlist_item.playlist_item_id }}DurationCollapse" role="button" aria-expanded="false" aria-controls="{{ playlist_item.playlist_item_id }}DurationCollapse">
  51. <span class="badge bg-secondary">{{ playlist_item.video.duration }}</span>
  52. </a>
  53. <div class="collapse" id="{{ playlist_item.playlist_item_id }}DurationCollapse">
  54. <div class="card card-body bg-dark text-white text-capitalize border border-3 mt-2 mb-2 border-light">
  55. <div id="{{ playlist_item.playlist_item_id }}-completion-times">
  56. </div>
  57. </div>
  58. </div>
  59. {% if playlist_item.video.has_cc %}<span class="badge bg-secondary">CC</span>{% endif %}
  60. {% if playlist_item.published_at %}<span class="badge bg-secondary">added to playlist on {{ playlist_item.published_at }}</span>{% endif %}
  61. <span class="badge bg-info text-black-50"><i class="fas fa-eye"></i> {% if playlist_item.video.view_count == -1 %}HIDDEN{% else %}{{ playlist_item.video.view_count|intword|intcomma }}{% endif %}</span>
  62. <span class="badge bg-warning text-black-50"><i class="fas fa-thumbs-up"></i> {% if playlist_item.video.like_count == -1 %}HIDDEN{% else %}{{ playlist_item.video.like_count|intword|intcomma }}{% endif %}</span>
  63. {% if playlist_item.video.playlists.count|add:"-1" != 0 %}<span class="badge bg-dark"><a href="{% url 'video' playlist_item.video.video_id %}#found-in" style="text-decoration: none; color: white">found in {{ playlist_item.video.playlists.count|add:"-1" }} other playlist{% if playlist_item.video.playlists.count|add:"-1" > 1 %}s{% endif %}</a></span>{% endif %}
  64. {% if playlist_item.video.video_details_modified %}<span class="badge bg-danger">{% if playlist_item.video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}ADDED{% endif %} {{ playlist_item.video.created_at|naturaltime|upper }}</span>{% endif %}<br>
  65. <br>
  66. {% endif %}
  67. </div>
  68. </div>
  69. <div class="ms-5">
  70. {% if playlist_item.video.is_unavailable_on_yt or playlist_item.video.was_deleted_on_yt %}
  71. <a class="btn btn-sm btn-primary mb-1" href="{% url 'video' playlist_item.video.video_id %}"><i class="fas fa-info"></i></a>
  72. <button title="Mark or unmark video favorite!" class="btn btn-sm btn-dark mb-1" type="button" hx-get="{% url 'mark_video_favorite' playlist_item.video.video_id %}"
  73. hx-target="#video-{{ page }}-{{ forloop.counter }}-fav">
  74. <div id="video-{{ page }}-{{ forloop.counter }}-fav">
  75. {% if playlist_item.video.is_favorite %}
  76. <i class="fas fa-heart" style="color: #fafa06"></i>
  77. {% else %}
  78. <i class="far fa-heart"></i>
  79. {% endif %}
  80. </div>
  81. </button>
  82. <button title="Mark or unmark video as plan to watch!" class="btn btn-sm btn-dark mb-1" type="button" hx-get="{% url 'mark_video_planned_to_watch' playlist_item.video.video_id %}" hx-target="#video-{{ forloop.counter }}-planned">
  83. <div id="video-{{ forloop.counter }}-planned">
  84. {% if playlist_item.video.is_planned_to_watch %}
  85. <i class="fas fa-clock" style="color: #000000"></i>
  86. {% else %}
  87. <i class="far fa-clock"></i>
  88. {% endif %}
  89. </div>
  90. </button>
  91. {% else %}
  92. <a class="btn btn-sm btn-info mb-1" type="button" href="https://www.youtube.com/watch?v={{ playlist_item.video.video_id }}&list={{ playlist.playlist_id }}" class="btn btn-info me-1" target="_blank"><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
  93. <input class="form-control me-1 visually-hidden" id="video-{{ page }}-{{ playlist_item.video.video_id }}" value="https://www.youtube.com/watch?v={{ playlist_item.video.video_id }}">
  94. <button class="copy-btn btn btn-sm btn-success mb-1" data-clipboard-target="#video-{{ page }}-{{ playlist_item.video.video_id }}">
  95. <i class="far fa-copy" aria-hidden="true"></i>
  96. </button>
  97. <a class="btn btn-sm btn-primary mb-1" href="{% url 'video' playlist_item.video.video_id %}"><i class="fas fa-info"></i></a>
  98. <button title="Mark or unmark video as favorite!" class="btn btn-sm btn-dark mb-1" type="button" hx-get="{% url 'mark_video_favorite' playlist_item.video.video_id %}" hx-target="#video-{{ page }}-{{ forloop.counter }}-fav">
  99. <div id="video-{{ page }}-{{ forloop.counter }}-fav">
  100. {% if playlist_item.video.is_favorite %}
  101. <i class="fas fa-heart" style="color: #fafa06"></i>
  102. {% else %}
  103. <i class="far fa-heart"></i>
  104. {% endif %}
  105. </div>
  106. </button>
  107. {% if not playlist_item.is_duplicate %}
  108. <button title="Mark or unmark video as plan to watch!" class="btn btn-sm btn-dark mb-1" type="button" hx-get="{% url 'mark_video_planned_to_watch' playlist_item.video.video_id %}" hx-target="#video-{{ forloop.counter }}-planned">
  109. <div id="video-{{ forloop.counter }}-planned">
  110. {% if playlist_item.video.is_planned_to_watch %}
  111. <i class="fas fa-clock" style="color: #000000"></i>
  112. {% else %}
  113. <i class="far fa-clock"></i>
  114. {% endif %}
  115. </div>
  116. </button>
  117. {% endif %}
  118. {% if playlist.marked_as == "watching" and not playlist_item.is_duplicate %}
  119. <button title="Mark or unmark video as watched!" class="btn btn-sm btn-light mb-1" type="button" hx-get="{% url 'mark_video_watched' playlist.playlist_id playlist_item.video.video_id %}" hx-target="#video-{{ page }}-{{ forloop.counter }}-watched">
  120. <div id="video-{{ page }}-{{ forloop.counter }}-watched">
  121. {% if playlist_item.video.is_marked_as_watched %}
  122. <i class="fas fa-check-circle"></i>
  123. {% else %}
  124. <i class="far fa-check-circle"></i>
  125. {% endif %}
  126. </div>
  127. </button>
  128. {% endif %}
  129. {% endif %}
  130. </div>
  131. {% endif %}
  132. </li>
  133. {% endfor %}
  134. {% else %}
  135. <h3 class="mt-3">{{ display_text }}</h3>
  136. {% endif %}
  137. </div>