scrobble_list.html 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. {% extends "base.html" %}
  2. {% load humanize %}
  3. {% load static %}
  4. {% load thumbnail %}
  5. {% block head_extra %}
  6. <style>
  7. .container { margin-bottom:100px; }
  8. h2 { padding-top:20px; }
  9. .image-wrapper {
  10. contain: content;
  11. }
  12. .image-wrapper :hover {
  13. background:rgba(0,0,0,0.3);
  14. }
  15. .caption {
  16. position: fixed;
  17. top: 5px;
  18. left: 5px;
  19. padding: 3px;
  20. font-size: 90%;
  21. color:white;
  22. background:rgba(0,0,0,0.4);
  23. }
  24. .caption-medium {
  25. position: fixed;
  26. top: 5px;
  27. left: 5px;
  28. padding: 3px;
  29. font-size: 75%;
  30. color:white;
  31. background:rgba(0,0,0,0.4);
  32. }
  33. .caption-small {
  34. position: fixed;
  35. top: 5px;
  36. left: 5px;
  37. padding: 3px;
  38. font-size: 60%;
  39. color:white;
  40. background:rgba(0,0,0,0.4);
  41. }
  42. </style>
  43. {% endblock %}
  44. {% block content %}
  45. <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
  46. <div
  47. class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  48. <h1 class="h2">Dashboard</h1>
  49. <div class="btn-toolbar mb-2 mb-md-0">
  50. {% if user.is_authenticated %}
  51. <div class="btn-group me-2">
  52. {% if user.profile.lastfm_username %}
  53. <form action="{% url 'scrobbles:lastfm-import' %}" method="get">
  54. <button type="submit" class="btn btn-sm btn-outline-secondary">Last.fm Sync</button>
  55. </form>
  56. {% endif %}
  57. <button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal"
  58. data-bs-target="#importModal">Import</button>
  59. <button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal"
  60. data-bs-target="#exportModal">Export</button>
  61. </div>
  62. {% endif %}
  63. <div class="dropdown">
  64. <button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" id="graphDateButton"
  65. data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  66. <div data-feather="calendar"></div>
  67. This week
  68. </button>
  69. <div class="dropdown-menu" data-bs-toggle="#graphDataChange" aria-labelledby="graphDateButton">
  70. <a class="dropdown-item" href="#">This month</a>
  71. <a class="dropdown-item" href="#">This year</a>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. {% if not user.is_authenticated %}
  77. <p>Today <b>{{counts.today}}</b> | This Week <b>{{counts.week}}</b> | This Month <b>{{counts.month}}</b> | This Year <b>{{counts.year}}</b> | All Time <b>{{counts.alltime}}</b></p>
  78. <canvas class="my-4 w-100" id="myChart" width="900" height="300"></canvas>
  79. {% endif %}
  80. <div class="container">
  81. {% if user.is_authenticated %}
  82. <div class="row">
  83. <h2>Top Artist</h2>
  84. <ul class="nav nav-tabs" id="artistTab" role="tablist">
  85. {% for key, name in chart_keys.items %}
  86. <li class="nav-item" role="presentation">
  87. <button class="nav-link {% if forloop.counter == 2 %}active{% endif %}"
  88. id="artist-{{key}}-tab" data-bs-toggle="tab" data-bs-target="#artist-{{key}}"
  89. type="button" role="tab" aria-controls="home" aria-selected="true">{{name}}</button>
  90. </li>
  91. {% endfor %}
  92. </ul>
  93. <div class="tab-content" id="artistTabContent" class="maloja-chart">
  94. {% for key, artists in current_artist_charts.items %}
  95. <div class="tab-pane fade {% if forloop.counter == 2 %}show active{% endif %}" id="artist-{{key}}" role="tabpanel" aria-labelledby="artist-{{key}}-tab">
  96. <div style="display:block">
  97. <div style="float:left;">
  98. <div class="image-wrapper" style="display:flex; flex-wrap: wrap; margin:0">
  99. <div class="caption">#1 {{artists.0.name}}</div>
  100. {% if artists.0 %}
  101. {% if artists.0.thumbnail %}
  102. {% thumbnail artists.0.thumbnail "300x" as im %}<a href="{{artists.0.get_absolute_url}}"><img lt="{{artists.0.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  103. {% else %}
  104. <a href="{{artists.0.get_absolute_url}}"><img lt="{{artists.0.name}}" src="{% static "images/not-found.jpg" %}" width="300px"></a>
  105. {% endif %}
  106. {% endif %}
  107. </div>
  108. </div>
  109. <div style="float:left; width:300px;">
  110. <div style="display:flex; flex-wrap: wrap;">
  111. <div class="image-wrapper" class="image-wrapper" style="width:50%">
  112. <div class="caption-medium">#2 {{artists.1.name}}</div>
  113. {% if artists.1 %}
  114. {% if artists.1.thumbnail %}
  115. {% thumbnail artists.1.thumbnail "150" as im %}<a href="{{artists.1.get_absolute_url}}"><img lt="{{artists.1.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  116. {% else %}
  117. <a href="{{artists.1.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="150px"></a>
  118. {% endif %}
  119. {% endif %}
  120. </div>
  121. <div class="image-wrapper" class="image-wrapper" style="width:50%">
  122. <div class="caption-medium">#3 {{artists.2.name}}</div>
  123. {% if artists.2 %}
  124. {% if artists.2.thumbnail %}
  125. {% thumbnail artists.2.thumbnail "150" as im %}<a href="{{artists.2.get_absolute_url}}"><img lt="{{artists.2.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  126. {% else %}
  127. <a href="{{artists.2.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="150px"></a>
  128. {% endif %}
  129. {% endif %}
  130. </div>
  131. <div class="image-wrapper" class="image-wrapper" style="width:50%">
  132. <div class="caption-medium">#4 {{artists.3.name}}</div>
  133. {% if artists.3 %}
  134. {% if artists.3.thumbnail %}
  135. {% thumbnail artists.3.thumbnail "150" as im %}<a href="{{artists.3.get_absolute_url}}"><img lt="{{artists.3.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  136. {% else %}
  137. <a href="{{artists.3.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="150px"></a>
  138. {% endif %}
  139. {% endif %}
  140. </div>
  141. <div class="image-wrapper" class="image-wrapper" style="width:50%">
  142. <div class="caption-medium">#5 {{artists.4.name}}</div>
  143. {% if artists.4 %}
  144. {% if artists.4.thumbnail %}
  145. {% thumbnail artists.4.thumbnail "150" as im %}<a href="{{artists.4.get_absolute_url}}"><img lt="{{artists.4.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  146. {% else %}
  147. <a href="{{artists.4.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="150px"></a>
  148. {% endif %}
  149. {% endif %}
  150. </div>
  151. </div>
  152. </div>
  153. <div style="float:left; width:300px;">
  154. <div style="display:flex; flex-wrap: wrap;">
  155. <div class="image-wrapper" class="image-wrapper" class="image-wrapper" style="width:33;">
  156. <div class="caption-small">#6 {{artists.5.name}}</div>
  157. {% if artists.5 %}
  158. {% if artists.5.thumbnail %}
  159. {% thumbnail artists.5.thumbnail "100" as im %}<a href="{{artists.5.get_absolute_url}}"><img lt="{{artists.5.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  160. {% else %}
  161. <a href="{{artists.5.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="100px"></a>
  162. {% endif %}
  163. {% endif %}
  164. </div>
  165. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  166. <div class="caption-small">#7 {{artists.6.name}}</div>
  167. {% if artists.6 %}
  168. {% if artists.6.thumbnail %}
  169. {% thumbnail artists.6.thumbnail "100" as im %}<a href="{{artists.6.get_absolute_url}}"><img lt="{{artists.6.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  170. {% else %}
  171. <a href="{{artists.6.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="100px"></a>
  172. {% endif %}
  173. {% endif %}
  174. </div>
  175. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  176. <div class="caption-small">#8 {{artists.7.name}}</div>
  177. {% if artists.7 %}
  178. {% if artists.7.thumbnail %}
  179. {% thumbnail artists.7.thumbnail "100" as im %}<a href="{{artists.7.get_absolute_url}}"><img lt="{{artists.7.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  180. {% else %}
  181. <a href="{{artists.7.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="100px"></a>
  182. {% endif %}
  183. {% endif %}
  184. </div>
  185. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  186. <div class="caption-small">#9 {{artists.8.name}}</div>
  187. {% if artists.8 %}
  188. {% if artists.8.thumbnail %}
  189. {% thumbnail artists.8.thumbnail "100" as im %}<a href="{{artists.8.get_absolute_url}}"><img lt="{{artists.8.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  190. {% else %}
  191. <a href="{{artists.8.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="100px"></a>
  192. {% endif %}
  193. {% endif %}
  194. </div>
  195. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  196. <div class="caption-small">#10 {{artists.9.name}}</div>
  197. {% if artists.9 %}
  198. {% if artists.9.thumbnail %}
  199. {% thumbnail artists.9.thumbnail "100" as im %}<a href="{{artists.9.get_absolute_url}}"><img lt="{{artists.9.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  200. {% else %}
  201. <a href="{{artists.9.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="100px"></a>
  202. {% endif %}
  203. {% endif %}
  204. </div>
  205. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  206. <div class="caption-small">#11 {{artists.10.name}}</div>
  207. {% if artists.10 %}
  208. {% if artists.10.thumbnail %}
  209. {% thumbnail artists.10.thumbnail "100" as im %}<a href="{{artists.10.get_absolute_url}}"><img lt="{{artists.10.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  210. {% else %}
  211. <a href="{{artists.10.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="100px"></a>
  212. {% endif %}
  213. {% endif %}
  214. </div>
  215. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  216. <div class="caption-small">#12 {{artists.11.name}}</div>
  217. {% if artists.11 %}
  218. {% if artists.11.thumbnail %}
  219. {% thumbnail artists.11.thumbnail "100" as im %}<a href="{{artists.11.get_absolute_url}}"><img lt="{{artists.11.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  220. {% else %}
  221. <a href="{{artists.11.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="100px"></a>
  222. {% endif %}
  223. {% endif %}
  224. </div>
  225. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  226. <div class="caption-small">#13 {{artists.12.name}}</div>
  227. {% if artists.12 %}
  228. {% if artists.12.thumbnail %}
  229. {% thumbnail artists.12.thumbnail "100" as im %}<a href="{{artists.12.get_absolute_url}}"><img lt="{{artists.12.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  230. {% else %}
  231. <a href="{{artists.12.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="100px"></a>
  232. {% endif %}
  233. {% endif %}
  234. </div>
  235. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  236. <div class="caption-small">#14 {{artists.13.name}}</div>
  237. {% if artists.13 %}
  238. {% if artists.13.thumbnail %}
  239. <a href="{{artists.13.get_absolute_url}}"><img src="{{artists.13.thumbnail.url}}" width="100px"></a>
  240. {% else %}
  241. <a href="{{artists.13.get_absolute_url}}"><img src="{% static "images/not-found.jpg" %}" width="100px"></a>
  242. {% endif %}
  243. {% endif %}
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. {% endfor %}
  250. </div>
  251. </div>
  252. <div class="row">
  253. <h2>Top Tracks</h2>
  254. <ul class="nav nav-tabs" id="trackTab" role="tablist">
  255. {% for key, name in chart_keys.items %}
  256. <li class="nav-item" role="presentation">
  257. <button class="nav-link {% if forloop.counter == 2 %}active{% endif %}" id="track-{{key}}-tab" data-bs-toggle="tab"
  258. data-bs-target="#track-{{key}}" type="button" role="tab" aria-controls="home" aria-selected="true">{{name}}</button>
  259. </li>
  260. {% endfor %}
  261. </ul>
  262. <div class="tab-content" id="trackTabContent" class="maloja-chart">
  263. {% for chart_name, tracks in current_track_charts.items %}
  264. <div class="tab-pane fade {% if forloop.counter == 2 %}show active{% endif %}" id="track-{{chart_name}}" role="tabpanel" aria-labelledby="track-{{chart_name}}-tab">
  265. <div style="display:block">
  266. <div style="float:left;">
  267. <div class="image-wrapper" style="display:flex; flex-wrap: wrap; margin:0">
  268. <div class="caption">#1 {{tracks.0.title}}</div>
  269. {% if tracks.0 %}
  270. {% if tracks.0.album.cover_image %}
  271. {% thumbnail tracks.0.album.cover_image "300" as im %}<a href="{{tracks.0.get_absolute_url}}"><img lt="{{tracks.0.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  272. {% else %}
  273. <a href="{{tracks.0.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="300px"></a>
  274. {% endif %}
  275. {% endif %}
  276. </div>
  277. </div>
  278. <div style="float:left; width:300px;">
  279. <div style="display:flex; flex-wrap: wrap;">
  280. <div class="image-wrapper" style="width:50%">
  281. <div class="caption-medium">#2 {{tracks.1.title}}</div>
  282. {% if tracks.1 %}
  283. {% if tracks.1.album.cover_image %}
  284. {% thumbnail tracks.1.album.cover_image "150" as im %}<a href="{{tracks.1.get_absolute_url}}"><img lt="{{tracks.1.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  285. {% else %}
  286. <a href="{{tracks.1.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="150px"></a>
  287. {% endif %}
  288. {% endif %}
  289. </div>
  290. <div class="image-wrapper" style="width:50%">
  291. <div class="caption-medium">#3 {{tracks.2.title}}</div>
  292. {% if tracks.2 %}
  293. {% if tracks.2.album.cover_image %}
  294. {% thumbnail tracks.2.album.cover_image "150" as im %}<a href="{{tracks.2.get_absolute_url}}"><img lt="{{tracks.2.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  295. {% else %}
  296. <a href="{{tracks.2.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="150px"></a>
  297. {% endif %}
  298. {% endif %}
  299. </div>
  300. <div class="image-wrapper" style="width:50%">
  301. <div class="caption-medium">#4 {{tracks.3.title}}</div>
  302. {% if tracks.3 %}
  303. {% if tracks.3.album.cover_image %}
  304. {% thumbnail tracks.3.album.cover_image "150" as im %}<a href="{{tracks.3.get_absolute_url}}"><img lt="{{tracks.3.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  305. {% else %}
  306. <a href="{{tracks.3.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="150px"></a>
  307. {% endif %}
  308. {% endif %}
  309. </div>
  310. <div class="image-wrapper" style="width:50%">
  311. <div class="caption-medium">#5 {{tracks.4.title}}</div>
  312. {% if tracks.4 %}
  313. {% if tracks.4.album.cover_image %}
  314. {% thumbnail tracks.4.album.cover_image "150" as im %}<a href="{{tracks.4.get_absolute_url}}"><img lt="{{tracks.4.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  315. {% else %}
  316. <a href="{{tracks.4.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="150px"></a>
  317. {% endif %}
  318. {% endif %}
  319. </div>
  320. </div>
  321. </div>
  322. <div style="float:left; width:300px;">
  323. <div style="display:flex; flex-wrap: wrap;">
  324. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  325. <div class="caption-small">#6 {{tracks.5.title}}</div>
  326. {% if tracks.5 %}
  327. {% if tracks.5.album.cover_image %}
  328. {% thumbnail tracks.5.album.cover_image "100" as im %}<a href="{{tracks.5.get_absolute_url}}"><img lt="{{tracks.5.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  329. {% else %}
  330. <a href="{{tracks.5.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="100px"></a>
  331. {% endif %}
  332. {% endif %}
  333. </div>
  334. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  335. <div class="caption-small">#7 {{tracks.6.title}}</div>
  336. {% if tracks.6 %}
  337. {% if tracks.6.album.cover_image %}
  338. {% thumbnail tracks.6.album.cover_image "100" as im %}<a href="{{tracks.6.get_absolute_url}}"><img lt="{{tracks.6.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  339. {% else %}
  340. <a href="{{tracks.6.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="100px"></a>
  341. {% endif %}
  342. {% endif %}
  343. </div>
  344. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  345. <div class="caption-small">#8 {{tracks.7.title}}</div>
  346. {% if tracks.7 %}
  347. {% if tracks.7.album.cover_image %}
  348. {% thumbnail tracks.7.album.cover_image "100" as im %}<a href="{{tracks.7.get_absolute_url}}"><img lt="{{tracks.7.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  349. {% else %}
  350. <a href="{{tracks.7.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="100px"></a>
  351. {% endif %}
  352. {% endif %}
  353. </div>
  354. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  355. <div class="caption-small">#9 {{tracks.8.title}}</div>
  356. {% if tracks.8 %}
  357. {% if tracks.8.album.cover_image %}
  358. {% thumbnail tracks.8.album.cover_image "100" as im %}<a href="{{tracks.8.get_absolute_url}}"><img lt="{{tracks.8.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  359. {% else %}
  360. <a href="{{tracks.8.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="100px"></a>
  361. {% endif %}
  362. {% endif %}
  363. </div>
  364. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  365. <div class="caption-small">#10 {{tracks.9.title}}</div>
  366. {% if tracks.9 %}
  367. {% if tracks.9.album.cover_image %}
  368. {% thumbnail tracks.9.album.cover_image "100" as im %}<a href="{{tracks.9.get_absolute_url}}"><img lt="{{tracks.9.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  369. {% else %}
  370. <a href="{{tracks.9.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="100px"></a>
  371. {% endif %}
  372. {% endif %}
  373. </div>
  374. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  375. <div class="caption-small">#11 {{tracks.10.title}}</div>
  376. {% if tracks.10 %}
  377. {% if tracks.10.album.cover_image %}
  378. {% thumbnail tracks.10.album.cover_image "100" as im %}<a href="{{tracks.10.get_absolute_url}}"><img lt="{{tracks.10.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  379. {% else %}
  380. <a href="{{tracks.10.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="100px"></a>
  381. {% endif %}
  382. {% endif %}
  383. </div>
  384. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  385. <div class="caption-small">#12 {{tracks.11.title}}</div>
  386. {% if tracks.11 %}
  387. {% if tracks.11.album.cover_image %}
  388. {% thumbnail tracks.11.album.cover_image "100" as im %}<a href="{{tracks.11.get_absolute_url}}"><img lt="{{tracks.11.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  389. {% else %}
  390. <a href="{{tracks.11.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="100px"></a>
  391. {% endif %}
  392. {% endif %}
  393. </div>
  394. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  395. <div class="caption-small">#13 {{tracks.12.title}}</div>
  396. {% if tracks.12 %}
  397. {% if tracks.12.album.cover_image %}
  398. {% thumbnail tracks.12.album.cover_image "100" as im %}<a href="{{tracks.12.get_absolute_url}}"><img lt="{{tracks.12.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  399. {% else %}
  400. <a href="{{tracks.12.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="100px"></a>
  401. {% endif %}
  402. {% endif %}
  403. </div>
  404. <div class="image-wrapper" class="image-wrapper" style="width:33;">
  405. <div class="caption-small">#14 {{tracks.13.title}}</div>
  406. {% if tracks.13 %}
  407. {% if tracks.13.album.cover_image %}
  408. {% thumbnail tracks.13.album.cover_image "100" as im %}<a href="{{tracks.13.get_absolute_url}}"><img lt="{{tracks.13.name}}" src="{{im.url}}" width="{{im.width}}" height="{{im.height}}"></a>{% endthumbnail %}
  409. {% else %}
  410. <a href="{{tracks.13.get_absolute_url}}"><img src="{% static 'images/not-found.jpg' %}" width="100px"></a>
  411. {% endif %}
  412. {% endif %}
  413. </div>
  414. </div>
  415. </div>
  416. </div>
  417. </div>
  418. {% endfor %}
  419. </div>
  420. </div>
  421. <div class="row">
  422. <h2>Last Scrobbles</h2>
  423. <p>Today <b>{{counts.today}}</b> | This Week <b>{{counts.week}}</b> | This Month <b>{{counts.month}}</b> | This Year <b>{{counts.year}}</b> | All Time <b>{{counts.alltime}}</b></p>
  424. </div>
  425. <div class="row">
  426. <ul class="nav nav-tabs" id="myTab" role="tablist">
  427. <li class="nav-item" role="presentation">
  428. <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#latest-listened"
  429. type="button" role="tab" aria-controls="home" aria-selected="true">Tracks</button>
  430. </li>
  431. <li class="nav-item" role="presentation">
  432. <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#latest-watched"
  433. type="button" role="tab" aria-controls="profile" aria-selected="false">Videos</button>
  434. </li>
  435. <li class="nav-item" role="presentation">
  436. <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#latest-podcasted"
  437. type="button" role="tab" aria-controls="profile" aria-selected="false">Podcasts</button>
  438. </li>
  439. <li class="nav-item" role="presentation">
  440. <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#latest-sports"
  441. type="button" role="tab" aria-controls="profile" aria-selected="false">Sports</button>
  442. </li>
  443. </ul>
  444. <div class="tab-content" id="myTabContent2">
  445. <div class="tab-pane fade show active" id="latest-listened" role="tabpanel"
  446. aria-labelledby="latest-listened-tab">
  447. <div class="table-responsive">
  448. <table class="table table-striped table-sm">
  449. <thead>
  450. <tr>
  451. <th scope="col">Time</th>
  452. <th scope="col">Album</th>
  453. <th scope="col">Track</th>
  454. <th scope="col">Artist</th>
  455. </tr>
  456. </thead>
  457. <tbody>
  458. {% for scrobble in object_list %}
  459. <tr>
  460. <td>{{scrobble.timestamp|naturaltime}}</td>
  461. {% if scrobble.track.album.cover_image %}
  462. {% thumbnail scrobble.track.album.cover_image "25" as im %}
  463. <td><a href="{{scrobble.track.album.get_absolute_url}}"><img src="{{im.url}}" width={{im.width}} height={{im.height}} style="border:1px solid black;" /></aa></td>
  464. {% endthumbnail %}
  465. {% else %}
  466. <td><a href="{{scrobble.track.album.get_absolute_url}}">{{scrobble.track.album.name}}</a></td>
  467. {% endif %}
  468. <td><a href="{{scrobble.track.get_absolute_url }}">{{scrobble.track.title}}</a></td>
  469. <td><a href="{{scrobble.track.artist.get_absolute_url }}">{{scrobble.track.artist.name}}</aa></td>
  470. </tr>
  471. {% endfor %}
  472. </tbody>
  473. </table>
  474. </div>
  475. </div>
  476. <div class="tab-pane fade show" id="latest-watched" role="tabpanel"
  477. aria-labelledby="latest-watched-tab">
  478. <h2>Latest watched</h2>
  479. <div class="table-responsive">
  480. <table class="table table-striped table-sm">
  481. <thead>
  482. <tr>
  483. <th scope="col">Time</th>
  484. <th scope="col">Title</th>
  485. <th scope="col">Series</th>
  486. </tr>
  487. </thead>
  488. <tbody>
  489. {% for scrobble in video_scrobble_list %}
  490. <tr>
  491. <td>{{scrobble.timestamp|naturaltime}}</td>
  492. <td><a href="{{scrobble.video.get_absolute_url }}">{% if scrobble.video.tv_series%}S{{scrobble.video.season_number}}E{{scrobble.video.episode_number}} -{%endif %} {{scrobble.video.title}}</a></td>
  493. <td><a href="{{scrobble.video.tv_series.get_absolute_url }}">{% if scrobble.video.tv_series %}{{scrobble.video.tv_series}}</a>{% endif %}
  494. </td>
  495. </tr>
  496. {% endfor %}
  497. </tbody>
  498. </table>
  499. </div>
  500. </div>
  501. <div class="tab-pane fade show" id="latest-sports" role="tabpanel" aria-labelledby="latest-sports-tab">
  502. <h2>Latest Sports</h2>
  503. <div class="table-responsive">
  504. <table class="table table-striped table-sm">
  505. <thead>
  506. <tr>
  507. <th scope="col">Date</th>
  508. <th scope="col">Title</th>
  509. <th scope="col">Round</th>
  510. <th scope="col">League</th>
  511. </tr>
  512. </thead>
  513. <tbody>
  514. {% for scrobble in sport_scrobble_list %}
  515. <tr>
  516. <td>{{scrobble.timestamp|naturaltime}}</td>
  517. <td>{{scrobble.sport_event.title}}</td>
  518. <td>{{scrobble.sport_event.round.name}}</td>
  519. <td>{{scrobble.sport_event.round.season.league}}</td>
  520. </tr>
  521. {% endfor %}
  522. </tbody>
  523. </table>
  524. </div>
  525. </div>
  526. <div class="tab-pane fade show" id="latest-podcasted" role="tabpanel"
  527. aria-labelledby="latest-podcasted-tab">
  528. <h2>Latest Podcasted</h2>
  529. <div class="table-responsive">
  530. <table class="table table-striped table-sm">
  531. <thead>
  532. <tr>
  533. <th scope="col">Date</th>
  534. <th scope="col">Title</th>
  535. <th scope="col">Podcast</th>
  536. </tr>
  537. </thead>
  538. <tbody>
  539. {% for scrobble in podcast_scrobble_list %}
  540. <tr>
  541. <td>{{scrobble.timestamp|naturaltime}}</td>
  542. <td>{{scrobble.podcast_episode.title}}</td>
  543. <td>{{scrobble.podcast_episode.podcast}}</td>
  544. </tr>
  545. {% endfor %}
  546. </tbody>
  547. </table>
  548. </div>
  549. </div>
  550. </div>
  551. {% endif %}
  552. </div>
  553. </main>
  554. <div class="modal fade" id="importModal" tabindex="-1" role="dialog" aria-labelledby="importModalLabel"
  555. aria-hidden="true">
  556. <div class="modal-dialog" role="document">
  557. <div class="modal-content">
  558. <div class="modal-header">
  559. <h5 class="modal-title" id="importModalLabel">Import scrobbles</h5>
  560. <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
  561. <div aria-hidden="true">&times;</div>
  562. </button>
  563. </div>
  564. <form action="{% url 'scrobbles:audioscrobbler-file-upload' %}" method="post" enctype="multipart/form-data">
  565. <div class="modal-body">
  566. {% csrf_token %}
  567. <div class="form-group">
  568. <label for="tsv_file" class="col-form-label">Audioscrobbler TSV file:</label>
  569. <input type="file" name="tsv_file" class="form-control" id="id_tsv_file">
  570. </div>
  571. </div>
  572. <div class="modal-footer">
  573. <button type="submit" class="btn btn-primary">Import</button>
  574. </div>
  575. </form>
  576. <form action="{% url 'scrobbles:koreader-file-upload' %}" method="post" enctype="multipart/form-data">
  577. <div class="modal-body">
  578. {% csrf_token %}
  579. <div class="form-group">
  580. <label for="tsv_file" class="col-form-label">KOReader sqlite file:</label>
  581. <input type="file" name="sqlite_file" class="form-control" id="id_sqlite_file">
  582. </div>
  583. </div>
  584. <div class="modal-footer">
  585. <button type="submit" class="btn btn-primary">Import</button>
  586. </div>
  587. </form>
  588. </div>
  589. </div>
  590. </div>
  591. <div class="modal fade" id="exportModal" tabindex="-1" role="dialog" aria-labelledby="exportModalLabel"
  592. aria-hidden="true">
  593. <div class="modal-dialog" role="document">
  594. <div class="modal-content">
  595. <div class="modal-header">
  596. <h5 class="modal-title" id="exportModalLabel">Export scrobbles</h5>
  597. <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
  598. <div aria-hidden="true">&times;</div>
  599. </button>
  600. </div>
  601. <form action="{% url 'scrobbles:export' %}" method="get">
  602. <div class="modal-body">
  603. {% csrf_token %}
  604. <div class="form-group">
  605. {{export_form.as_div}}
  606. </div>
  607. </div>
  608. <div class="modal-footer">
  609. <button type="submit" class="btn btn-primary">Export</button>
  610. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  611. </div>
  612. </form>
  613. </div>
  614. </div>
  615. </div>
  616. {% endblock %}
  617. {% block extra_js %}
  618. <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>
  619. <script>
  620. /* globals Chart:false, feather:false */
  621. (function () {
  622. 'use strict'
  623. feather.replace({ 'aria-hidden': 'true' })
  624. // Graphs
  625. var ctx = document.getElementById('myChart')
  626. // eslint-disable-next-line no-unused-vars
  627. var myChart = new Chart(ctx, {
  628. type: 'line',
  629. data: {
  630. labels: [
  631. {% for day in weekly_data.keys %}
  632. "{{day}}"{% if not forloop.last %},{% endif %}
  633. {% endfor %}
  634. ],
  635. datasets: [{
  636. data: [
  637. {% for count in weekly_data.values %}
  638. {{count}}{% if not forloop.last %},{% endif %}
  639. {% endfor %}
  640. ],
  641. lineTension: 0,
  642. backgroundColor: 'transparent',
  643. borderColor: '#007bf0',
  644. borderWidth: 4,
  645. pointBackgroundColor: '#007bff'
  646. }]
  647. },
  648. options: {
  649. scales: {
  650. yAxes: [{
  651. ticks: {
  652. beginAtZero: true
  653. }
  654. }]
  655. },
  656. legend: {
  657. display: false
  658. }
  659. }
  660. })
  661. })()
  662. </script>
  663. {% endblock %}