mirror of
https://github.com/krateng/maloja.git
synced 2025-04-16 16:52:18 +03:00
Added time selection for manual scrobbling, fix GH-221
This commit is contained in:
parent
759e88db3e
commit
174f096a05
@ -48,9 +48,24 @@
|
||||
<input placeholder='Enter to scrobble' class='simpleinput' id='album' onKeydown='scrobbleIfEnter(event)' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" id="use_custom_time" />
|
||||
Custom Time:
|
||||
</td>
|
||||
<td>
|
||||
<input id="scrobble_datetime" type="datetime-local">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<script>
|
||||
const now = new Date();
|
||||
const localDateTime = new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString().slice(0, 16);
|
||||
document.getElementById("scrobble_datetime").value = localDateTime;
|
||||
</script>
|
||||
|
||||
<br/>
|
||||
|
||||
<input type="checkbox" id="use_track_artists_for_album" checked='true' />
|
||||
|
@ -108,11 +108,20 @@ function scrobbleNew() {
|
||||
var title = document.getElementById("title").value;
|
||||
var album = document.getElementById("album").value;
|
||||
|
||||
if (document.getElementById("use_custom_time").checked) {
|
||||
var date = new Date(document.getElementById("scrobble_datetime").value + ':00Z');
|
||||
var timestamp = (date.getTime() + (date.getTimezoneOffset() * 60000)) / 1000;
|
||||
}
|
||||
else {
|
||||
var timestamp = null;
|
||||
}
|
||||
|
||||
scrobble(artists,title,albumartists,album);
|
||||
|
||||
|
||||
scrobble(artists,title,albumartists,album,timestamp);
|
||||
}
|
||||
|
||||
function scrobble(artists,title,albumartists,album) {
|
||||
function scrobble(artists,title,albumartists,album,timestamp) {
|
||||
|
||||
lastArtists = artists;
|
||||
lastTrack = title;
|
||||
@ -125,7 +134,10 @@ function scrobble(artists,title,albumartists,album) {
|
||||
"album": album
|
||||
}
|
||||
if (albumartists != null) {
|
||||
payload['albumartists'] = albumartists
|
||||
payload['albumartists'] = albumartists;
|
||||
}
|
||||
if (timestamp != null) {
|
||||
payload['time'] = timestamp;
|
||||
}
|
||||
|
||||
console.log(payload);
|
||||
|
Loading…
x
Reference in New Issue
Block a user