Gives the interface the ability to pull information from the YouTube page.
This will make filling in song data much easier.
This commit is contained in:
@@ -16,7 +16,7 @@ logger.pushUpdate = function (message)
|
||||
}
|
||||
};
|
||||
|
||||
logger.log("Hello from Universal Music addon!")
|
||||
console.log("Hello from Universal Music addon!")
|
||||
|
||||
/**
|
||||
* This variable contains a mapping of message IDs to the message promises they correspond to, as
|
||||
@@ -178,11 +178,6 @@ function loadTab(url, pinned)
|
||||
}
|
||||
}
|
||||
}, reject);
|
||||
}).finally(() => {
|
||||
if (!pinned)
|
||||
{
|
||||
browser.tabs.remove(chosen);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class Album
|
||||
{
|
||||
type = "edu.regis.universeplayer.data.Album";
|
||||
name;
|
||||
artists;
|
||||
year;
|
||||
@@ -10,6 +11,7 @@ class Album
|
||||
|
||||
class Song
|
||||
{
|
||||
type = "edu.regis.universeplayer.data.Song";
|
||||
/**
|
||||
* The name of the song.
|
||||
*/
|
||||
@@ -34,11 +36,12 @@ class Song
|
||||
/**
|
||||
* A reference to the album this song is part of.
|
||||
*/
|
||||
album;
|
||||
album = new Album();
|
||||
}
|
||||
|
||||
class InternetSong extends Song
|
||||
{
|
||||
type = "edu.regis.universeplayer.data.InternetSong";
|
||||
/**
|
||||
* The location of the song.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
let logger = new Logger("foreground");
|
||||
logger.debug("Loading foreground.js");
|
||||
console.debug("Loading foreground.js");
|
||||
let background;
|
||||
|
||||
/**
|
||||
@@ -124,7 +124,7 @@ $(function () {
|
||||
background.onMessage.addListener(message => {
|
||||
let num = message.num;
|
||||
post = data => {
|
||||
logger.log("Sending to interface %o", data);
|
||||
logger.trace("Sending to interface %o", data);
|
||||
background.postMessage({
|
||||
type: "response",
|
||||
num: num,
|
||||
|
||||
@@ -57,19 +57,44 @@ class Logger {
|
||||
passLog(level, message)
|
||||
{
|
||||
let messageData;
|
||||
if (message.length > 1 && typeof message[0] == "string")
|
||||
if (message.length > 1)
|
||||
{
|
||||
/*
|
||||
* Format the initial string in a way that SLF4J can understand it.
|
||||
*/
|
||||
message[0] = message[0].replaceAll(/%[a-z]/gi, "{}");
|
||||
if (typeof message[0] == "string")
|
||||
{
|
||||
/*
|
||||
* Format the initial string in a way that SLF4J can understand it.
|
||||
*/
|
||||
message[0] = message[0].replaceAll(/%[a-z]/gi, "{}");
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < message.length; i++)
|
||||
{
|
||||
if (message[i] instanceof Error)
|
||||
{
|
||||
message[i] = {
|
||||
"type": "edu.regis.universeplayer.browserCommands.BrowserError",
|
||||
"name": message[i].name,
|
||||
"message": message[i].message,
|
||||
"fileName": message[i].fileName,
|
||||
"lineNumber": message[i].lineNumber,
|
||||
"columnNumber": message[i].columnNumber,
|
||||
"stack": message[i].stack
|
||||
}
|
||||
}
|
||||
}
|
||||
this.queuedMessages.push(new MessageData(this.name, level, message));
|
||||
message = this.queuedMessages.pop();
|
||||
try
|
||||
{
|
||||
while (message && this.pushUpdate(message))
|
||||
{
|
||||
message = this.queuedMessages.pop();
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.error("Could not post log message", e)
|
||||
}
|
||||
/*
|
||||
* If we popped a message but got here, then a message was not sent. Put it back.
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@ logger.pushUpdate = function (message)
|
||||
}
|
||||
};
|
||||
|
||||
ylogger.debug("Loading youtube.js")
|
||||
console.debug("Loading youtube.js")
|
||||
var video;
|
||||
|
||||
function onload()
|
||||
|
||||
Reference in New Issue
Block a user