base.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. {% load static %}
  2. {% load humanize %}
  3. <!doctype html>
  4. <html class="no-js" lang="">
  5. <head>
  6. <title>{% block page_title %}Scrobble all the things{% endblock %} @ Vrobbler</title>
  7. <meta charset="utf-8">
  8. <meta http-equiv="x-ua-compatible" content="ie=edge">
  9. <meta name="description" content="">
  10. <meta name="viewport" content="width=device-width, initial-scale=1">
  11. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  12. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
  13. <script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
  14. <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.10/clipboard.min.js"></script>
  15. <style type="text/css">
  16. dl {
  17. display: flex;
  18. flex-flow: column wrap;
  19. border: 1px solid #777;
  20. }
  21. dt {
  22. padding: 2px 4px;
  23. background: #000;
  24. color: #fff;
  25. }
  26. dd {
  27. margin: 0;
  28. padding: 4px;
  29. min-height: 3em;
  30. border-right: 1px solid #777;
  31. }
  32. .latest-scrobble {
  33. width: 50%;
  34. }
  35. .progress-bar {
  36. width: 100%;
  37. background-color: #e0e0e0;
  38. padding: 3px;
  39. border-radius: 3px;
  40. box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2);
  41. }
  42. .progress-bar-fill {
  43. display: block;
  44. height: 22px;
  45. background-color: #659cef;
  46. border-radius: 3px;
  47. transition: width 500ms ease-in-out;
  48. }
  49. .bd-placeholder-img {
  50. font-size: 1.125rem;
  51. text-anchor: middle;
  52. -webkit-user-select: none;
  53. -moz-user-select: none;
  54. user-select: none;
  55. }
  56. @media (min-width: 768px) {
  57. .bd-placeholder-img-lg {
  58. font-size: 3.5rem;
  59. }
  60. }
  61. body {
  62. font-size: .875rem;
  63. }
  64. .feather {
  65. width: 16px;
  66. height: 16px;
  67. vertical-align: text-bottom;
  68. }
  69. /*
  70. * Sidebar
  71. */
  72. .sidebar {
  73. position: fixed;
  74. top: 0;
  75. /* rtl:raw:
  76. right: 0;
  77. */
  78. bottom: 0;
  79. /* rtl:remove */
  80. left: 0;
  81. z-index: 100; /* Behind the navbar */
  82. padding: 48px 0 0; /* Height of navbar */
  83. box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
  84. }
  85. @media (max-width: 767.98px) {
  86. .sidebar {
  87. top: 5rem;
  88. }
  89. }
  90. .sidebar-sticky {
  91. position: relative;
  92. top: 0;
  93. height: calc(100vh - 48px);
  94. padding-top: .5rem;
  95. overflow-x: hidden;
  96. overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
  97. }
  98. .sidebar .nav-link {
  99. font-weight: 500;
  100. color: #333;
  101. }
  102. .sidebar .nav-link .feather {
  103. margin-right: 4px;
  104. color: #727272;
  105. }
  106. .sidebar .nav-link.active {
  107. color: #2470dc;
  108. }
  109. .sidebar .nav-link:hover .feather,
  110. .sidebar .nav-link.active .feather {
  111. color: inherit;
  112. }
  113. .sidebar-heading {
  114. font-size: .75rem;
  115. text-transform: uppercase;
  116. }
  117. /*
  118. * Navbar
  119. */
  120. .navbar-brand {
  121. padding-top: .75rem;
  122. padding-bottom: .75rem;
  123. font-size: 1rem;
  124. background-color: rgba(0, 0, 0, .25);
  125. box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
  126. }
  127. .navbar .navbar-toggler {
  128. top: .25rem;
  129. right: 1rem;
  130. }
  131. .navbar .form-control {
  132. padding: .75rem 1rem;
  133. border-width: 0;
  134. border-radius: 0;
  135. }
  136. .form-control-dark {
  137. color: #fff;
  138. background-color: rgba(255, 255, 255, .1);
  139. border-color: rgba(255, 255, 255, .1);
  140. }
  141. .form-control-dark:focus {
  142. border-color: transparent;
  143. box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
  144. }
  145. </style>
  146. {% block head_extra %}{% endblock %}
  147. <link rel="apple-touch-icon" href="/apple-touch-icon.png">
  148. <!-- Place favicon.ico in the root directory -->
  149. </head>
  150. <body>
  151. <header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
  152. <a class="navbar-brand col-md-3 col-lg-2 me-0 px-3" href="#">Vrobbler</a>
  153. <button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
  154. <span class="navbar-toggler-icon"></span>
  155. </button>
  156. <input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
  157. <div class="navbar-nav">
  158. <div class="nav-item text-nowrap">
  159. {% if user.is_authenticated %}
  160. <a class="nav-link px-3" href="{% url "account_logout" %}">Sign out</a>
  161. {% else %}
  162. <a class="nav-link px-3" href="{% url "account_login" %}">Sign in</a>
  163. {% endif %}
  164. </div>
  165. </div>
  166. </header>
  167. <div class="container-fluid">
  168. <div class="row">
  169. <nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
  170. <div class="position-sticky pt-3">
  171. {% if now_playing_list %}
  172. <ul style="padding-right:10px;">
  173. <b>Now playing</b>
  174. {% for scrobble in now_playing_list %}
  175. {% if scrobble.video %}
  176. <div>
  177. {{scrobble.video.title}}<br/>
  178. <small>{{scrobble.created|naturaltime}}<br/>
  179. from {{scrobble.source}}</small>
  180. <div class="progress-bar">
  181. <span class="progress-bar-fill" style="width: {{scrobble.percent_played}}%;"></span>
  182. </div>
  183. </div>
  184. {% endif %}
  185. {% if scrobble.track %}
  186. <div>
  187. {{scrobble.track.title}}<br/>
  188. <em>{{scrobble.track.artist}}</em><br/>
  189. <small>{{scrobble.created|naturaltime}}<br/>
  190. from {{scrobble.source}}</small>
  191. <div class="progress-bar" style="margin-right:5px;">
  192. <span class="progress-bar-fill" style="width: {{scrobble.percent_played}}%;"></span>
  193. </div>
  194. </div>
  195. {% endif %}
  196. <hr/>
  197. {% endfor %}
  198. </ul>
  199. {% endif %}
  200. <ul class="nav flex-column">
  201. <li class="nav-item">
  202. <a class="nav-link active" aria-current="page" href="#">
  203. <span data-feather="music"></span>
  204. Tracks
  205. </a>
  206. </li>
  207. <li class="nav-item">
  208. <a class="nav-link" href="#">
  209. <span data-feather="user"></span>
  210. Artists
  211. </a>
  212. </li>
  213. <li class="nav-item">
  214. <a class="nav-link" href="#">
  215. <span data-feather="film"></span>
  216. Movies
  217. </a>
  218. </li>
  219. <li class="nav-item">
  220. <a class="nav-link" href="#">
  221. <span data-feather="tv"></span>
  222. Series
  223. </a>
  224. </li>
  225. {% if user.is_authenticated %}
  226. <li class="nav-item">
  227. <a class="nav-link" href="/admin/">
  228. <span data-feather="key"></span>
  229. Admin
  230. </a>
  231. </li>
  232. {% endif %}
  233. </ul>
  234. {% block extra_nav %}
  235. {% endblock %}
  236. </div>
  237. </nav>
  238. {% block content %}
  239. {% endblock %}
  240. </div>
  241. </div>
  242. {% block extra_js %}
  243. <script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js" integrity="sha384-uO3SXW5IuS1ZpFPKugNNWqTZRRglnUJK6UAZ/gxOX80nxEkN9NcGZTftn6RzhGWE" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js" integrity="sha384-zNy6FEbO50N+Cg5wap8IKA4M/ZnLJgzc6w2NqACZaK0u0FXfOWRRJOnQtpZun8ha" crossorigin="anonymous"></script>
  244. <script><!-- comment ------------------------------------------------->
  245. /* globals Chart:false, feather:false */
  246. (function () {
  247. 'use strict'
  248. feather.replace({ 'aria-hidden': 'true' })
  249. // Graphs
  250. var ctx = document.getElementById('myChart')
  251. // eslint-disable-next-line no-unused-vars
  252. var myChart = new Chart(ctx, {
  253. type: 'line',
  254. data: {
  255. labels: [
  256. {% for day in weekly_data.keys %}
  257. "{{day}}"{% if not forloop.last %},{% endif %}
  258. {% endfor %}
  259. ],
  260. datasets: [{
  261. data: [
  262. {% for count in weekly_data.values %}
  263. {{count}}{% if not forloop.last %},{% endif %}
  264. {% endfor %}
  265. ],
  266. lineTension: 0,
  267. backgroundColor: 'transparent',
  268. borderColor: '#007bf0',
  269. borderWidth: 4,
  270. pointBackgroundColor: '#007bff'
  271. }]
  272. },
  273. options: {
  274. scales: {
  275. yAxes: [{
  276. ticks: {
  277. beginAtZero: false
  278. }
  279. }]
  280. },
  281. legend: {
  282. display: false
  283. }
  284. }
  285. })
  286. })()
  287. </script>
  288. {% endblock %}
  289. </body>
  290. </html>