Fix bitrate not getting displayed.
This commit is contained in:
parent
e6d07ed882
commit
aa106319c2
1 changed files with 16 additions and 15 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name QuickDelete
|
// @name QuickDelete
|
||||||
// @namespace https://git.m3.fyi/Marsn3/userscripts
|
// @namespace https://git.m3.fyi/Marsn3/userscripts
|
||||||
// @version 0.2
|
// @version 0.3
|
||||||
// @author Marsn3
|
// @author Marsn3
|
||||||
// @match https://media.m3.fyi/*
|
// @match https://media.m3.fyi/*
|
||||||
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
|
||||||
|
|
@ -29,10 +29,6 @@
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => (apiKey = data.AccessToken)); // Store AccessToken
|
.then((data) => (apiKey = data.AccessToken)); // Store AccessToken
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Button to refresh the metadata of an item
|
// Button to refresh the metadata of an item
|
||||||
function refreshButton() {
|
function refreshButton() {
|
||||||
let el = document.createElement("button");
|
let el = document.createElement("button");
|
||||||
|
|
@ -60,9 +56,12 @@
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// Replace empty image with rotating spinner
|
// Replace empty image with rotating spinner
|
||||||
this.parentElement.firstChild.firstChild.classList.remove("audiotrack")
|
this.parentElement.firstChild.firstChild.classList.remove("audiotrack");
|
||||||
this.parentElement.firstChild.firstChild.classList.add("sync", "rotating")
|
this.parentElement.firstChild.firstChild.classList.add(
|
||||||
var style = document.createElement('style');
|
"sync",
|
||||||
|
"rotating"
|
||||||
|
);
|
||||||
|
var style = document.createElement("style");
|
||||||
style.innerHTML = `
|
style.innerHTML = `
|
||||||
.rotating {
|
.rotating {
|
||||||
animation: rotate 1s infinite;
|
animation: rotate 1s infinite;
|
||||||
|
|
@ -92,7 +91,7 @@
|
||||||
|
|
||||||
// Bind get function
|
// Bind get function
|
||||||
el.onclick = function () {
|
el.onclick = function () {
|
||||||
let bitrate;
|
var bitrate = 0;
|
||||||
let url = `${window.origin}/Users/${userid}/Items/${this.parentElement.dataset.id}`;
|
let url = `${window.origin}/Users/${userid}/Items/${this.parentElement.dataset.id}`;
|
||||||
console.log(`Fetching ${url}`);
|
console.log(`Fetching ${url}`);
|
||||||
|
|
||||||
|
|
@ -102,11 +101,13 @@
|
||||||
headers: {
|
headers: {
|
||||||
"X-Emby-Authorization": `MediaBrowser Client="QuickDelete", Device="Chrome", DeviceId="test", Version="10.8.9", Token="${apiKey}"`,
|
"X-Emby-Authorization": `MediaBrowser Client="QuickDelete", Device="Chrome", DeviceId="test", Version="10.8.9", Token="${apiKey}"`,
|
||||||
},
|
},
|
||||||
}).then((response) => response.json())
|
})
|
||||||
.then((data) => (bitrate = data.MediaSources[0].MediaStreams[0].BitRate.toString().substring(0, 3)));;
|
.then((response) => response.json())
|
||||||
console.log(bitrate)
|
.then((data) =>
|
||||||
// Remove parent to provide feedback and prevent double deletion
|
alert(
|
||||||
alert(`Bitrate: ${bitrate}`)
|
`${data.MediaStreams[0].BitRate.toString().substring(0, 3)}kbps`
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
//Return complete element
|
//Return complete element
|
||||||
return el;
|
return el;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue