playlists.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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:"#c2c68f" }};">
  6. <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">
  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: black">{{ 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-muted">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:"#4790c7" }};">
  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.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"><a href="{% url 'playlist' playlist.playlist_id %}" style="text-decoration: none; color: black">{{ playlist.name }}</a></h5>
  27. <p class="card-text text-uppercase">
  28. {% 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 %}
  29. {% if playlist.is_private_on_yt %}<span class="badge bg-secondary text-white">Private</span> {% endif %}
  30. <span class="badge bg-warning text-black-50">{{ playlist.video_count }} videos</span>
  31. <span class="badge bg-dark text-white">{{ playlist.playlist_duration }} </span>
  32. {% if playlist.is_from_yt %}<span class="badge bg-danger text-black-50">YT</span> {% endif %}
  33. {% if playlist.marked_as == "watching" %}<span class="badge bg-primary text-white">WATCHING</span>{% endif %}
  34. </p>
  35. {% if show_tags|default:True %}
  36. {% if playlist.tags.all %}
  37. <p class="card-text">
  38. <span class="d-flex justify-content-start flex-wrap">
  39. <small>
  40. <span style="color: #eed868;" class="me-lg-1 mb-lg-1">
  41. <i class="fas fa-tags"></i>
  42. </span>
  43. </small>
  44. {% for tag in playlist.tags.all %}
  45. <span class="badge rounded-pill bg-info mb-lg-1 me-lg-1 text-black-50">
  46. {{ tag.name }}
  47. </span>
  48. {% endfor %}
  49. </span>
  50. </p>
  51. {% endif %}
  52. {% endif %}
  53. {% if show_controls %}
  54. <span class="d-flex justify-content-center">
  55. <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>
  56. <button class="btn btn-dark" type="button" hx-get="{% url 'mark_playlist_as' playlist.playlist_id 'favorite' %}" hx-target="#playlist-{{ forloop.counter }}-fav">
  57. <div id="playlist-{{ forloop.counter }}-fav">
  58. {% if playlist.is_favorite %}
  59. <i class="fas fa-star" style="color: #fafa06"></i>
  60. {% else %}
  61. <i class="far fa-star"></i>
  62. {% endif %}
  63. </div>
  64. </button>
  65. </span>
  66. {% endif %}
  67. </div>
  68. </div>
  69. </div>
  70. {% endfor %}
  71. <!-- minified version
  72. {% for playlist in playlists %}
  73. <div class="col">
  74. <div class="card" style="background-color: #515355;">
  75. <a style="background-color: #1A4464;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  76. <div class="card-body">
  77. <h5 class="card-title text-white">
  78. {{ playlist.name }}
  79. </h5>
  80. <p class="card-text">
  81. {% if playlist.is_user_owned %}<small><span class="badge bg-light text-black-50">OWNED</span></small>{% else %}<small><span class="badge bg-light text-black-50">IMPORTED</span></small>{% endif %}
  82. {% if playlist.is_private_on_yt %}<small><span class="badge bg-secondary text-white">Private</span></small> {% endif %}
  83. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-black-50">YT</span></small> {% endif %}
  84. {% if playlist.marked_as == "watching" %}<small><span class="badge bg-primary text-white">WATCHING</span></small>{% endif %}
  85. </p>
  86. {% if playlist.tags.all %}
  87. <p class="card-text">
  88. <span class="d-flex justify-content-start flex-wrap">
  89. <small>
  90. <span style="color: #eed868;" class="me-lg-1 mb-lg-1">
  91. <i class="fas fa-tags"></i>
  92. </span>
  93. </small>
  94. {% for tag in playlist.tags.all %}
  95. <span class="badge rounded-pill bg-info mb-lg-1 me-lg-1 text-black-50">
  96. {{ tag.name }}
  97. </span>
  98. {% endfor %}
  99. </span>
  100. </p>
  101. {% endif %}
  102. <small>
  103. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  104. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  105. </small>
  106. </div>
  107. </a>
  108. </div>
  109. </div>
  110. {% endfor %}
  111. -->
  112. {% endif %}