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

Commit

Permalink
Plex plugin: artUrl is now a data-url
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasmus Thomsen authored and Rasmus Thomsen committed Oct 23, 2017
1 parent 3a17c68 commit a4d330c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plugins/plex/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@ function update() {
else if (document.querySelector('[aria-label=Play]') !== null)
playbackStatus = mellowplayer.PlaybackStatus.PAUSED;
try {
var artUrl = document.getElementsByClassName('AudioVideoPlayerControls-buttonGroupLeft-3kwFX')[
var artBlobUrl = document.getElementsByClassName('AudioVideoPlayerControls-buttonGroupLeft-3kwFX')[
0].children[0].children[0].children[0].children[0].children[0].children[0].children[0].children[0]
.style["background-image"];
artUrl = artUrl.replace('url("', "").replace('")', "");
artBlobUrl = artBlobUrl.replace('url("', "").replace('")', "");
// Get the data URL of the blob
var request = new XMLHttpRequest();
request.open('GET', artBlobUrl, true);
request.responseType = 'blob';
request.onload = function() {
var reader = new FileReader();
reader.readAsDataURL(request.response);
reader.onload = function(e){
return artUrl = e.target.result;
};
};
request.send();
} catch (e) {
var artUrl = '';
}
Expand Down

0 comments on commit a4d330c

Please sign in to comment.