Fixed scrobbling from track page

This commit is contained in:
krateng 2023-10-28 15:36:03 +02:00
parent 83fcb6cf36
commit 771a5ba3aa
2 changed files with 8 additions and 3 deletions
maloja/web/jinja

@ -32,7 +32,7 @@
{% endif %}
<p class="stats">
{% if adminmode %}<button type="button" onclick="scrobble('{{ encodedtrack }}')">Scrobble now</button>{% endif %}
{% if adminmode %}<button type="button" onclick="scrobbleThisTrack()">Scrobble now</button>{% endif %}
<a href="{{ mlj_uri.create_uri("/scrobbles",filterkeys) }}">{{ info['scrobbles'] }} Scrobbles</a>
</p>

@ -6,8 +6,13 @@
{% block scripts %}
<script src="/statselect.js"></script>
<script>
function scrobble(encodedtrack) {
neo.xhttprequest('/apis/mlj_1/newscrobble?nofix&' + encodedtrack,data={},method="POST").then(response=>{window.location.reload()});
function scrobbleThisTrack() {
var payload = {
"artists":{{ info.track.artists | tojson }},
"title":{{ info.track.title | tojson }},
"nofix": true
}
neo.xhttprequest("/apis/mlj_1/newscrobble",data=payload,method="POST",callback=notifyCallback,json=true).then(response=>{window.location.reload()});
}
</script>
{% endblock %}