favorites.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. {% extends 'base.html' %}
  2. {% load humanize %}
  3. {% block content %}
  4. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  5. <h1 class="h2">Favorite Playlists
  6. <span class="badge bg-primary rounded-pill">{{ playlists.count|default:"0" }}</span>
  7. {% if playlists %}
  8. <a href="{% url 'all_playlists' 'favorites' %}" style="text-decoration: none; color: black"><i class="fas fa-search"></i></a>
  9. {% endif %}
  10. </h1>
  11. </div>
  12. <div>
  13. <div class="row row-cols-1 row-cols-md-3 g-4">
  14. {% if playlists %}
  15. {% for playlist in playlists %}
  16. <div class="col">
  17. <div class="card" style="background-color: #515355;">
  18. <div style="background-color: #1A4464;" class="list-group-item list-group-item-action" aria-current="true">
  19. <div class="card-body">
  20. <h5 class="card-title text-white">
  21. <a style="text-decoration: none; color: white" href="{% url 'playlist' playlist.playlist_id %}">{{ playlist.name }}</a>
  22. </h5>
  23. <p class="card-text text-uppercase">
  24. {% if playlist.is_user_owned %}<span class="badge bg-light text-black-50">OWNED</span>{% else %}<span class="badge bg-light text-black-50">IMPORTED</span>{% endif %}
  25. {% if playlist.is_private_on_yt %}<span class="badge bg-secondary text-white">Private</span> {% endif %}
  26. <span class="badge bg-warning text-black-50">{{ playlist.video_count }} videos</span>
  27. <span class="badge bg-dark text-white-50">{{ playlist.playlist_duration }} </span>
  28. {% if playlist.is_from_yt %}<span class="badge bg-danger text-black-50">YT</span> {% endif %}
  29. {% if playlist.marked_as == "watching" %}<span class="badge bg-primary text-white">WATCHING</span>{% endif %}
  30. </p>
  31. {% if playlist.tags.all %}
  32. <p class="card-text">
  33. <span class="d-flex justify-content-start flex-wrap">
  34. <small>
  35. <span style="color: #eed868;" class="me-lg-1 mb-lg-1">
  36. <i class="fas fa-tags"></i>
  37. </span>
  38. </small>
  39. {% for tag in playlist.tags.all %}
  40. <span class="badge rounded-pill bg-info mb-lg-1 me-lg-1 text-black-50">
  41. {{ tag.name }}
  42. </span>
  43. {% endfor %}
  44. </span>
  45. </p>
  46. {% endif %}
  47. <span class="d-flex justify-content-center">
  48. <a href="https://www.youtube.com/playlist?list={{ playlist.playlist_id }}" class="btn btn-info me-1" target="_blank" id="share_link" style=""><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
  49. <button class="btn btn-dark" type="button" hx-get="{% url 'mark_playlist_as' playlist.playlist_id 'favorite' %}" hx-target="#playlist-{{ forloop.counter }}-fav">
  50. <div id="playlist-{{ forloop.counter }}-fav">
  51. {% if playlist.is_favorite %}
  52. <i class="fas fa-star" style="color: #fafa06"></i>
  53. {% else %}
  54. <i class="far fa-star"></i>
  55. {% endif %}
  56. </div>
  57. </button>
  58. </span>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. {% endfor %}
  64. {% else %}
  65. <h5 class="text-dark align-content-center">No playlists marked favorite :(</h5>
  66. {% endif %}
  67. </div>
  68. </div>
  69. <br>
  70. <br>
  71. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  72. <h1 class="h2">Favorite Videos
  73. <span class="badge bg-primary rounded-pill">{{ videos.count }}</span>
  74. {% if videos %}
  75. <a href="{% url 'all_playlists' 'favorites' %}" style="text-decoration: none; color: black"><i class="fas fa-search"></i></a>
  76. {% endif %}
  77. </h1>
  78. </div>
  79. <div>
  80. <div class="row row-cols-1 row-cols-md-3 g-4">
  81. {% if videos %}
  82. {% for video in videos %}
  83. <div class="col">
  84. <div class="card" style="max-width: 540px; background-color: #1A4464;">
  85. <div class="row g-0">
  86. <div class="col-md-4">
  87. <img src="{{ video.thumbnail_url }}" class="img-fluid rounded-3" style=" width: 100%; height: 15vw; object-fit: cover;">
  88. </div>
  89. <div class="col-md-8">
  90. <div class="card-body">
  91. <h5 class="card-title"><a href="{% url 'video' video.video_id %}" style="text-decoration: none; color: white"> {{ video.name|truncatewords:"15" }}</a></h5>
  92. <h5 class="card-text">
  93. <small>
  94. <span class="badge bg-dark text-white-50">{{ video.duration }}</span>
  95. {% if video.is_unavailable_on_yt %}<span class="badge bg-light text-dark">Private</span>{% endif %}
  96. {% if video.has_cc %}<span class="badge bg-danger text-dark">CC</span>{% endif %}
  97. <span class="badge bg-info text-black-50"><i class="fas fa-eye"></i> {% if video.view_count == -1 %}HIDDEN{% else %}{{ video.view_count|intword|intcomma }}{% endif %}</span>
  98. <span class="badge bg-warning text-black-50"><i class="fas fa-thumbs-up"></i> {% if video.like_count == -1 %}HIDDEN{% else %}{{ video.like_count|intword|intcomma }}{% endif %}</span>
  99. </small>
  100. </h5>
  101. <span class="card-text d-flex justify-content-start">
  102. <a href="https://www.youtube.com/watch?v={{ video.video_id }}" class="btn btn-info me-1" target="_blank" id="share_link" style=""><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
  103. <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
  104. <button class="copy-btn btn btn-success me-1" data-clipboard-target="#video-{{ video.video_id }}">
  105. <i class="far fa-copy" aria-hidden="true"></i>
  106. </button>
  107. <button class="btn btn-dark" type="button" hx-get="{% url 'mark_video_favorite' video.video_id %}" hx-target="#video-{{ forloop.counter }}-fav">
  108. <div id="video-{{ forloop.counter }}-fav">
  109. {% if video.is_favorite %}
  110. <i class="fas fa-heart" style="color: #fafa06"></i>
  111. {% else %}
  112. <i class="far fa-heart"></i>
  113. {% endif %}
  114. </div>
  115. </button>
  116. </span>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. <!--
  122. <div class="card" style="background-color: #1A4464;">
  123. <div class="card-body">
  124. <h5 class="card-title text-light">
  125. <a href="{% url 'video' video.video_id %}" style="text-decoration: none; color: white"> {{ video.name|truncatewords:"15" }}</a><br>
  126. <small>
  127. <span class="badge bg-dark text-white-50">{{ video.duration }}</span>
  128. </small>
  129. {% if video.is_unavailable_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  130. {% if video.has_cc %}<small><span class="badge bg-danger text-dark">CC</span></small> {% endif %}
  131. </h5>
  132. <br>
  133. <span class="d-flex justify-content-center">
  134. <a href="https://www.youtube.com/watch?v={{ video.video_id }}" class="btn btn-info me-1" target="_blank" id="share_link" style=""><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
  135. <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
  136. <button class="copy-btn btn btn-success me-1" data-clipboard-target="#video-{{ video.video_id }}">
  137. <i class="far fa-copy" aria-hidden="true"></i>
  138. </button>
  139. <button class="btn btn-dark" type="button" hx-get="{% url 'mark_video_favorite' video.video_id %}" hx-target="#video-{{ forloop.counter }}-fav">
  140. <div id="video-{{ forloop.counter }}-fav">
  141. {% if video.is_favorite %}
  142. <i class="fas fa-heart" style="color: #fafa06"></i>
  143. {% else %}
  144. <i class="far fa-heart"></i>
  145. {% endif %}
  146. </div>
  147. </button>
  148. </span>
  149. </div>
  150. </div>
  151. -->
  152. </div>
  153. {% endfor %}
  154. {% else %}
  155. <h5 class="text-dark align-content-center">Nothing favorites :(</h5>
  156. {% endif %}
  157. </div>
  158. </div>
  159. {% endblock %}