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

Scrobbler fix

This commit is contained in:
Krateng 2019-04-08 15:14:51 +02:00
parent 09d5b5c6d8
commit 0624996c73
5 changed files with 19 additions and 23 deletions

View File

@ -10,6 +10,3 @@ countas RenoakRhythm Approaching Nirvana
countas Shirley Manson Garbage
countas Lewis Brindley The Yogscast
countas Sips The Yogscast
countas Jennie BLACKPINK
countas Junghwa EXID
countas Hwasa Mamamoo

Can't render this file because it has a wrong number of fields in line 5.

View File

@ -19,6 +19,7 @@ replaceartist 4minute 4Minute
replacetitle 미쳐 Crazy
# BLACKPINK
countas Jennie BLACKPINK
replacetitle AS IF IT'S YOUR LAST As If It's Your Last
replacetitle BOOMBAYAH Boombayah
replacetitle WHISTLE Whistle
@ -62,6 +63,9 @@ replacetitle RBB (Really Bad Boy) Really Bad Boy
# EXID
countas Dasoni EXID
countas Junghwa EXID
countas Hani EXID
countas LE EXID
replacetitle HOT PINK Hot Pink
replacetitle AH YEAH Ah Yeah
replacetitle WHOZ THAT GIRL Whoz that girl
@ -91,6 +95,7 @@ replacetitle I'll be yours I'll Be Yours
replacetitle FEMALE PRESIDENT(여자 대통령) Female President
# Mamamoo
countas Hwasa Mamamoo
replaceartist Hwa Sa Hwasa
replaceartist MAMAMOO Mamamoo
replacetitle Egotistic(너나 해) Egotistic

Can't render this file because it has a wrong number of fields in line 5.

View File

@ -130,6 +130,7 @@ class Controller {
this.alreadyScrobbled = false;
this.messageID = 0;
this.lastMessage = 0;
this.update()
}
@ -143,6 +144,13 @@ class Controller {
// an actual update message from the script has arrived
playbackUpdate(request) {
if (request.time < self.lastMessage) {
console.log("Got message out of order, discarding!")
return
}
self.lastMessage = request.time
//console.log("Update message from our tab " + this.tabId + " (" + this.page + ")")
if (request.type == "stopPlayback" && this.currentlyPlaying) {
this.stopPlayback(request.artist,request.title);

View File

@ -1,7 +1,7 @@
bar = document.querySelector("div[class*=PlayerControls]")
if (bar == null) {
console.log("Nothing playing right now!")
chrome.runtime.sendMessage({type:"stopPlayback",artist:"",title:""})
chrome.runtime.sendMessage({type:"stopPlayback",time:Math.floor(Date.now()),artist:"",title:""})
exit()
}
@ -21,18 +21,11 @@ else {
control = bar.querySelector("div[class*=PlayerControls-buttonGroupCenter] > button:nth-child(2)").getAttribute("title")
if (control == "Play") {
console.log("Not playing right now")
chrome.runtime.sendMessage({type:"stopPlayback",artist:artist,title:title})
chrome.runtime.sendMessage({type:"stopPlayback",time:Math.floor(Date.now()),artist:artist,title:title})
//stopPlayback()
}
else if (control == "Pause") {
console.log("Playing " + artist + " - " + title)
chrome.runtime.sendMessage({type:"startPlayback",artist:artist,title:title,duration:durationSeconds})
chrome.runtime.sendMessage({type:"startPlayback",time:Math.floor(Date.now()),artist:artist,title:title,duration:durationSeconds})
//startPlayback(artist,title,durationSeconds)
}

View File

@ -1,7 +1,7 @@
bar = document.querySelector("ytmusic-player-bar")
if (bar == null) {
console.log("Nothing playing right now!")
chrome.runtime.sendMessage({type:"stopPlayback",artist:"",title:""})
chrome.runtime.sendMessage({type:"stopPlayback",time:Math.floor(Date.now()),artist:"",title:""})
exit()
}
@ -23,18 +23,11 @@ else {
control = ctrl.querySelector("div > paper-icon-button[class*=play-pause-button]").getAttribute("title")
if (control == "Play") {
console.log("Not playing right now")
chrome.runtime.sendMessage({type:"stopPlayback",artist:artist,title:title})
chrome.runtime.sendMessage({type:"stopPlayback",time:Math.floor(Date.now()),artist:artist,title:title})
//stopPlayback()
}
else if (control == "Pause") {
console.log("Playing " + artist + " - " + title)
chrome.runtime.sendMessage({type:"startPlayback",artist:artist,title:title,duration:durationSeconds})
chrome.runtime.sendMessage({type:"startPlayback",time:Math.floor(Date.now()),artist:artist,title:title,duration:durationSeconds})
//startPlayback(artist,title,durationSeconds)
}