1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Fixed manual scrobbling of compilation albums

This commit is contained in:
krateng 2023-05-07 22:49:50 +02:00
parent d5c457a2e9
commit 0a4ac23dfa
3 changed files with 34 additions and 6 deletions

View File

@ -444,7 +444,7 @@ def post_scrobble(
artists:list=[],
title:str="",
album:str=None,
albumartists:list=[],
albumartists:list=None,
duration:int=None,
length:int=None,
time:int=None,
@ -478,7 +478,7 @@ def post_scrobble(
}
# for logging purposes, don't pass values that we didn't actually supply
rawscrobble = {k:rawscrobble[k] for k in rawscrobble if rawscrobble[k]}
rawscrobble = {k:rawscrobble[k] for k in rawscrobble if rawscrobble[k] is not None} # [] should be passed
result = database.incoming_scrobble(

View File

@ -4,6 +4,14 @@
{% block scripts %}
<script src="/manualscrobble.js"></script>
<style>
.tooltip {
cursor: help;
}
.tooltip:hover {
text-decoration: underline dotted;
}
</style>
{% endblock %}
@ -45,10 +53,15 @@
<br/>
<input type="checkbox" id="use_track_artists_for_album" checked='true' />
<span class="tooltip" title="If this is unchecked, specifying no album artists will result in a compilation album ('Various Artists')">Use track artists as album artists fallback</span>
<br/><br/>
<button type="button" onclick="scrobbleNew(event)">Scrobble!</button>
<button type="button" onclick="repeatLast()">↻</button>
<br/>

View File

@ -1,5 +1,7 @@
var lastArtists = []
var lastTrack = ""
var lastArtists = [];
var lastTrack = "";
var lastAlbumartists = [];
var lastAlbum = "";
function addArtist(artist) {
@ -96,8 +98,17 @@ function scrobbleNew() {
albumartists.push(node.textContent);
}
if (albumartists.length == 0) {
var use_track_artists = document.getElementById('use_track_artists_for_album').checked;
if (use_track_artists) {
albumartists = null;
}
}
var title = document.getElementById("title").value;
var album = document.getElementById("album").value;
scrobble(artists,title,albumartists,album);
}
@ -111,9 +122,13 @@ function scrobble(artists,title,albumartists,album) {
var payload = {
"artists":artists,
"title":title,
"albumartists": albumartists,
"album": album
}
if (albumartists != null) {
payload['albumartists'] = albumartists
}
console.log(payload);
if (title != "" && artists.length > 0) {