From 22213655368f1e5432f2dc0f209f756cc878648b Mon Sep 17 00:00:00 2001 From: Krateng Date: Wed, 28 Nov 2018 12:29:02 +0100 Subject: [PATCH] Can now create multiple scrobbles from skipping back within a track --- scrobbler-vivaldi-plex/background.js | 10 ++++++++++ scrobbler-vivaldi-plex/contentScript.js | 10 ---------- server.py | 3 --- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/scrobbler-vivaldi-plex/background.js b/scrobbler-vivaldi-plex/background.js index df5368e..81a2aba 100644 --- a/scrobbler-vivaldi-plex/background.js +++ b/scrobbler-vivaldi-plex/background.js @@ -64,6 +64,16 @@ function startPlayback(artist,title,seconds) { console.log("Playback started!") if (artist == currentArtist && title == currentTitle && !currentlyPlaying) { console.log("Still previous track!") + while (alreadyPlayed > currentLength) { + console.log("This song is being played several times in a row!") + if (!alreadyScrobbled) { + scrobble(currentArtist,currentTitle) + //alreadyScrobbled = true + } + alreadyPlayed = alreadyPlayed - currentLength + alreadyScrobbled = false + + } d = new Date() t = Math.floor(d.getTime()/1000) lastUpdate = t diff --git a/scrobbler-vivaldi-plex/contentScript.js b/scrobbler-vivaldi-plex/contentScript.js index a9fb50a..af4c77a 100644 --- a/scrobbler-vivaldi-plex/contentScript.js +++ b/scrobbler-vivaldi-plex/contentScript.js @@ -1,13 +1,3 @@ -//activeLibrary = document.querySelector("[data-qa-id*=sidebarLibrariesList]").querySelector("[class*=Link-isSelected]") - -//currentArtist = "" -//currentTitle = "" -//alreadyPlayed = 0 -//maxLength = 0 -//lastUpdate = 0 - - - bar = document.querySelector("div[class*=PlayerControls]") if (bar == null) { console.log("Nothing playing right now!") diff --git a/server.py b/server.py index 12f39a6..71a4421 100755 --- a/server.py +++ b/server.py @@ -24,12 +24,9 @@ def mainpage(): @route("/db/") def database(pth): keys = FormsDict.decode(request.query) # The Dal★Shabet handler - for k in keys: - print(keys[k]) keystring = "?" for k in keys: keystring += urllib.parse.quote(k) + "=" + urllib.parse.quote(keys[k]) + "&" - print(keystring) contents = urllib.request.urlopen("http://localhost:" + str(DATABASE_PORT) + "/" + pth + keystring).read() response.content_type = "application/json" response.set_header("Access-Control-Allow-Origin","*")