scrobble_list.html 38 KB

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