playlists.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. {% load humanize %}
  2. {% if watching %}
  3. {% for playlist in playlists %}
  4. <div class="col">
  5. <div class="card overflow-auto" style="background-color: {{ bg_color|default:"#357779" }};">
  6. <img class="bd-placeholder-img card-img-top" src="{{ playlist.get_playlist_thumbnail_url }}" style="max-width:100%; height: 200px; object-fit: cover;" alt="{{ playlist.name }} thumbnail">
  7. <div class="card-body">
  8. <h5 class="card-title"><a href="{% url 'playlist' playlist.playlist_id %}" class="stretched-link" style="text-decoration: none; color: white">{{ playlist.name }}</a></h5>
  9. <p class="card-text">
  10. <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>
  11. {% if playlist.get_watch_time_left != "0secs." %}<span class="badge bg-dark text-white">{{ playlist.get_watch_time_left }} left</span>{% endif %}
  12. </p>
  13. <p class="card-text"><small class="text-white-50">Last watched {{ playlist.last_watched|naturaltime }}</small></p>
  14. </div>
  15. </div>
  16. </div>
  17. {% endfor %}
  18. {% else %}
  19. {% for playlist in playlists %}
  20. <div class="col">
  21. <div class="card overflow-auto" style="background-color: {{ bg_color|default:"#357779" }};">
  22. <a href="{% url 'playlist' playlist.playlist_id %}" style="text-decoration: none; color: black">
  23. <img class="bd-placeholder-img card-img-top" src="{{ playlist.get_playlist_thumbnail_url }}" style="max-width:100%; height: 200px; object-fit: cover;" alt="{{ playlist.name }} thumbnail">
  24. </a>
  25. <div class="card-body">
  26. <h5 class="card-title">
  27. <a href="{% url 'playlist' playlist.playlist_id %}" style="text-decoration: none; color: white">
  28. {% if playlist.user_label %}
  29. <span style="border-bottom: 3px #eeeaea dashed;">{{ playlist.user_label }}</span>
  30. {% else %}
  31. {{ playlist.name }}
  32. {% endif %}
  33. </a>
  34. </h5>
  35. <p class="card-text text-uppercase">
  36. {% 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 %}
  37. {% if playlist.is_private_on_yt %}<span class="badge bg-secondary text-white">Private</span> {% endif %}
  38. <span class="badge bg-warning text-black-50">{{ playlist.video_count }} videos</span>
  39. <span class="badge bg-dark text-white">{{ playlist.playlist_duration }} </span>
  40. {% if playlist.is_from_yt %}<span class="badge bg-danger text-black-50">YT</span> {% endif %}
  41. {% if playlist.marked_as == "watching" %}<span class="badge bg-primary text-white">WATCHING</span>{% endif %}
  42. </p>
  43. {% if show_tags|default:True %}
  44. {% if playlist.tags.all %}
  45. <p class="card-text">
  46. <span class="d-flex justify-content-start flex-wrap">
  47. <small>
  48. <span style="color: #eed868;" class="me-lg-1 mb-lg-1">
  49. <i class="fas fa-tags"></i>
  50. </span>
  51. </small>
  52. {% for tag in playlist.tags.all|slice:"0:4" %}
  53. <span class="badge rounded-pill bg-info mb-lg-1 me-lg-1 text-black-50">
  54. {{ tag.name }}
  55. </span>
  56. {% if forloop.last and playlist.tags.all.count > 4 %}
  57. <small><span class="text-black-50"> & {{ playlist.tags.all.count|add:"-4" }} more</span></small>
  58. {% endif %}
  59. {% endfor %}
  60. </span>
  61. </p>
  62. {% endif %}
  63. {% endif %}
  64. {% if show_controls %}
  65. <span class="d-flex justify-content-center">
  66. <a href="https://www.youtube.com/playlist?list={{ playlist.playlist_id }}" class="btn btn-light me-1" target="_blank" id="share_link" style=""><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
  67. <button class="btn btn-dark" type="button" hx-get="{% url 'mark_playlist_as' playlist.playlist_id 'favorite' %}" hx-target="#playlist-{{ forloop.counter }}-fav">
  68. <div id="playlist-{{ forloop.counter }}-fav">
  69. {% if playlist.is_favorite %}
  70. <i class="fas fa-star" style="color: #fafa06"></i>
  71. {% else %}
  72. <i class="far fa-star"></i>
  73. {% endif %}
  74. </div>
  75. </button>
  76. </span>
  77. {% endif %}
  78. </div>
  79. </div>
  80. </div>
  81. {% endfor %}
  82. {% endif %}