view_video.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. {% extends 'base.html' %}
  2. {% load humanize %}
  3. {% load static %}
  4. {% block content %}
  5. <script src="{% static 'htmx/extensions/class-tools.js' %}" type="application/javascript"></script>
  6. <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
  7. <div id="view_video">
  8. {% if playlist.has_playlist_changed %}
  9. {% else %}
  10. <div class="card text-white bg-dark" style="max-width: 100%;">
  11. <div class="row g-0">
  12. <div class="col-md-4 p-3">
  13. <img class="img-fluid rounded-3" src="{{ video.thumbnail_url }}" style="max-width:100%; height: auto; object-fit: cover;">
  14. </div>
  15. <div class="col-md-8">
  16. <div class="card-body">
  17. <div class="d-flex justify-content-between">
  18. <h2 class="card-title text-white">
  19. <a href="https://www.youtube.com/watch?v={{ video.video_id }}" target="_blank" style="color: white; text-decoration: none">{{ video.name }}</a>
  20. <br><small class="h4">{% if video.user_label %}a.k.a <span style="border-bottom: 3px #ffffff dashed;"> {{ video.user_label }}</span>{% endif %}</small>
  21. </h2>
  22. <h4>
  23. <span id="notice-div">
  24. {% if video.is_marked_as_watched %}
  25. <span class="badge bg-success text-white" >
  26. <i class="fas fa-flag-checkered me-1"></i> marked watched
  27. </span>
  28. {% endif %}
  29. </span>
  30. <span id="">
  31. <span class="badge bg-dark">
  32. <i class="fas fa-map-pin"></i>
  33. </span>
  34. </span>
  35. </h4>
  36. </div>
  37. <h6>by {{ video.channel_name }}</h6>
  38. <p class="card-text">
  39. {% if video.description %}
  40. <h5 class="overflow-auto" style="max-height: 350px;">
  41. {{ video.description|linebreaksbr|urlize }}
  42. </h5>
  43. {% else %}
  44. <h5>No description</h5>
  45. {% endif %}
  46. </p>
  47. <h6 class="h5 text-uppercase overflow-auto text-black-50">
  48. <span class="badge bg-success mb-1">{{ video.duration }}</span>
  49. {% if video.has_cc %}<span class="badge bg-danger mb-1">CC</span>{% endif %}
  50. {% if video.published_at %}<span class="badge bg-secondary mb-1">Video uploaded on {{ video.published_at }}</span>{% endif %}
  51. <span class="badge bg-primary text-white mb-1"><i class="fas fa-eye"></i> {% if video.view_count == -1 %}HIDDEN{% else %}{{ video.view_count|intcomma }}{% endif %}</span>
  52. <span class="badge bg-warning text-black-50 mb-1"><i class="fas fa-thumbs-up"></i> {% if video.like_count == -1 %}HIDDEN{% else %}{{ video.like_count|intcomma }}{% endif %}</span>
  53. <span class="badge bg-warning text-black-50 mb-1"><i class="fas fa-thumbs-down"></i> {% if video.dislike_count == -1 %}HIDDEN{% else %}{{ video.dislike_count|intcomma }}{% endif %}</span>
  54. <span class="badge bg-info text-black-50 mb-1"><i class="fas fa-comments"></i> {% if video.comment_count == -1 %}HIDDEN{% else %}{{ video.comment_count|intcomma }}{% endif %} </span>
  55. {% if video.is_unavailable_on_yt or video.was_deleted_on_yt %}<span class="badge bg-light text-black-50 mb-1">UNAVAILABLE</span>{% endif %}
  56. <span class="badge bg-light text-black-50 mb-1"><a href="#found-in" style="text-decoration: none; color: grey"> Found in {{ video.playlistitem_set.count }} playlist{% if video.playlistitem_set.count > 1 %}s{% endif %}</a></span>
  57. </h6>
  58. <p class="card-text text-white-50"><small>Last updated {{ video.video_details_modified_at|naturalday }}</small> &bullet; <small>{{ video.num_of_accesses }} clicks </small></p> </div>
  59. </div>
  60. </div>
  61. </div>
  62. <br>
  63. {% endif %}
  64. </div>
  65. <div class="row">
  66. <div class="col-6">
  67. <iframe width="100%" height="100%" src="//www.youtube.com/embed/{{ video.video_id }}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
  68. </div>
  69. <div class="col-6">
  70. <div class="row">
  71. <div class="col-6">
  72. <h4>Your notes for this video
  73. </h4>
  74. </div>
  75. <div class="col d-flex justify-content-end pt-2">
  76. <span id="notes-save-status" class="text-success">
  77. </span>
  78. </div>
  79. </div>
  80. <div >
  81. <textarea name="video-notes-text-area"
  82. hx-post="{% url 'video_notes' video.video_id %}"
  83. hx-trigger="keyup changed delay:2s"
  84. hx-target="#notes-save-status"
  85. class="form-control"
  86. id="video-notes-text-area"
  87. placeholder="Enter here"
  88. rows="13">
  89. {{ video.user_notes }}
  90. </textarea>
  91. <div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. <br>
  97. <div class="">
  98. <h3><span style="border-bottom: 3px #497ce2 dashed;">Video found in the following playlist{% if video.playlists.all.count > 1 %}s{% endif %}</span><i class="fas fa-binoculars ms-2" style="color: #4669d2"></i></h3>
  99. <div id="found-in" class="row row-cols-1 row-cols-md-4 g-4 text-dark mt-0" data-masonry='{"percentPosition": true }'>
  100. {% for playlist in video.playlists.all %}
  101. <div class="col">
  102. <div class="card" style="background-color: #EFEFEF;">
  103. <img class="bd-placeholder-img card-img-top" src="{{ playlist.thumbnail_url }}" style="max-width:100%; height: 200px; object-fit: cover;" alt="{{ playlist.name }} thumbnail">
  104. <div class="card-body">
  105. <h5 class="card-title"><a href="{% url 'playlist' playlist.playlist_id %}" class="stretched-link" style="text-decoration: none; color: black">{{ playlist.name }}</a></h5>
  106. <p class="card-text">
  107. <span class="badge bg-{% if playlist.get_watch_time_left == "0secs." %}success{% else %}primary{% endif %} text-white">{{ playlist.get_watched_videos_count }}/{{ playlist.get_watchable_videos_count }} viewed</span>
  108. {% if playlist.get_watch_time_left != "0secs." %}<span class="badge bg-dark text-white">{{ playlist.get_watch_time_left }} left</span>{% endif %}
  109. </p>
  110. <p class="card-text">
  111. {% if playlist.tags.all %}
  112. <small>
  113. <i class="fas fa-tags fa-sm" style="color: black"></i>
  114. {% for tag in playlist.tags.all %}
  115. <span class="badge rounded-pill bg-primary mb-lg-1">
  116. {{ tag.name }}
  117. </span>
  118. {% endfor %}
  119. </small>
  120. {% endif %}
  121. </p>
  122. <p class="card-text"><small class="text-muted">Last watched {{ playlist.last_watched|naturalday }}</small></p>
  123. </div>
  124. </div>
  125. </div>
  126. <!--
  127. <div class="col">
  128. <div class="card">
  129. <a style="background-color: #7e89c2;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  130. <div class="card-body">
  131. <h5 class="card-title">
  132. {{ playlist.name }}
  133. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  134. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  135. </h5>
  136. <p class="card-text">
  137. <span class="badge bg-{% if playlist.get_watch_time_left == "0secs." %}success{% else %}primary{% endif %} text-white">{{ playlist.get_watched_videos_count }}/{{ playlist.get_watchable_videos_count }} viewed</span>
  138. {% if playlist.get_watch_time_left != "0secs." %}<span class="badge bg-dark text-white">{{ playlist.get_watch_time_left }} left</span>{% endif %}
  139. </p>
  140. {% if playlist.tags.all %}
  141. <small>
  142. <i class="fas fa-tags fa-sm" style="color: yellow"></i>
  143. {% for tag in playlist.tags.all %}
  144. <span class="badge rounded-pill bg-primary mb-lg-1">
  145. {{ tag.name }}
  146. </span>
  147. {% endfor %}
  148. </small>
  149. {% endif %}
  150. </div>
  151. </a>
  152. </div>
  153. </div> -->
  154. <!--
  155. {% if forloop.counter == 3 %}
  156. {% if watching.count|add:"-3" != 0 %}
  157. <div class="col">
  158. <div class="card">
  159. <a style="background-color: #7e89c2;" href="{% url 'all_playlists' 'watching' %}" class="list-group-item list-group-item-action" aria-current="true">
  160. <div class="card-body">
  161. <p class="card-text">
  162. <h3>+ {{ watching.count|add:"-3" }} more</h3>
  163. </p>
  164. </div>
  165. </a>
  166. </div>
  167. </div>
  168. {% endif %}
  169. {% endif %}
  170. -->
  171. {% endfor %}
  172. </div>
  173. </div>
  174. <script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
  175. <!-- Initialize Quill editor -->
  176. <script>
  177. var quill = new Quill('#editor', {
  178. theme: 'snow'
  179. });
  180. </script>
  181. {% endblock %}