home.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. {% extends 'base.html' %}
  2. {% load humanize %}
  3. {% block content %}
  4. <br>
  5. {% if user.playlists.all.count == 0 %}
  6. <div class="alert alert-success" role="alert">
  7. <h4 class="alert-heading">It's empty in here</h4>
  8. <p>
  9. There's no playlists in your UnTube right now. You can change that by heading over to <a href="{% url 'manage_playlists' %}" class="btn btn-sm btn-primary">Manage</a> to import some public playlists into your UnTube.
  10. {% if not user.profile.imported_yt_playlists %}
  11. Or you could always head over to your <a href="{% url 'profile' %}" class="btn btn-sm btn-primary">Profile</a> to import all of your public/private YouTube playlists.
  12. {% else %}
  13. Keep in mind that your own YouTube playlists will automatically be imported into UnTube.
  14. {% endif %}
  15. </p>
  16. </div>
  17. {% endif %}
  18. {% if import_successful %}
  19. <br>
  20. <br>
  21. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  22. <h1>Welcome to UnTube, {{ user.username|capfirst }}</h1>
  23. </div>
  24. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  25. <h2>{{ user.playlists.all.count }} playlists from YouTube have been successfully imported.</h2>
  26. </div>
  27. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  28. <h3>You'll now be notified on the Dashboard whenever there's any new un-exported playlists on YouTube :)</h3>
  29. </div>
  30. <div class="d-flex justify-content-center pt-3 pb-2 mb-3">
  31. <a href="{% url 'home' %}" class="btn btn-lg btn-success">Go to Dashboard</a>
  32. </div>
  33. {% else %}
  34. {% if user.profile.imported_yt_playlists %}
  35. <div hx-get="{% url 'user_playlists_updates' 'check-for-updates' %}" hx-trigger="load" hx-swap="outerHTML">
  36. </div>
  37. {% endif %}
  38. {% if watching %}
  39. <div class="border border-5 rounded-3 border-primary p-3">
  40. <h3><span style="border-bottom: 3px #ffffff dashed;">Continue Watching</span><i class="fas fa-fire-alt ms-2" style="color: #d24646"></i></h3>
  41. <div class="row row-cols-1 row-cols-md-4 g-4 text-dark mt-0" data-masonry='{"percentPosition": true }'>
  42. {% for playlist in watching %}
  43. <div class="col">
  44. <div class="card" style="background-color: #EFEFEF;">
  45. <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">
  46. <div class="card-body">
  47. <h5 class="card-title"><a href="{% url 'playlist' playlist.playlist_id %}" class="stretched-link" style="text-decoration: none; color: black">{{ playlist.name }}</a></h5>
  48. <p class="card-text">
  49. <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>
  50. {% if playlist.get_watch_time_left != "0secs." %}<span class="badge bg-dark text-white">{{ playlist.get_watch_time_left }} left</span>{% endif %}
  51. </p>
  52. <p class="card-text">
  53. {% if playlist.tags.all %}
  54. <small>
  55. <i class="fas fa-tags fa-sm" style="color: black"></i>
  56. {% for tag in playlist.tags.all %}
  57. <span class="badge rounded-pill bg-primary mb-lg-1">
  58. {{ tag.name }}
  59. </span>
  60. {% endfor %}
  61. </small>
  62. {% endif %}
  63. </p>
  64. <p class="card-text"><small class="text-muted">Last watched {{ playlist.last_watched|naturalday }}</small></p>
  65. </div>
  66. </div>
  67. </div>
  68. <!--
  69. <div class="col">
  70. <div class="card">
  71. <a style="background-color: #7e89c2;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  72. <div class="card-body">
  73. <h5 class="card-title">
  74. {{ playlist.name }}
  75. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  76. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  77. </h5>
  78. <p class="card-text">
  79. <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>
  80. {% if playlist.get_watch_time_left != "0secs." %}<span class="badge bg-dark text-white">{{ playlist.get_watch_time_left }} left</span>{% endif %}
  81. </p>
  82. {% if playlist.tags.all %}
  83. <small>
  84. <i class="fas fa-tags fa-sm" style="color: yellow"></i>
  85. {% for tag in playlist.tags.all %}
  86. <span class="badge rounded-pill bg-primary mb-lg-1">
  87. {{ tag.name }}
  88. </span>
  89. {% endfor %}
  90. </small>
  91. {% endif %}
  92. </div>
  93. </a>
  94. </div>
  95. </div> -->
  96. <!--
  97. {% if forloop.counter == 3 %}
  98. {% if watching.count|add:"-3" != 0 %}
  99. <div class="col">
  100. <div class="card">
  101. <a style="background-color: #7e89c2;" href="{% url 'all_playlists' 'watching' %}" class="list-group-item list-group-item-action" aria-current="true">
  102. <div class="card-body">
  103. <p class="card-text">
  104. <h3>+ {{ watching.count|add:"-3" }} more</h3>
  105. </p>
  106. </div>
  107. </a>
  108. </div>
  109. </div>
  110. {% endif %}
  111. {% endif %}
  112. -->
  113. {% endfor %}
  114. </div>
  115. </div>
  116. <br>
  117. {% endif %}
  118. <div class="row" data-masonry='{"percentPosition": true }'>
  119. {% for playlist in user_playlists|slice:"0:3" %}
  120. <div class="col-sm-6 col-lg-4 mb-4">
  121. <div class="card card-cover h-100 overflow-hidden text-white bg-dark rounded-5 shadow-lg" style="">
  122. <div class="d-flex flex-column h-100 p-5 pb-3 text-white text-shadow-1">
  123. <h2 class="pt-5 mt-5 mb-4 display-6 lh-1 fw-bold"><a href="{% url 'playlist' playlist.playlist_id %}" class="stretched-link" style="text-decoration: none; color: #fafafa">{{ playlist.name }}</a> </h2>
  124. <ul class="d-flex list-unstyled mt-auto">
  125. <li class="me-auto">
  126. <img src="{{ playlist.thumbnail_url }}" alt="Bootstrap" width="32" height="32" class="rounded-circle border border-white">
  127. </li>
  128. <li class="d-flex align-items-center me-3">
  129. <small>by {{ playlist.channel_name }}</small>
  130. </li>
  131. <li class="d-flex align-items-center">
  132. <i class="fas fa-eye me-1"></i>
  133. <small>{{ playlist.num_of_accesses }} clicks</small>
  134. </li>
  135. </ul>
  136. </div>
  137. </div>
  138. </div>
  139. {% endfor %}
  140. <div class="col-sm-6 col-lg-4 mb-4">
  141. <div class="card">
  142. <svg class="bd-placeholder-img card-img-top" width="100%" height="200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Image cap" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#868e96"/><text x="50%" y="50%" fill="#dee2e6" dy=".3em">Image cap</text></svg>
  143. <div class="card-body">
  144. <h5 class="card-title">Card title that wraps to a new line</h5>
  145. <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="col-sm-6 col-lg-4 mb-4">
  150. <div class="card p-3">
  151. <figure class="p-3 mb-0">
  152. <blockquote class="blockquote">
  153. <p>A well-known quote, contained in a blockquote element.</p>
  154. </blockquote>
  155. <figcaption class="blockquote-footer mb-0 text-muted">
  156. Someone famous in <cite title="Source Title">Source Title</cite>
  157. </figcaption>
  158. </figure>
  159. </div>
  160. </div>
  161. <div class="col-sm-6 col-lg-4 mb-4">
  162. <div class="card">
  163. <svg class="bd-placeholder-img card-img-top" width="100%" height="200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Image cap" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#868e96"/><text x="50%" y="50%" fill="#dee2e6" dy=".3em">Image cap</text></svg>
  164. <div class="card-body">
  165. <h5 class="card-title">Card title</h5>
  166. <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
  167. <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
  168. </div>
  169. </div>
  170. </div>
  171. <div class="col-sm-6 col-lg-4 mb-4">
  172. <div class="card bg-dark text-white">
  173. <div class="card-body">
  174. <h6 class="d-flex align-items-center mb-3"><span class="text-info me-2">{{ user.playlists.count }}</span>Playlists Statistics</h6>
  175. <small>Public <span class="text-warning ms-1">{{ statistics.public_x }}%</span></small>
  176. <div class="progress mb-3" style="height: 5px">
  177. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.public_x }}%" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100"></div>
  178. </div>
  179. <small>Private <span class="text-warning ms-1">{{ statistics.private_x }}%</span></small>
  180. <div class="progress mb-3" style="height: 5px">
  181. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.private_x }}%" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100"></div>
  182. </div>
  183. <small>Favorites <span class="text-warning ms-1">{{ statistics.favorites_x }}%</span></small>
  184. <div class="progress mb-3" style="height: 5px">
  185. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.favorites_x }}%" aria-valuenow="89" aria-valuemin="0" aria-valuemax="100"></div>
  186. </div>
  187. <small>Watching <span class="text-warning ms-1">{{ statistics.watching_x }}%</span></small>
  188. <div class="progress mb-3" style="height: 5px">
  189. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.watching_x }}%" aria-valuenow="55" aria-valuemin="0" aria-valuemax="100"></div>
  190. </div>
  191. <small>Imported <span class="text-warning ms-1">{{ statistics.imported_x }}%</span></small>
  192. <div class="progress mb-3" style="height: 5px">
  193. <div class="progress-bar bg-primary" role="progressbar" style="width: {{ statistics.imported_x }}%" aria-valuenow="66" aria-valuemin="0" aria-valuemax="100"></div>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <div class="col-sm-6 col-lg-4 mb-4">
  199. <div class="card text-center">
  200. <div class="card-body">
  201. <h5 class="card-title">Card title</h5>
  202. <p class="card-text">This card has a regular title and short paragraph of text below it.</p>
  203. <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
  204. </div>
  205. </div>
  206. </div>
  207. <div class="col-sm-6 col-lg-4 mb-4">
  208. <div class="card">
  209. <svg class="bd-placeholder-img card-img" width="100%" height="260" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Card image" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#868e96"/><text x="50%" y="50%" fill="#dee2e6" dy=".3em">Card image</text></svg>
  210. </div>
  211. </div>
  212. <div class="col-sm-6 col-lg-4 mb-4">
  213. <div class="card p-3 text-end">
  214. <figure class="mb-0">
  215. <blockquote class="blockquote">
  216. <p>A well-known quote, contained in a blockquote element.</p>
  217. </blockquote>
  218. <figcaption class="blockquote-footer mb-0 text-muted">
  219. Someone famous in <cite title="Source Title">Source Title</cite>
  220. </figcaption>
  221. </figure>
  222. </div>
  223. </div>
  224. <div class="col-sm-6 col-lg-4 mb-4">
  225. <div class="card">
  226. <div class="card-body">
  227. <h5 class="card-title">Card title</h5>
  228. <p class="card-text">This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.</p>
  229. <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
  230. </div>
  231. </div>
  232. </div>
  233. </div>
  234. <div class="container" id="custom-cards">
  235. <h2 class="pb-2 border-bottom">Custom cards</h2>
  236. <div class="row row-cols-1 row-cols-lg-3 align-items-stretch g-4 py-5">
  237. {% for playlist in user_playlists|slice:"0:3" %}
  238. <div class="col">
  239. <div class="card card-cover h-100 overflow-hidden text-dark bg-dark rounded-5 shadow-lg" style="background-image: url('{% if playlist.videos.count != 0 %}{{ playlist.thumbnail_url }}{% endif %}'); background-position: center">
  240. <div class="d-flex flex-column h-100 p-5 pb-3 text-white text-shadow-1">
  241. <h2 class="pt-5 mt-5 mb-4 display-6 lh-1 fw-bold"><a href="{% url 'playlist' playlist.playlist_id %}" class="stretched-link" style="text-decoration: none; color: #100f0f">{{ playlist.name }}</a> </h2>
  242. <ul class="d-flex list-unstyled mt-auto">
  243. <li class="me-auto">
  244. <img src="{{ playlist.thumbnail_url }}" alt="Bootstrap" width="32" height="32" class="rounded-circle border border-white">
  245. </li>
  246. <li class="d-flex align-items-center me-3 text-dark">
  247. <small>by {{ playlist.channel_name }}</small>
  248. </li>
  249. <li class="d-flex align-items-center text-dark">
  250. <i class="fas fa-eye me-1"></i>
  251. <small>{{ playlist.num_of_accesses }}</small>
  252. </li>
  253. </ul>
  254. </div>
  255. </div>
  256. </div>
  257. {% endfor %}
  258. </div>
  259. </div>
  260. <div class="row text-dark mt-0 align-items-center">
  261. <div class="col">
  262. <div class="row">
  263. <div class="col">
  264. <div class="card" style="background: linear-gradient(-45deg, #aaae6b, #7b8eab, #8abc97, #e666f5); background-size: 400% 400%; animation: gradient 7s ease infinite;">
  265. <a href="#" class="list-group-item bg-transparent list-group-item-action" aria-current="true">
  266. <div class="card-body">
  267. <div class="d-flex justify-content-center h1">
  268. <i class="fas fa-map-pin" style="color:#c22929"></i>
  269. </div>
  270. <div class="d-flex justify-content-center h1">
  271. YOUR
  272. </div>
  273. <div class="d-flex justify-content-center h1">
  274. PINS
  275. </div>
  276. </div>
  277. </a>
  278. </div>
  279. </div>
  280. <div class="col">
  281. <div class="card" style="background: linear-gradient(-45deg, #0645a4, #2480cd, #84bcf3, #b7d6f7); background-size: 400% 400%; animation: gradient 7s ease infinite;">
  282. <a href="#" class="list-group-item list-group-item-action bg-transparent" aria-current="true">
  283. <div class="card-body">
  284. <div class="d-flex justify-content-center h1">
  285. <i class="fas fa-heart" style="color: indianred"></i>
  286. </div>
  287. <div class="d-flex justify-content-center h1">
  288. LIKED
  289. </div>
  290. <div class="d-flex justify-content-center h1">
  291. VIDEOS
  292. </div>
  293. </div>
  294. </a>
  295. </div>
  296. </div>
  297. </div>
  298. <!-- Implement later
  299. <div class="row mt-3">
  300. <div class="col">
  301. </div>
  302. <div class="col-6">
  303. <div class="card">
  304. <a style="background: linear-gradient(-45deg, #e2b968, #68af5b, #8a97bc, #d69ab2); background-size: 400% 400%; animation: gradient 7s ease infinite;" href="#" class="list-group-item list-group-item-action" aria-current="true">
  305. <div class="card-body">
  306. <div class="d-flex justify-content-center h1">
  307. <i class="fas fa-history"></i>
  308. </div>
  309. <div class="d-flex justify-content-center h1">
  310. YOUR
  311. </div>
  312. <div class="d-flex justify-content-center h1">
  313. ACTIVITY
  314. </div>
  315. </div>
  316. </a>
  317. </div>
  318. </div>
  319. <div class="col">
  320. </div>
  321. </div>
  322. -->
  323. </div>
  324. <div class="col-8">
  325. <!--
  326. <div class="card bg-transparent text-black border border-5 rounded-3 border-success p-3">
  327. <div class="card-body">
  328. <h3><span style="border-bottom: 3px #ffffff dashed;">Most viewed playlists</span> <a href="{% url 'all_playlists' 'all' %}" class="pt-1"><i class="fas fa-binoculars"></i> </a></h3>
  329. {% if user_playlists %}
  330. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  331. {% for playlist in user_playlists|slice:"0:3" %}
  332. <div class="col">
  333. <div class="card overflow-auto" style="background-color: #4790c7;">
  334. <a href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item bg-transparent list-group-item-action" aria-current="true">
  335. <div class="card-body">
  336. <h5 class="card-title">
  337. #{{ forloop.counter }} <br><br>{{ playlist.name }}
  338. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  339. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  340. </h5>
  341. <small>
  342. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  343. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  344. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  345. </small>
  346. </div>
  347. </a>
  348. </div>
  349. </div>
  350. {% endfor %}
  351. </div>
  352. {% else %}
  353. <br>
  354. <h5>Nothing to see here... yet.</h5>
  355. {% endif %}
  356. </div>
  357. </div>
  358. -->
  359. </div>
  360. </div>
  361. <br>
  362. <div class="row text-dark mt-0 d-flex justify-content-evenly">
  363. <div class="col">
  364. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Added</span> <i class="fas fa-plus-square" style="color:#972727;"></i></h3>
  365. {% if recently_added_playlists %}
  366. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  367. {% for playlist in recently_added_playlists %}
  368. <div class="col">
  369. <div class="card overflow-auto" style="background-color: #958a44;">
  370. <a href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item bg-transparent list-group-item-action" aria-current="true">
  371. <div class="card-body">
  372. <h5 class="card-title">
  373. {{ playlist.name }}
  374. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  375. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  376. </h5>
  377. <small>
  378. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  379. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  380. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  381. </small>
  382. </div>
  383. </a>
  384. </div>
  385. </div>
  386. {% endfor %}
  387. </div>
  388. {% else %}
  389. <br>
  390. <h5>You have no playlists ;-;</h5>
  391. {% endif %}
  392. </div>
  393. <div class="col">
  394. <h3><span style="border-bottom: 3px #ffffff dashed;">Recently Accessed</span> <i class="fas fa-redo fa-sm" style="color: #3c3fd2"></i></h3>
  395. {% if recently_accessed_playlists %}
  396. <div class="row row-cols-1 row-cols-md-3 g-4 text-dark mt-0">
  397. {% for playlist in recently_accessed_playlists %}
  398. <div class="col">
  399. <div class="card overflow-auto" style="background-color: #357779;">
  400. <a href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item bg-transparent list-group-item-action" aria-current="true">
  401. <div class="card-body">
  402. <h5 class="card-title">
  403. {{ playlist.name }}
  404. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  405. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  406. </h5>
  407. <small>
  408. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  409. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  410. <span class="badge bg-secondary rounded-pill">{{ playlist.num_of_accesses }} clicks </span>
  411. </small>
  412. </div>
  413. </a>
  414. </div>
  415. </div>
  416. {% endfor %}
  417. </div>
  418. {% else %}
  419. <br>
  420. <h5>Nothing to see here... yet.</h5>
  421. {% endif %}
  422. </div>
  423. </div>
  424. <br>
  425. <br>
  426. {% endif %}
  427. {% endblock %}