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

Added identifying output to scrobbler sitescript

This commit is contained in:
krateng 2022-03-27 01:02:42 +01:00
parent e7663138c1
commit c0bf8cb8ac

View File

@ -32,7 +32,7 @@ Node.prototype.xpath = getxpath;
bar = document.xpath(maloja_scrobbler_selector_playbar, XPathResult.FIRST_ORDERED_NODE_TYPE); bar = document.xpath(maloja_scrobbler_selector_playbar, XPathResult.FIRST_ORDERED_NODE_TYPE);
if (bar == null) { if (bar == null) {
console.log("Nothing playing right now!"); console.log("[Maloja Scrobbler] Nothing playing right now!");
chrome.runtime.sendMessage({type:"stopPlayback",time:Math.floor(Date.now()),artist:"",title:""}); chrome.runtime.sendMessage({type:"stopPlayback",time:Math.floor(Date.now()),artist:"",title:""});
} }
else { else {
@ -78,12 +78,12 @@ else {
label_paused = "Play" label_paused = "Play"
} }
if (control == label_paused) { if (control == label_paused) {
console.log("Not playing right now"); console.log("[Maloja Scrobbler] Not playing right now");
chrome.runtime.sendMessage({type:"stopPlayback",time:Math.floor(Date.now()),artist:artist,title:title}); chrome.runtime.sendMessage({type:"stopPlayback",time:Math.floor(Date.now()),artist:artist,title:title});
//stopPlayback() //stopPlayback()
} }
else if (control == label_playing) { else if (control == label_playing) {
console.log("Playing " + artist + " - " + title + " (" + durationSeconds + " sec)"); console.log("[Maloja Scrobbler] Playing " + artist + " - " + title + " (" + durationSeconds + " sec)");
chrome.runtime.sendMessage({type:"startPlayback",time:Math.floor(Date.now()),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) //startPlayback(artist,title,durationSeconds)
} }