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
1 # NAME: Artists and Groups
10 countas
11 countas
12
countas
countas

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
1 # NAME: K-Pop Girl Groups
19 replacetitle countas
20 replacetitle
21 replacetitle
22 replacetitle
23 replacetitle
24 replacetitle
25 replaceartist
63 replacetitle
64 replacetitle # TWICE
65 replacetitle
66 replacetitle
67 replacetitle
68 replacetitle
69 # AOA
70 countas
71 countas
95 replacetitle # LABOUM
96 replacetitle
97 # Bambino replacetitle
98 # Bambino
99 replaceartist
100 # Laysha
101 replaceartist

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)
}