Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

Plex plugin: initial bring up #135

Merged
merged 17 commits into from
Nov 5, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions plugins/plex/integration.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,19 @@ function update() {
var albumTitle = '';
}

var mediaArtElement = mediaInfoElement.children[
0].children[0].children[0].children[0].children[0].children[0]
var songHash = getHashCode(songTitle)

if (songHash !== previousSongHash) {
previousSongHash = songHash
artUrl = "";
convertArtUrlToBase64();
}
if (mediaArtElement)
if (songHash !== previousSongHash) {
artUrl = "";
convertArtUrlToBase64();
if (artUrl === "" )
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convertArtUrlToBase64 is asynchronous and set the global artUrl variable later when the response to the XmlHttpRequest has been received and the content loaded by the FileReader. So resetting previousSongHash would cause many redundant request while the response of the first one has not been received.

previousSongHash = ""
else
previousSongHash = songHash
}

var updateInfo = {
"playbackStatus": playbackStatus,
Expand Down